From ff9d783e3e9390ef9e2befba22e81a04527358b0 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Mon, 10 Apr 2023 23:52:47 +0800 Subject: [PATCH] Fix build with latest distutils --- ...on-t-add-extra-libraries-for-linking.patch | 0 0001-fix-stupid-ax_python_devel.patch | 62 +++++++++-------- 0002-setup_py_extra_opts.patch | 12 ++++ 1001-Skip-4-qt-remarks-test-cases.patch | 34 ---------- ...-qt-skip-test-remarks-for-gnupg2-2.4.patch | 58 ++++++++++++++++ gpgme-1.3.2-largefile.patch | 24 +++++++ gpgme.spec | 67 +++++++++++++------ 7 files changed, 172 insertions(+), 85 deletions(-) rename 0002-don-t-add-extra-libraries-for-linking.patch => 0001-don-t-add-extra-libraries-for-linking.patch (100%) create mode 100644 0002-setup_py_extra_opts.patch delete mode 100644 1001-Skip-4-qt-remarks-test-cases.patch create mode 100644 1001-qt-skip-test-remarks-for-gnupg2-2.4.patch create mode 100644 gpgme-1.3.2-largefile.patch diff --git a/0002-don-t-add-extra-libraries-for-linking.patch b/0001-don-t-add-extra-libraries-for-linking.patch similarity index 100% rename from 0002-don-t-add-extra-libraries-for-linking.patch rename to 0001-don-t-add-extra-libraries-for-linking.patch diff --git a/0001-fix-stupid-ax_python_devel.patch b/0001-fix-stupid-ax_python_devel.patch index 49e6a8c..46ad827 100644 --- a/0001-fix-stupid-ax_python_devel.patch +++ b/0001-fix-stupid-ax_python_devel.patch @@ -1,18 +1,32 @@ -From 0fa82bc99c13d4d84a40db622dc654ebddf5e35c Mon Sep 17 00:00:00 2001 -From: liuzhilin -Date: Fri, 11 Mar 2022 08:49:28 -0500 -Subject: [PATCH] fix-stupid-ax_python_devel +From b0eabea4b1232ee7f45d13b8add928d463f37444 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 29 Mar 2017 07:13:35 +0200 +Subject: [PATCH] fix stupid ax_python_devel +References: https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=883a2abd5af5c96be894d5ef7ee6e9a2b8e64307 +Signed-off-by: Igor Gnatenko --- - configure | 16 ++++++++-------- - m4/ax_python_devel.m4 | 2 +- - 2 files changed, 9 insertions(+), 9 deletions(-) + m4/ax_python_devel.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 +index b990d5b3..318b089c 100644 +--- a/m4/ax_python_devel.m4 ++++ b/m4/ax_python_devel.m4 +@@ -137,7 +137,7 @@ variable to configure. See ``configure --help'' for reference. + # + AC_MSG_CHECKING([for the distutils Python package]) + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` +- if test -z "$ac_distutils_result"; then ++ if test $? -eq 0; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) diff --git a/configure b/configure -index 803b354..bf015b9 100755 +index 6200f91..6a3d6f1 100755 --- a/configure +++ b/configure -@@ -19871,7 +19871,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -19880,7 +19868,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -21,7 +35,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -20501,7 +20501,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -20510,7 +20498,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -30,7 +44,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -21131,7 +21131,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -21140,7 +21128,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -39,7 +53,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -21761,7 +21761,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -21770,7 +21758,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -48,7 +62,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -22391,7 +22391,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -22400,7 +22388,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -57,7 +71,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -23021,7 +23021,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -23030,7 +23018,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -66,7 +80,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -23651,7 +23651,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -23660,7 +23648,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -75,7 +89,7 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -@@ -24281,7 +24281,7 @@ variable to configure. See \`\`configure --help'' for reference. +@@ -24290,7 +24278,7 @@ variable to configure. See \`\`configure --help'' for reference. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` @@ -84,19 +98,3 @@ index 803b354..bf015b9 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else -diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 -index 55f0cff..65fb4b6 100644 ---- a/m4/ax_python_devel.m4 -+++ b/m4/ax_python_devel.m4 -@@ -137,7 +137,7 @@ variable to configure. See ``configure --help'' for reference. - # - AC_MSG_CHECKING([for the distutils Python package]) - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` -- if test -z "$ac_distutils_result"; then -+ if test $? -eq 0; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) --- -2.27.0 - diff --git a/0002-setup_py_extra_opts.patch b/0002-setup_py_extra_opts.patch new file mode 100644 index 0000000..dbcd4a7 --- /dev/null +++ b/0002-setup_py_extra_opts.patch @@ -0,0 +1,12 @@ +diff --git a/lang/python/Makefile.in b/lang/python/Makefile.in +index c0fc091..d567ecb 100644 +--- a/lang/python/Makefile.in ++++ b/lang/python/Makefile.in +@@ -802,6 +802,7 @@ install-exec-local: + --build-base="$$(basename "$${PYTHON}")-gpg" \ + install \ + --prefix "$(DESTDIR)$(prefix)" \ ++ $${SETUP_PY_EXTRA_OPTS:-} \ + --verbose ; \ + done + diff --git a/1001-Skip-4-qt-remarks-test-cases.patch b/1001-Skip-4-qt-remarks-test-cases.patch deleted file mode 100644 index d3ed6df..0000000 --- a/1001-Skip-4-qt-remarks-test-cases.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4d3d31f0a65e77f0a509934eb62cf33963646084 Mon Sep 17 00:00:00 2001 -From: Feng Su -Date: Mon, 6 Mar 2023 17:00:11 +0800 -Subject: [PATCH] Skip 4 qt remarks test cases - ---- - lang/qt/tests/t-remarks.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lang/qt/tests/t-remarks.cpp b/lang/qt/tests/t-remarks.cpp -index f9a901a..2b421d5 100644 ---- a/lang/qt/tests/t-remarks.cpp -+++ b/lang/qt/tests/t-remarks.cpp -@@ -102,7 +102,7 @@ public: - - - private Q_SLOTS: -- -+ /* - void testRemarkReplaceSingleUIDExportable() - { - if (!loopbackSupported()) { -@@ -447,7 +447,7 @@ private Q_SLOTS: - QVERIFY(remark); - QCOMPARE(QString::fromUtf8(remark), QStringLiteral("Mallory is nice")); - } -- -+ */ - void initTestCase() - { - QGpgMETest::initTestCase(); --- -2.31.1 - diff --git a/1001-qt-skip-test-remarks-for-gnupg2-2.4.patch b/1001-qt-skip-test-remarks-for-gnupg2-2.4.patch new file mode 100644 index 0000000..5588205 --- /dev/null +++ b/1001-qt-skip-test-remarks-for-gnupg2-2.4.patch @@ -0,0 +1,58 @@ +diff --git a/lang/qt/tests/t-remarks.cpp b/lang/qt/tests/t-remarks.cpp +index f9a901a..4b2f2ab 100644 +--- a/lang/qt/tests/t-remarks.cpp ++++ b/lang/qt/tests/t-remarks.cpp +@@ -47,6 +47,12 @@ + + #include "t-support.h" + ++#define SKIP_ON_2_4() do { \ ++ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.4.0") { \ ++ QSKIP("The test does not work well with gnupg 2.4+."); \ ++ } \ ++} while (false) ++ + using namespace QGpgME; + using namespace GpgME; + +@@ -105,6 +111,7 @@ private Q_SLOTS: + + void testRemarkReplaceSingleUIDExportable() + { ++ SKIP_ON_2_4(); + if (!loopbackSupported()) { + return; + } +@@ -187,6 +194,7 @@ private Q_SLOTS: + + void testMultipleRemarks() + { ++ SKIP_ON_2_4(); + if (!loopbackSupported()) { + return; + } +@@ -269,6 +277,7 @@ private Q_SLOTS: + + void testRemarkReplaceSingleUID() + { ++ SKIP_ON_2_4(); + if (!loopbackSupported()) { + return; + } +@@ -350,6 +359,7 @@ private Q_SLOTS: + + void testRemarkReplaceMultiUID() + { ++ SKIP_ON_2_4(); + if (!loopbackSupported()) { + return; + } +@@ -466,6 +476,8 @@ private: + QTemporaryDir mDir; + }; + ++#undef SKIP_ON_2_4 ++ + QTEST_MAIN(TestRemarks) + + #include "t-remarks.moc" diff --git a/gpgme-1.3.2-largefile.patch b/gpgme-1.3.2-largefile.patch new file mode 100644 index 0000000..bbf88de --- /dev/null +++ b/gpgme-1.3.2-largefile.patch @@ -0,0 +1,24 @@ +diff -up gpgme-1.3.2/src/gpgme-config.in.largefile gpgme-1.3.2/src/gpgme-config.in +--- gpgme-1.3.2/src/gpgme-config.in.largefile 2012-09-26 10:10:37.882744198 +0200 ++++ gpgme-1.3.2/src/gpgme-config.in 2012-09-26 10:16:02.558762827 +0200 +@@ -41,6 +41,10 @@ cflags_pthread="" + cflags_glib="@GLIB_CFLAGS@" + with_glib= + ++if test "0@NEED__FILE_OFFSET_BITS@" -gt "0" ; then ++ cflags_lfs="-D_FILE_OFFSET_BITS=@NEED__FILE_OFFSET_BITS@" ++fi ++ + output="" + + usage() +@@ -105,6 +109,9 @@ while test $# -gt 0; do + exit 0 + ;; + --cflags) ++ if test "x$cflags_lfs" != "x"; then ++ output="$output $cflags_lfs" ++ fi + result= + tmp_c= + tmp_g= diff --git a/gpgme.spec b/gpgme.spec index 6ef5b89..ddb85bc 100644 --- a/gpgme.spec +++ b/gpgme.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %bcond_without check @@ -15,11 +15,19 @@ License: LGPLv2+ and MIT URL: https://gnupg.org/related_software/gpgme/ Source0: https://gnupg.org/ftp/gcrypt/gpgme/gpgme-%{version}.tar.bz2 -Patch1: 0001-fix-stupid-ax_python_devel.patch -Patch2: 0002-don-t-add-extra-libraries-for-linking.patch -# There are four qt remarks test cases that failed to pass, -# considering the environment problem, so skip it -Patch1001: 1001-Skip-4-qt-remarks-test-cases.patch +## downstream patches +# Don't add extra libs/cflags in gpgme-config/cmake equivalent +Patch1001: 0001-don-t-add-extra-libraries-for-linking.patch +# add -D_FILE_OFFSET_BITS... to gpgme-config, upstreamable +Patch1002: gpgme-1.3.2-largefile.patch +# Let's fix stupid AX_PYTHON_DEVEL +Patch1003: 0001-fix-stupid-ax_python_devel.patch +# Allow extra options to be passed to setup.py during installation +Patch1004: 0002-setup_py_extra_opts.patch + +## temporary downstream fixes +# Skip lang/qt/tests/t-remarks on gnupg 2.4+ +Patch3001: 1001-qt-skip-test-remarks-for-gnupg2-2.4.patch BuildRequires: make BuildRequires: gcc @@ -41,9 +49,11 @@ Requires: gnupg2 >= %{gnupg2_min_ver} %description GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG -easier for applications. It provides a high-level crypto API for +easier for applications. It provides a high-level crypto API for encryption, decryption, signing, signature verification and key -management. +management. Currently it uses GnuPG's OpenPGP backend as the default, +but the API isn't restricted to this engine. We have, in fact, already +developed a backend for CMS (S/MIME). %package doc Summary: Doc files for %{name} @@ -58,7 +68,7 @@ Summary: Development headers and libraries for %{name} Requires: %{name} = %{version}-%{release} %description devel -%{summary}. +This package contains the development headers and libraries for %{name}. %package -n %{name}pp Summary: C++ bindings/wrapper for GPGME @@ -67,7 +77,7 @@ Provides: gpgme-pp = %{version}-%{release} Requires: %{name} = %{version}-%{release} %description -n %{name}pp -%{summary}. +This package contains the C++ bindings/wrapper for %{name}. %package -n %{name}pp-devel Summary: Development libraries and header files for %{name}-pp @@ -77,16 +87,16 @@ Requires: %{name}pp = %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} %description -n %{name}pp-devel -%{summary} +This package contains the development libraries and header files for %{name}-pp. %package -n q%{name} Summary: Qt API bindings/wrapper for GPGME -Requires: %{name}pp%{?_isa} = %{version}-%{release} +Requires: %{name}pp = %{version}-%{release} BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Test) %description -n q%{name} -%{summary}. +This package contains the Qt API bindings/wrapper for %{name}. %package -n q%{name}-devel Summary: Development libraries and header files for %{name} @@ -96,7 +106,7 @@ Requires: %{name}pp-devel BuildRequires: cmake %description -n q%{name}-devel -%{summary}. +This package contains the development libraries and header files for %{name}. %package -n python3-gpg Summary: %{name} bindings for Python 3 @@ -106,11 +116,18 @@ Requires: %{name} = %{version}-%{release} Obsoletes: platform-python-gpg < %{version}-%{release} %description -n python3-gpg -%{summary}. +This package contains the %{name} bindings for Python 3. %prep %autosetup -p1 +## HACK ALERT +# The config script already suppresses the -L if it's /usr/lib, so cheat and +# set it to a value which we know will be suppressed. +sed -i -e 's|^libdir=@libdir@$|libdir=@exec_prefix@/lib|g' src/gpgme-config.in + +# The build machinery does not support Python 3.9+ yet +# https://github.com/gpg/gpgme/pull/4 sed -i 's/3.8/%{python3_version}/g' configure %build @@ -123,16 +140,25 @@ export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" %make_build %install +# When using distutils from setuptools 60+, ./setup.py install use +# the .egg format. This forces setuptools to use .egg-info format. +# SETUP_PY_EXTRA_OPTS is introduced by the Patch1004 above. +export SETUPTOOLS_USE_DISTUTILS=local +export SETUP_PY_EXTRA_OPTS="--single-version-externally-managed --root=/" %make_install -rm -vf %{buildroot}%{python2_sitelib}/gpg/install_files.txt -rm -vf %{buildroot}%{python3_sitelib}/gpg/install_files.txt +chrpath -d %{buildroot}%{_bindir}/%{name}-tool +chrpath -d %{buildroot}%{_bindir}/%{name}-json +chrpath -d %{buildroot}%{_libdir}/lib%{name}pp.so* +%if %{with qt} +chrpath -d %{buildroot}%{_libdir}/libq%{name}.so* +%endif %generate_compatibility_deps %if %{with check} %check -make check +%make_build check %endif %files @@ -184,6 +210,9 @@ make check %{abidir}/*%{name}*python*.dump %changelog +* Mon Apr 10 2023 Funda Wang - 1.19.0-2 +- Fix build with latest distutils + * Mon Mar 20 2023 Funda Wang - 1.19.0-1 - New version 1.19.0 @@ -196,7 +225,7 @@ make check * Tue Oct 11 2022 Funda Wang - 1.18.0-1 - New version 1.18.0 -- Add patch from fedora for removal overlinking in gpgme-config +- Add patch from other distro for removal overlinking in gpgme-config * Fri Mar 11 2022 liuzhilin - 1.17.0-1 - Init for Anolis OS 23 -- Gitee