From 4b4fce5ceb212091e091c25ad80d06e4e63f24c9 Mon Sep 17 00:00:00 2001 From: Daniel Steiner Date: Sun, 21 Jan 2018 13:43:16 +0100 Subject: [PATCH] Two now package, but, not working for the upgrade --- fedora/SPECS/certbot.spec | 225 ++++++++++++++++++++++++++++++++++ fedora/SPECS/python-acme.spec | 201 ++++++++++++++++++++++++++++++ 2 files changed, 426 insertions(+) create mode 100644 fedora/SPECS/certbot.spec create mode 100644 fedora/SPECS/python-acme.spec diff --git a/fedora/SPECS/certbot.spec b/fedora/SPECS/certbot.spec new file mode 100644 index 0000000..b64318e --- /dev/null +++ b/fedora/SPECS/certbot.spec @@ -0,0 +1,225 @@ +%global oldpkg letsencrypt + +# On fedora use python3 for certbot +%if 0%{?fedora} +%bcond_without python3 +%else +%bcond_with python3 +%endif + + +Name: certbot +Version: 0.21.0 +Release: 1%{?dist} +Summary: A free, automated certificate authority client + +License: ASL 2.0 +URL: https://pypi.python.org/pypi/certbot +Source0: https://files.pythonhosted.org/packages/source/c/%{name}/%{name}-%{version}.tar.gz + +Source10: certbot-renew-systemd.service +Source11: certbot-renew-systemd.timer +Source12: certbot-sysconfig-certbot +Source13: certbot-README.fedora + +%if 0%{?rhel} +Patch0: allow-old-setuptools.patch +%endif + +BuildArch: noarch + +%if %{with python3} +BuildRequires: python3-devel +BuildRequires: python3-future +%endif + +BuildRequires: python2-devel +BuildRequires: python2-future + +# For the systemd macros +%{?systemd_requires} +BuildRequires: systemd + +# Need to label the httpd rw stuff correctly until base selinux policy updated +Requires(post): %{_sbindir}/semanage +Requires(postun): %{_sbindir}/semanage + +# On F26+ use python3 +%if 0%{?fedora} >= 26 +Requires: python3-certbot = %{version}-%{release} +%else +Requires: python2-certbot = %{version}-%{release} +%endif + +Obsoletes: %{oldpkg} < 0.6.0 +Provides: %{oldpkg} = %{version}-%{release} + +# Required for documentation +BuildRequires: python2-sphinx +BuildRequires: python2-sphinx_rtd_theme +BuildRequires: python2-repoze-sphinx-autointerface + +#Require for testing +BuildRequires: python-nose-xcover +BuildRequires: python-pep8 +BuildRequires: python2-tox +BuildRequires: python2-mock +BuildRequires: python2-configargparse >= 0.10.0 +BuildRequires: python2-zope-interface +BuildRequires: python2-zope-component +BuildRequires: python2-requests +BuildRequires: python2-dialog >= 3.3.0 +BuildRequires: python2-psutil >= 2.1.0 +BuildRequires: python-parsedatetime +BuildRequires: python2-configobj +BuildRequires: python2-configargparse >= 0.10.0 +BuildRequires: python2-acme >= 0.20.0 + +%if %{with python3} +#Require for testing +BuildRequires: python3-nose-xcover +BuildRequires: python3-pep8 +BuildRequires: python3-tox +BuildRequires: python3-mock +BuildRequires: python3-configargparse >= 0.10.0 +BuildRequires: python3-zope-interface +BuildRequires: python3-zope-component +BuildRequires: python3-requests +BuildRequires: python3-dialog >= 3.3.0 +BuildRequires: python3-psutil >= 2.1.0 +BuildRequires: python3-parsedatetime +BuildRequires: python3-configobj +BuildRequires: python3-configargparse >= 0.10.0 +BuildRequires: python3-acme >= 0.20.0 +%endif + +%description +certbot is a free, automated certificate authority that aims +to lower the barriers to entry for encrypting all HTTP traffic on the internet. + +%package -n python2-certbot +Requires: python2-configargparse >= 0.10.0 +Requires: python2-dialog >= 3.3.0 +Requires: python-parsedatetime +Requires: python2-mock +Requires: python2-zope-interface +Requires: python2-zope-component +Requires: python2-psutil >= 2.1.0 +Requires: python2-configobj +Requires: python2-future +Requires: python2-acme >= 0.20.0 +Obsoletes: python2-%{oldpkg} < 0.6.0 +Provides: python2-%{oldpkg} = %{version}-%{release} +Obsoletes: python-%{oldpkg} < 0.6.0 +Provides: python-%{oldpkg} = %{version}-%{release} +#Recommends: certbot-doc +Summary: Python 2 libraries used by certbot +%{?python_provide:%python_provide python2-certbot} + +%description -n python2-certbot +The python2 libraries to interface with certbot + + +%if %{with python3} +%package -n python3-certbot +Requires: python3-configargparse >= 0.10.0 +Requires: python3-dialog >= 3.3.0 +Requires: python3-parsedatetime +Requires: python3-mock +Requires: python3-zope-interface +Requires: python3-zope-component +Requires: python3-psutil >= 2.1.0 +Requires: python3-future +Requires: python3-configobj +Requires: python3-acme >= 0.20.0 +Summary: Python 3 libraries used by certbot +%{?python_provide:%python_provide python3-certbot} + +%description -n python3-certbot +The python3 libraries to interface with certbot + +%endif + +%prep +%autosetup -n %{name}-%{version} -p1 + + +%build +%py2_build +%if %{with python3} +%py3_build +%endif + +# build documentation +# %{__python2} setup.py install --user +# make -C docs man PATH=${HOME}/.local/bin:$PATH + +%install +%py2_install +mv %{buildroot}%{_bindir}/certbot{,-2} +%if %{with python3} +%py3_install +mv %{buildroot}%{_bindir}/certbot{,-3} +%endif +# Add compatibility symlink as requested by upstream conference call +ln -sf /usr/bin/certbot %{buildroot}/usr/bin/%{oldpkg} +# Put the man pages in place +# install -pD -t %{buildroot}%{_mandir}/man1 docs/_build/man/*1* +# On F26+ use python3 +%if 0%{?fedora} >= 26 +ln -s %{_bindir}/certbot-3 %{buildroot}%{_bindir}/certbot +%else +ln -s %{_bindir}/certbot-2 %{buildroot}%{_bindir}/certbot +%endif +install -Dm 0644 %{SOURCE10} %{buildroot}%{_unitdir}/certbot-renew.service +install -Dm 0644 %{SOURCE11} %{buildroot}%{_unitdir}/certbot-renew.timer +install -Dm 0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/certbot +cp %{SOURCE13} README.fedora + +%check +%{__python2} setup.py test +%if %{with python3} +%{__python3} setup.py test +%endif +# Make sure the scripts use the expected python versions +grep -q %{__python2} %{buildroot}%{_bindir}/certbot-2 +%if %{with python3} +grep -q %{__python3} %{buildroot}%{_bindir}/certbot-3 +%endif + +# The base selinux policies don't handle the certbot directories yet so set them up manually +%post +semanage fcontext -a -t cert_t '%{_sysconfdir}/(letsencrypt|certbot)/(live|archive)(/.*)?' +restorecon -R %{_sysconfdir}/letsencrypt || : + +%files +%license LICENSE.txt +%doc README.rst CHANGES.rst CONTRIBUTING.md README.fedora +%{_bindir}/certbot +%{_bindir}/%{oldpkg} +# %doc %attr(0644,root,root) %{_mandir}/man1/%{name}* +# project uses old letsencrypt dir for compatibility +%ghost %dir %{_sysconfdir}/%{oldpkg} +%ghost %dir %{_sharedstatedir}/%{oldpkg} +%config %{_sysconfdir}/sysconfig/certbot +%{_unitdir}/certbot-renew.service +%{_unitdir}/certbot-renew.timer + +%files -n python2-certbot +%license LICENSE.txt +%{python2_sitelib}/%{name} +%{python2_sitelib}/%{name}-%{version}*.egg-info +%{_bindir}/certbot-2 + +%if %{with python3} +%files -n python3-certbot +%license LICENSE.txt +%{python3_sitelib}/%{name} +%{python3_sitelib}/%{name}-%{version}*.egg-info +%{_bindir}/certbot-3 +%endif + +%changelog +* Sun Jan 21 2018 Daniel Steiner - 0.21.0-1 +- Initial build for Fedora 27 + diff --git a/fedora/SPECS/python-acme.spec b/fedora/SPECS/python-acme.spec new file mode 100644 index 0000000..c354871 --- /dev/null +++ b/fedora/SPECS/python-acme.spec @@ -0,0 +1,201 @@ +%global srcname acme + +%if 0%{?fedora} +%bcond_without python3 +%else +%bcond_with python3 +%endif + +Name: python-acme +Version: 0.20.0 +Release: 1%{?dist} +Summary: Python library for the ACME protocol +License: ASL 2.0 +URL: https://pypi.python.org/pypi/acme +Source0: https://files.pythonhosted.org/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz + +# When running tests argparse is not recognised as provided by core + +%if 0%{?rhel} +Patch0: epel7-setup.patch +%endif + +BuildRequires: python2-devel +BuildRequires: python-sphinx +%if 0%{?fedora} +BuildRequires: python-sphinx_rtd_theme +%endif +BuildRequires: python-cryptography +BuildRequires: pyOpenSSL >= 0.13 +BuildRequires: python-requests +BuildRequires: python-pyrfc3339 + +%if %{with python3} +BuildRequires: python3-devel +BuildRequires: python3-sphinx +BuildRequires: python3-cryptography +BuildRequires: python3-pyOpenSSL >= 0.13 +BuildRequires: python3-requests +BuildRequires: python3-pyrfc3339 +%endif + +# Required for testing +BuildRequires: python-ndg_httpsclient +BuildRequires: python-nose +BuildRequires: python-tox +BuildRequires: python-mock +BuildRequires: pytz + +%if %{with python3} +BuildRequires: python3-ndg_httpsclient +BuildRequires: python3-nose +BuildRequires: python3-tox +BuildRequires: python3-mock +BuildRequires: python3-pytz +%endif + +BuildArch: noarch + +%{!?py2_build: %global py2_build CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build} +%{!?py2_install: %global py2_install %{__python} setup.py install --skip-build --root %{buildroot}} +%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}} + +%package -n python2-acme +Requires: python-cryptography +Requires: python-ndg_httpsclient +Requires: python-pyasn1 +Requires: pyOpenSSL >= 0.13 +Requires: python-pyrfc3339 +Requires: pytz +Requires: python-requests +Requires: python-six +%if %{with python3} +# Recommends not supported by rpm on EL7 +#Recommends: python-acme-doc +%endif +Summary: %{summary} +%{?python_provide:%python_provide python2-acme} + + +%description +Python libraries implementing the Automatic Certificate Management Environment +(ACME) protocol. It is used by the Let's Encrypt project. + +%description -n python2-acme +Python 2 library for use of the Automatic Certificate Management Environment +protocol as defined by the IETF. It's used by the Let's Encrypt project. + +%if %{with python3} +%package -n python3-acme +Requires: python3-cryptography +Requires: python3-ndg_httpsclient +Requires: python3-pyasn1 +Requires: python3-pyOpenSSL +Requires: python3-pyrfc3339 +Requires: python3-pytz +Requires: python3-requests +Requires: python3-six +#Recommends: python-acme-doc +Summary: %{summary} +%{?python_provide:%python_provide python3-acme} + +%description -n python3-acme +Python 3 library for use of the Automatic Certificate Management Environment +protocol as defined by the IETF. It's used by the Let's Encrypt project. +%endif + +%if 0%{?fedora} +%package doc +Provides: bundled(jquery) +Provides: bundled(underscore) +Provides: bundled(inconsolata-fonts) +Provides: bundled(lato-fonts) +Provides: bundled(robotoslab-fonts) +Requires: fontawesome-fonts fontawesome-fonts-web +Summary: Documentation for python-acme libraries + +%description doc +Documentation for the ACME python libraries +%endif + +%prep +%autosetup -p1 -n %{srcname}-%{version} + + +%build +%py2_build +%if %{with python3} +%py3_build +%endif + +%install +%py2_install +mv %{buildroot}%{_bindir}/jws{,-2} +%if %{with python3} +%py3_install +mv %{buildroot}%{_bindir}/jws{,-3} +%endif + +# Doc generation is currently broken on EL7, see bz#1492884 +%if 0%{?fedora} +# man page is pretty useless but api pages are decent +# Issue opened upstream for improving man page +# Need to cd as parent makefile tries to build libraries +( cd docs && make html ) +# Clean up stuff we don't need for docs +rm -rf docs/_build/html/{.buildinfo,man,_sources} +# Unbundle fonts already on system +# Lato ttf is in texlive but that adds a lot of dependencies (30+MB) for just a font in documentation +# and lato is not in it's own -fonts package, only texlive +rm -f docs/_build/html/_static/fonts/fontawesome* +ln -sf /usr/share/fonts/fontawesome/fontawesome-webfont.eot docs/_build/html/_static/fonts/fontawesome-webfont.eot +ln -sf /usr/share/fonts/fontawesome/fontawesome-webfont.svg docs/_build/html/_static/fonts/fontawesome-webfont.svg +ln -sf /usr/share/fonts/fontawesome/fontawesome-webfont.ttf docs/_build/html/_static/fonts/fontawesome-webfont.ttf +ln -sf /usr/share/fonts/fontawesome/fontawesome-webfont.woff docs/_build/html/_static/fonts/fontawesome-webfont.woff +%endif +# upstream state that certbot isn't ready for python3 yet so symlink the -2 version for now +ln -s %{_bindir}/jws-2 %{buildroot}%{_bindir}/jws + +%check +%{__python2} setup.py test +%if %{with python3} +%{__python3} setup.py test +%endif +# Make sure the scripts use the expected python versions +grep -q %{__python2} %{buildroot}%{_bindir}/jws-2 +%if %{with python3} +grep -q %{__python3} %{buildroot}%{_bindir}/jws-3 +%endif + +%files -n python2-acme +%license LICENSE.txt +%{python2_sitelib}/%{srcname} +%{python2_sitelib}/%{srcname}-%{version}*.egg-info +%{_bindir}/jws +%{_bindir}/jws-2 +%if 0%{?rhel} +%doc README.rst +%endif + +%if %{with python3} +%files -n python3-acme +%license LICENSE.txt +%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}-%{version}*.egg-info +%{_bindir}/jws-3 +%if 0%{?rhel} +%doc README.rst +%endif +%endif + +%if 0%{?fedora} +%files doc +%license LICENSE.txt +%doc README.rst +%doc docs/_build/html +%endif + +%changelog +* Sun Jan 21 2018 Daniel Steiner - 0.21.0-1 +- Initial build for Fedora 27 +