From e5b29be54270417e21712c1c4ed7fb6e1e3d0a2f Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 4 Jul 2016 01:30:02 +0200 Subject: [PATCH 1/7] Provide python2- and python3- subpackages (rhbz#1313786). - Move python examples to -doc subpackage. --- botan-1.10.13-python-init.patch | 9 +++ botan-boost_python.patch | 20 ++++++ botan.spec | 110 ++++++++++++++++++++++++++------ 3 files changed, 118 insertions(+), 21 deletions(-) create mode 100644 botan-1.10.13-python-init.patch create mode 100644 botan-boost_python.patch diff --git a/botan-1.10.13-python-init.patch b/botan-1.10.13-python-init.patch new file mode 100644 index 0000000..040a9a7 --- /dev/null +++ b/botan-1.10.13-python-init.patch @@ -0,0 +1,9 @@ +diff -up Botan-1.10.13/src/wrap/python/__init__.py.orig Botan-1.10.13/src/wrap/python/__init__.py +--- Botan-1.10.13/src/wrap/python/__init__.py.orig 2016-04-28 15:27:08.000000000 +0200 ++++ Botan-1.10.13/src/wrap/python/__init__.py 2016-06-30 18:02:11.724997966 +0200 +@@ -1,4 +1,4 @@ +-from _botan import * ++from botan._botan import * + + # Initialize the library when the module is imported + init = LibraryInitializer() diff --git a/botan-boost_python.patch b/botan-boost_python.patch new file mode 100644 index 0000000..ccc016b --- /dev/null +++ b/botan-boost_python.patch @@ -0,0 +1,20 @@ +diff -up Botan-1.10.13/src/build-data/makefile/python.in.orig Botan-1.10.13/src/build-data/makefile/python.in +--- Botan-1.10.13/src/build-data/makefile/python.in.orig 2016-04-28 15:27:08.000000000 +0200 ++++ Botan-1.10.13/src/build-data/makefile/python.in 2016-06-30 16:12:04.001859858 +0200 +@@ -15,13 +15,15 @@ BOTAN_PYTHON_MODDIR = %{python_obj_dir} + + PYTHON_OBJS = %{python_objs} + ++BOOST_PYTHON = boost_python ++ + all: $(BOTAN_PYTHON_MODDIR)/_botan.so + + %{python_build_cmds} + + $(BOTAN_PYTHON_MODDIR)/_botan.so: $(PYTHON_OBJS) + cp %{python_dir}/*.py $(BOTAN_PYTHON_MODDIR) +- $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(SERIES) -lboost_python -o $@ ++ $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(SERIES) -l$(BOOST_PYTHON) -o $@ + + clean: + rm -rf $(BOTAN_PYTHON_MODDIR)/* diff --git a/botan.spec b/botan.spec index 57a0108..8e4eea9 100644 --- a/botan.spec +++ b/botan.spec @@ -1,8 +1,12 @@ %global major_version 1.10 +%if 0%{?fedora} +%global with_python3 1 +%endif + Name: botan Version: %{major_version}.13 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -16,19 +20,31 @@ Patch0: botan-aarch64.patch Patch1: botan-1.10-add-ppc64le.patch # Enable only cleared ECC algorithms Patch2: botan-1.10.5-ecc-fix.patch +# Make boost_python selectable +Patch3: botan-boost_python.patch +# Fix wrong path +Patch4: botan-1.10.13-python-init.patch BuildRequires: gcc-c++ -BuildRequires: python -BuildRequires: python-sphinx -BuildRequires: python-devel +BuildRequires: python2 +BuildRequires: python2-devel BuildRequires: boost-python-devel +%if 0%{?with_python3} +BuildRequires: python3 +BuildRequires: python3-devel +BuildRequires: boost-python3-devel +%endif # with_python3 +BuildRequires: python-sphinx BuildRequires: bzip2-devel BuildRequires: zlib-devel BuildRequires: openssl-devel -# do not check .so files in the python_sitelib directory -%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$ +# do not check .so files in the python_sitelib directories +%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so)$ +%if 0%{?with_python3} +%global __provides_exclude_from ^(%{python3_sitearch}/.*\\.so)$ +%endif # with_python3 %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} @@ -66,24 +82,45 @@ BuildArch: noarch This package contains HTML documentation for %{name}. -%package python -Summary: Python bindings for %{name} +%package -n python2-%{name} +Summary: Python2 bindings for %{name} Group: System Environment/Libraries +%{?python_provide:%python_provide python2-%{name}} +# the python2 package was named botan-python up to 1.10.13-1 +Provides: %{name}-python = %{version}-%{release} +Obsoletes: %{name}-python < 1.10.13-2 -%description python +%description -n python2-%{name} %{summary} -This package contains the Python binding for %{name}. +This package contains the Python2 binding for %{name}. Note: The Python binding should be considered alpha software, and the interfaces may change in the future. +%if 0%{?with_python3} +%package -n python3-%{name} +Summary: Python3 bindings for %{name} +Group: System Environment/Libraries +%{?python_provide:%python_provide python2-%{name}} + +%description -n python3-%{name} +%{summary} + +This package contains the Python3 binding for %{name}. + +Note: The Python binding should be considered alpha software, and the +interfaces may change in the future. +%endif # with_python3 + %prep %setup -q -n Botan-%{version} %patch0 -p1 %patch1 -p1 %patch2 -p1 -b .eccfix +%patch3 -p1 +%patch4 -p1 # These tests will fail. rm -rf checks/ec_tests.cpp @@ -104,14 +141,30 @@ rm -rf checks/ec_tests.cpp --enable-modules=%{enable_modules} \ --disable-modules=%{disable_modules} \ --with-boost-python \ - --with-python-version=%{python_version} \ + --with-python-version=dummy.dummy \ --with-sphinx +%if 0%{?with_python3} +cp -a build/python{,3} +%endif # with_python3 + # (ab)using CXX as an easy way to inject our CXXFLAGS make CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} -make -f Makefile.python \ - CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} +make -f Makefile.python \ + CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ + PYTHON_INC="$(python2-config --includes)" \ + PYTHON_ROOT=. + +%if 0%{?with_python3} +mv build/python{,2} ; mv build/python{3,} +make -f Makefile.python \ + CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ + PYTHON_INC="$(python3-config --includes)" \ + PYTHON_ROOT=. \ + BOOST_PYTHON=boost_python3 +mv build/python{,3} ; mv build/python{2,} +%endif # with_python3 %install make install \ @@ -121,12 +174,19 @@ make install \ INSTALL_CMD_DATA="install -p -m 644" make -f Makefile.python install \ - PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python_sitearch} + PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python2_sitearch} + +%if 0%{?with_python3} +mv build/python{,2} ; mv build/python{3,} +make -f Makefile.python install \ + PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python3_sitearch} +mv build/python{,3} ; mv build/python{2,} +%endif # with_python3 # fixups find doc/examples -type f -exec chmod -x {} \; -mv doc/examples/python doc/python-examples -cp -a doc/{examples,python-examples,license.txt} \ +mv doc/examples/python doc/python2-examples +cp -a doc/{examples,python2-examples,license.txt} \ %{buildroot}%{_pkgdocdir} cp -a %{SOURCE1} %{buildroot}%{_pkgdocdir} rm -r %{buildroot}%{_pkgdocdir}/manual/{.doctrees,.buildinfo} @@ -173,13 +233,17 @@ rm -r %{buildroot}%{_pkgdocdir}/manual/{.doctrees,.buildinfo} %else %{_pkgdocdir}/license.txt %endif # licensedir +%{_pkgdocdir}/python2-examples -%files python -%{_pkgdocdir}/python-examples -%exclude %{_pkgdocdir}/python-examples/*.pyc -%exclude %{_pkgdocdir}/python-examples/*.pyo -%{python_sitearch}/%{name} +%files -n python2-%{name} +%{python2_sitearch}/%{name} + + +%if 0%{?with_python3} +%files -n python3-%{name} +%{python3_sitearch}/%{name} +%endif # with_python3 %check @@ -193,6 +257,10 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog +* Sun Jul 3 2016 Thomas Moschny - 1.10.13-2 +- Provide python2- and python3- subpackages (rhbz#1313786). +- Move python examples to -doc subpackage. + * Fri Apr 29 2016 Thomas Moschny - 1.10.13-1 - Update to 1.10.13. From 5b87a3fc47dbeb932dc56183a47776fc018d1bb0 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 4 Jul 2016 02:05:33 +0200 Subject: [PATCH 2/7] Fix typo. --- botan.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/botan.spec b/botan.spec index 8e4eea9..fb1667c 100644 --- a/botan.spec +++ b/botan.spec @@ -6,7 +6,7 @@ Name: botan Version: %{major_version}.13 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -102,7 +102,7 @@ interfaces may change in the future. %package -n python3-%{name} Summary: Python3 bindings for %{name} Group: System Environment/Libraries -%{?python_provide:%python_provide python2-%{name}} +%{?python_provide:%python_provide python3-%{name}} %description -n python3-%{name} %{summary} @@ -257,6 +257,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog +* Sun Jul 3 2016 Thomas Moschny - 1.10.13-3 +- Fix typo. + * Sun Jul 3 2016 Thomas Moschny - 1.10.13-2 - Provide python2- and python3- subpackages (rhbz#1313786). - Move python examples to -doc subpackage. From 84dde5b3f2f6b4d1c93498108d66e6b3e2aa6df2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 19 Jul 2016 06:40:59 +0000 Subject: [PATCH 3/7] - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages --- botan.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/botan.spec b/botan.spec index fb1667c..f7f15c8 100644 --- a/botan.spec +++ b/botan.spec @@ -6,7 +6,7 @@ Name: botan Version: %{major_version}.13 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -257,6 +257,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog +* Tue Jul 19 2016 Fedora Release Engineering - 1.10.13-4 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + * Sun Jul 3 2016 Thomas Moschny - 1.10.13-3 - Fix typo. From 50c5d7062df849dae70892b7151f4a8e0341a9e6 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 3 Dec 2016 07:21:25 +0100 Subject: [PATCH 4/7] Update to 1.10.14. --- .gitignore | 4 +--- botan.spec | 7 +++++-- repack.sh | 2 +- sources | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 01136d1..bd7a36c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/Botan-*.stripped.tbz -/Botan-1.10.12.stripped.tar.gz -/Botan-1.10.13.stripped.tar.gz +/Botan-*.stripped.tar.gz diff --git a/botan.spec b/botan.spec index f7f15c8..599222a 100644 --- a/botan.spec +++ b/botan.spec @@ -5,8 +5,8 @@ %endif Name: botan -Version: %{major_version}.13 -Release: 4%{?dist} +Version: %{major_version}.14 +Release: 1%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -257,6 +257,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog +* Sat Dec 3 2016 Thomas Moschny - 1.10.14-1 +- Update to 1.10.14. + * Tue Jul 19 2016 Fedora Release Engineering - 1.10.13-4 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages diff --git a/repack.sh b/repack.sh index a55199a..af5cd56 100755 --- a/repack.sh +++ b/repack.sh @@ -1,6 +1,6 @@ #! /bin/bash -name=Botan-1.10.13 +name=Botan-1.10.14 src=${name}.tgz dst=${name}.stripped.tar.gz diff --git a/sources b/sources index 34e6824..bbe1e99 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d7cc44ba99c8b989913a11a5a8acf927 Botan-1.10.13.stripped.tar.gz +55fb6734ce039c79ddac939af9a176dc Botan-1.10.14.stripped.tar.gz From a596d4e935c5930b66d5d60ed35fbf9865112b08 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Fri, 9 Dec 2016 21:10:03 +0100 Subject: [PATCH 5/7] Update to 1.10.14. - Depend on OpenSSL 1.0 compat package for F26+. --- botan.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/botan.spec b/botan.spec index 599222a..aabdf68 100644 --- a/botan.spec +++ b/botan.spec @@ -38,7 +38,11 @@ BuildRequires: boost-python3-devel BuildRequires: python-sphinx BuildRequires: bzip2-devel BuildRequires: zlib-devel +%if 0%{?fedora} >=26 +BuildRequires: compat-openssl10-devel +%else BuildRequires: openssl-devel +%endif # do not check .so files in the python_sitelib directories %global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so)$ @@ -257,8 +261,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog -* Sat Dec 3 2016 Thomas Moschny - 1.10.14-1 +* Fri Dec 9 2016 Thomas Moschny - 1.10.14-1 - Update to 1.10.14. +- Depend on OpenSSL 1.0 compat package for F26+. * Tue Jul 19 2016 Fedora Release Engineering - 1.10.13-4 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages From 8f890a6325c0fde5ece0d9f73bd26aa1f8075598 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 10 Dec 2016 09:34:39 +0100 Subject: [PATCH 6/7] Fix requirement of the -devel package. --- botan.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/botan.spec b/botan.spec index aabdf68..32ec998 100644 --- a/botan.spec +++ b/botan.spec @@ -6,7 +6,7 @@ Name: botan Version: %{major_version}.14 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -68,7 +68,11 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: bzip2-devel Requires: zlib-devel +%if 0%{?fedora} >=26 +Requires: compat-openssl10-devel +%else Requires: openssl-devel +%endif %description devel The %{name}-devel package contains libraries and header files for @@ -261,7 +265,7 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog -* Fri Dec 9 2016 Thomas Moschny - 1.10.14-1 +* Fri Dec 9 2016 Thomas Moschny - 1.10.14-2 - Update to 1.10.14. - Depend on OpenSSL 1.0 compat package for F26+. From bf8adb66c8ac02ce179d69531c62a9386eaa70da Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 10 Dec 2016 18:33:34 +0100 Subject: [PATCH 7/7] Add -std=c++11 to the compilerflags (needed on EPEL7). --- botan.spec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/botan.spec b/botan.spec index 32ec998..f4af8fe 100644 --- a/botan.spec +++ b/botan.spec @@ -6,7 +6,7 @@ Name: botan Version: %{major_version}.14 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Crypto library written in C++ Group: System Environment/Libraries @@ -157,17 +157,17 @@ cp -a build/python{,3} %endif # with_python3 # (ab)using CXX as an easy way to inject our CXXFLAGS -make CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} +make CXX="g++ -std=c++11 ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} make -f Makefile.python \ - CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ + CXX="g++ -std=c++11 ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ PYTHON_INC="$(python2-config --includes)" \ PYTHON_ROOT=. %if 0%{?with_python3} mv build/python{,2} ; mv build/python{3,} make -f Makefile.python \ - CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ + CXX="g++ -std=c++11 ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \ PYTHON_INC="$(python3-config --includes)" \ PYTHON_ROOT=. \ BOOST_PYTHON=boost_python3 @@ -255,7 +255,7 @@ rm -r %{buildroot}%{_pkgdocdir}/manual/{.doctrees,.buildinfo} %check -make CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} check +make CXX="g++ -std=c++11 ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} check # these checks would fail mv checks/validate.dat{,.orig} @@ -265,6 +265,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate %changelog +* Sat Dec 10 2016 Thomas Moschny - 1.10.14-3 +- Add -std=c++11 to the compilerflags (needed on EPEL7). + * Fri Dec 9 2016 Thomas Moschny - 1.10.14-2 - Update to 1.10.14. - Depend on OpenSSL 1.0 compat package for F26+.