From ed2013bc38d4a76e530333baa38653904dcb4733 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Jul 18 2017 06:44:35 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore index e69de29..439a466 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/odcs-0.0.3.tar.gz diff --git a/odcs-backend.service b/odcs-backend.service new file mode 100644 index 0000000..3ce4a1f --- /dev/null +++ b/odcs-backend.service @@ -0,0 +1,12 @@ +[Unit] +Description=ODCS backend service +After=network.target remote-fs.target nss-lookup.target + +[Service] +Type=simple +User=odcs +Group=apache +ExecStart=/usr/bin/odcs-backend + +[Install] +WantedBy=multi-user.target diff --git a/odcs-fedora-conf.patch b/odcs-fedora-conf.patch new file mode 100644 index 0000000..97960cd --- /dev/null +++ b/odcs-fedora-conf.patch @@ -0,0 +1,13 @@ +diff --git a/conf/config.py b/conf/config.py +index 2f056f8..2a91236 100644 +--- a/conf/config.py ++++ b/conf/config.py +@@ -52,7 +52,7 @@ class BaseConfiguration(object): + # noauth: no authentication is enabled. Useful for development particularly. + # kerberos: Kerberos authentication is enabled. + # openidc: OpenIDC authentication is enabled. +- AUTH_BACKEND = '' ++ AUTH_BACKEND = 'openidc' + + # Used for Kerberos authentication and to query user's groups. + # Format: ldap://hostname[:port] diff --git a/odcs-pythonldap.patch b/odcs-pythonldap.patch new file mode 100644 index 0000000..fa15af4 --- /dev/null +++ b/odcs-pythonldap.patch @@ -0,0 +1,10 @@ +diff --git a/requirements.txt b/requirements.txt +index ace5a03..f9d8fba 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -17,4 +17,4 @@ Flask-SQLAlchemy + Flask-Script + requests + jinja2 +-pyldap ++python-ldap diff --git a/odcs.spec b/odcs.spec new file mode 100644 index 0000000..1fc6452 --- /dev/null +++ b/odcs.spec @@ -0,0 +1,208 @@ +Name: odcs +Version: 0.0.3 +Release: 3%{?dist} +Summary: The On Demand Compose Service + + +Group: Development/Tools +License: MIT +URL: https://pagure.io/odcs +Source0: https://files.pythonhosted.org/packages/source/o/%{name}/%{name}-%{version}.tar.gz +Source1: odcs-backend.service +# In Fedora, "pyldap" is only for python3, not for python2. Therefore we +# have to patch the requirements.txt to use python-ldap instead of pyldap. +# Both ldap bindings are compatible on Python code level. +Patch0: odcs-pythonldap.patch +# Fedora related configuration for ODCS. +Patch1: odcs-fedora-conf.patch + +%if 0%{?rhel} && 0%{?rhel} <= 7 +# In EL7 we need flask which needs python-itsdangerous which comes from +# rhel7-extras which is only available on x86_64 for now. +ExclusiveArch: %{ix86} x86_64 +%else +BuildArch: noarch +%endif + +BuildRequires: python2-devel + +BuildRequires: help2man +BuildRequires: python2-pdc-client +BuildRequires: python-fedora +BuildRequires: python-flask-script +BuildRequires: python-httplib2 +BuildRequires: python-m2ext +BuildRequires: python-munch + +BuildRequires: python2-funcsigs +BuildRequires: python2-modulemd >= 1.1.0 +BuildRequires: python-qpid +BuildRequires: python2-openidc-client +BuildRequires: python-ldap + +%if 0%{?rhel} && 0%{?rhel} <= 7 +BuildRequires: python-setuptools +BuildRequires: python-flask-sqlalchemy +BuildRequires: python-flask-migrate +BuildRequires: python-nose +BuildRequires: python-mock +BuildRequires: python-six +BuildRequires: pyOpenSSL +BuildRequires: python-sqlalchemy +BuildRequires: python-futures +BuildRequires: python-flask +BuildRequires: systemd-python +%else +BuildRequires: python2-setuptools +BuildRequires: python2-flask-sqlalchemy +BuildRequires: python2-flask-migrate +BuildRequires: python2-nose +BuildRequires: python2-mock +BuildRequires: python2-tabulate +BuildRequires: python2-six +BuildRequires: python2-futures +BuildRequires: python2-flask +BuildRequires: python2-systemd + +%if (0%{?fedora} && 0%{?fedora} <= 25) || (0%{?rhel} && 0%{?rhel} <= 7) +BuildRequires: python2-pyOpenSSL +BuildRequires: python2-sqlalchemy +%else +BuildRequires: pyOpenSSL +BuildRequires: python-sqlalchemy +%endif + +%endif +BuildRequires: systemd + +%{?systemd_requires} + +Requires(pre): shadow-utils +Requires: systemd +Requires: pungi +Requires: python2-pdc-client +Requires: python-fedora +Requires: python-flask-script +Requires: python-httplib2 +Requires: python-m2ext +Requires: python-munch +Requires: python2-funcsigs +Requires: python2-modulemd >= 1.1.0 +Requires: python-qpid +Requires: python2-openidc-client +Requires: python-ldap + +%if 0%{?rhel} && 0%{?rhel} <= 7 +Requires: python-flask-sqlalchemy +Requires: python-flask-migrate +Requires: python-mock +Requires: python-six +Requires: pyOpenSSL +Requires: python-sqlalchemy +Requires: python-futures +Requires: python-flask +Requires: systemd-python +%else +Requires: python2-flask-sqlalchemy +Requires: python2-flask-migrate +Requires: python2-mock +Requires: python2-systemd +Requires: python2-six +Requires: python2-futures +Requires: python2-flask + +%if (0%{?fedora} && 0%{?fedora} <= 25) || (0%{?rhel} && 0%{?rhel} <= 7) +Requires: python2-pyOpenSSL +Requires: python2-sqlalchemy +%else +Requires: pyOpenSSL +Requires: python-sqlalchemy +%endif + +%endif + + +%description +The On Demand Compose Service (ODCS) creates temporary composes using Pungi +tool and manages their lifetime. The composes can be requested by external +services or users using the REST API provided by Flask frontend. + + +%prep +%setup -q + +%patch0 -p1 -b .pyldap +%patch1 -p1 + + +%build +%py2_build + + +%install +%py2_install + +export PYTHONPATH=%{buildroot}%{python2_sitelib} +mkdir -p %{buildroot}%{_mandir}/man1 +for command in odcs-manager odcs-frontend odcs-gencert odcs-upgradedb ; do +export ODCS_CONFIG_FILE=conf/config.py +help2man -N \ + --version-string=%{version} %{buildroot}%{_bindir}/$command > \ + %{buildroot}%{_mandir}/man1/$command.1 || \ + %{buildroot}%{_bindir}/$command --help + +done + +install -d -m 0755 %{buildroot}%{_unitdir} +install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/ + +install -d -m 0755 %{buildroot}%{_datadir}/odcs +install -p -m 0644 contrib/odcs.wsgi %{buildroot}%{_datadir}/odcs + +%pre +getent group odcs >/dev/null || groupadd -r odcs +getent passwd odcs >/dev/null || \ + useradd -r -g odcs -s /sbin/nologin \ + -c "On Demand Compose Service user" odcs +exit 0 + +%post +%systemd_post odcs-backend.service + +%preun +%systemd_preun odcs-backend.service + +%postun +%systemd_postun_with_restart odcs-backend.service + +%check +# Test fails currently, reported here: https://pagure.io/odcs/issue/25 +# Should be fixed in next release +#nosetests-2.7 -v + + +%files +%doc README.md +%license LICENSE +%{_unitdir}/odcs-backend.service +%{python2_sitelib}/odcs* +%{_bindir}/odcs-* +%{_mandir}/man1/odcs-*.1* +%{_datadir}/odcs +%dir %{_sysconfdir}/odcs +%config(noreplace) %{_sysconfdir}/odcs/config.py +%exclude %{_sysconfdir}/odcs/*.py[co] +%exclude %{python2_sitelib}/conf/ + + +%changelog +* Mon Jul 17 2017 Jan Kaluza - 0.0.3-3 +- Add python2- prefix to requirements when it makes sense +- Add -p to install command to preserve timestamp +- Fix macros formatting, use _datadir instead of /usr/share + +* Tue Jul 11 2017 Jan Kaluza - 0.0.3-2 +- fix dependencies + +* Thu Jun 29 2017 Jan Kaluza - 0.0.3-1 +- Initial version of spec file diff --git a/sources b/sources index e69de29..333e831 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (odcs-0.0.3.tar.gz) = 5676c200c3ef0ee24f58a7f6186054e8aa0b47c2ccd9c7d3403e713b33c184516a7b4acc9eae74887036f0a944726a167fed81b195707bdf630ef44437d63461