From e4c0623005014d87c85b97b900d6cbb3d32a4009354ce673ab5e3d65b8a9c3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 1 Feb 2024 14:07:57 +0000 Subject: [PATCH 1/4] Use cmake for compiling and installing the python modules OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=655 --- cmake_python_version.diff | 15 +++++++++ python-rpm.changes | 4 +-- python-rpm.spec | 23 ++++++-------- python_setup.diff | 64 --------------------------------------- rpm.spec | 5 +-- 5 files changed, 29 insertions(+), 82 deletions(-) create mode 100644 cmake_python_version.diff delete mode 100644 python_setup.diff diff --git a/cmake_python_version.diff b/cmake_python_version.diff new file mode 100644 index 0000000..70177d3 --- /dev/null +++ b/cmake_python_version.diff @@ -0,0 +1,15 @@ +--- CMakeLists.txt.orig 2024-02-01 13:24:18.665660569 +0000 ++++ CMakeLists.txt 2024-02-01 13:25:07.917586376 +0000 +@@ -238,7 +238,11 @@ endif() + list(APPEND db_backends dummy) + + if (ENABLE_PYTHON) +- find_package(Python3 3.2 COMPONENTS Interpreter Development REQUIRED) ++ if (WITH_PYTHON_VERSION) ++ find_package(Python3 ${WITH_PYTHON_VERSION} EXACT COMPONENTS Interpreter Development REQUIRED) ++ else() ++ find_package(Python3 3.2 COMPONENTS Interpreter Development REQUIRED) ++ endif() + endif() + + if (WITH_CAP) diff --git a/python-rpm.changes b/python-rpm.changes index f8b3fb2..1dd8a77 100644 --- a/python-rpm.changes +++ b/python-rpm.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- -Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller +Thu Feb 1 15:07:34 CET 2024 - mls@suse.de -- buildrequire setuptools +- Use cmake for compiling and installing the python modules ------------------------------------------------------------------- Mon Oct 30 14:13:37 UTC 2023 - Matej Cepl diff --git a/python-rpm.spec b/python-rpm.spec index bdd3c01..91ef653 100644 --- a/python-rpm.spec +++ b/python-rpm.spec @@ -28,9 +28,6 @@ Group: Development/Libraries/Python URL: https://rpm.org/ #Git-Clone: https://github.com/rpm-software-management/rpm BuildRequires: %{python_module devel} -BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module wheel} BuildRequires: cmake BuildRequires: fdupes BuildRequires: file-devel @@ -70,18 +67,16 @@ that will manipulate RPM packages and databases. %prep %{expand:%(sed -n -e '/^%%prep/,/^%%install/p' <%{_sourcedir}/rpm.spec | sed -e '1d' -e '$d')} -# The build stage is already declared and pulled in from rpm.spec -cd .. -cp _build/python/setup.py python -pushd python -%pyproject_wheel -popd - %install -pushd python -%pyproject_install -popd -%python_expand %fdupes %{buildroot}%{$python_sitearch} +cd _build +%{python_expand # +cmake .. -U\*Python3\* -DWITH_PYTHON_VERSION=%{$python_version} +make DESTDIR=%{buildroot} -C python clean +make DESTDIR=%{buildroot} -C python install +} + +%python_compileall +rm -rf %{buildroot}/%{_defaultdocdir}/%{NAME} %files %{python_files} %{python_sitearch}/rpm diff --git a/python_setup.diff b/python_setup.diff deleted file mode 100644 index 8f115fd..0000000 --- a/python_setup.diff +++ /dev/null @@ -1,64 +0,0 @@ ---- python/CMakeLists.txt.orig 2023-10-11 14:55:22.453584792 +0000 -+++ python/CMakeLists.txt 2023-10-11 14:56:41.989429746 +0000 -@@ -28,5 +28,6 @@ install(DIRECTORY examples TYPE DOC) - - set(egginfo ${PROJECT_NAME}-${PROJECT_VERSION}-py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.egg-info) - configure_file(rpm.egg-info.in ${egginfo} @ONLY) -+configure_file(setup.py.in setup.py @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${egginfo} - DESTINATION ${Python3_SITEARCH}) ---- python/setup.py.in.orig 2023-10-11 14:55:17.769593923 +0000 -+++ python/setup.py.in 2023-10-11 14:58:39.401200867 +0000 -@@ -0,0 +1,52 @@ -+#!/usr/bin/env python -+ -+from distutils.core import setup, Extension -+import subprocess -+import os -+ -+def pkgconfig(what): -+ out = [] -+ cmd = 'pkg-config %s %s' % (what, '@PROJECT_NAME@') -+ pcout = subprocess.check_output(cmd.split()).decode() -+ for token in pcout.split(): -+ out.append(token[2:]) -+ return out -+ -+cflags = ['-std=c99', '-Wno-strict-aliasing'] -+additional_link_args = [] -+ -+# See if we're building in-tree -+if True: -+ cflags.append('-I../include') -+ additional_link_args.extend(['-Wl,-L../_build/rpmio', -+ '-Wl,-L../_build/lib', -+ '-Wl,-L../_build/build', -+ '-Wl,-L../_build/sign']) -+ os.environ['PKG_CONFIG_PATH'] = '../_build' -+ -+rpmmod = Extension('rpm._rpm', -+ sources = ['header-py.c', 'rpmds-py.c', 'rpmfd-py.c', -+ 'rpmii-py.c', 'rpmkeyring-py.c', -+ 'rpmmacro-py.c', 'rpmmi-py.c', 'rpmps-py.c', -+ 'rpmstrpool-py.c', 'rpmfiles-py.c', -+ 'rpmarchive-py.c', 'rpmtd-py.c', -+ 'rpmte-py.c', 'rpmts-py.c', 'rpmver-py.c', -+ 'spec-py.c', -+ 'rpmmodule.c'], -+ include_dirs = pkgconfig('--cflags'), -+ library_dirs = pkgconfig('--libs-only-L'), -+ libraries = pkgconfig('--libs-only-l') + ['rpmbuild', 'rpmsign'], -+ extra_compile_args = cflags, -+ extra_link_args = additional_link_args -+ ) -+ -+setup(name='@PROJECT_NAME@', -+ version='@PROJECT_VERSION@', -+ description='Python bindings for rpm', -+ maintainer_email='rpm-maint@lists.rpm.org', -+ url='@PROJECT_HOMEPAGE_URL@', -+ license='GNU General Public License v2', -+ packages=['rpm'], -+ ext_modules=[rpmmod] -+ ) -+ diff --git a/rpm.spec b/rpm.spec index f135fe7..d09115a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -111,8 +111,8 @@ Patch133: zstdpool.diff Patch134: zstdthreaded.diff Patch135: selinux_transactional_update.patch Patch136: rpmsort_reverse.diff -Patch137: python_setup.diff Patch138: canongnu.diff +Patch139: cmake_python_version.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -225,7 +225,8 @@ rm -rf sqlite %patch -P 100 -P 102 -P 103 %patch -P 117 %patch -P 122 -P 123 -%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 137 -P 138 +%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 138 +%patch -P 139 %ifarch aarch64 ppc64le riscv64 %patch6464 From 5a1fb7bcf341c96b19e35a2fad0eab16a52e3c9ef884d7c9e7ae17c10018da74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 1 Feb 2024 14:17:31 +0000 Subject: [PATCH 2/4] up OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=656 --- python-rpm.changes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python-rpm.changes b/python-rpm.changes index 1dd8a77..a50a9ab 100644 --- a/python-rpm.changes +++ b/python-rpm.changes @@ -3,6 +3,11 @@ Thu Feb 1 15:07:34 CET 2024 - mls@suse.de - Use cmake for compiling and installing the python modules +------------------------------------------------------------------- +Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller + +- buildrequire setuptools + ------------------------------------------------------------------- Mon Oct 30 14:13:37 UTC 2023 - Matej Cepl From b24bf9cf55525388af8746c77e11de02b2605d20e6737a29faac4574300e48d5 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 1 Feb 2024 14:24:02 +0000 Subject: [PATCH 3/4] OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=657 --- python-rpm.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-rpm.changes b/python-rpm.changes index a50a9ab..7b9513b 100644 --- a/python-rpm.changes +++ b/python-rpm.changes @@ -4,7 +4,7 @@ Thu Feb 1 15:07:34 CET 2024 - mls@suse.de - Use cmake for compiling and installing the python modules ------------------------------------------------------------------- -Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller +Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller - buildrequire setuptools From 968f2484f36a0d9b7d454b4a8e2ef411c248c0c74c59e3eede48a1b5b7a1903c Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 5 Feb 2024 08:35:39 +0000 Subject: [PATCH 4/4] Accepting request 1143671 from home:bnavigator:branches:Base:System:2 - Use cmake for compiling and installing the python modules * Drop python_setup.diff * Add cmake_python_version.diff - buildrequire setuptools - Modernize python-rpm.spec to stop using deprecated macros (%python_build and %python_install). - update to rpm-4.19.1 - add _multibuild for multiple .spec-files - update to rpm-4.18.0 ------------------------------------------------------------------ - update to rpm-4.17.1 - update to rpm-4.17.0 - update to rpm-4.16.1.3 - update to rpm-4.16.0 - update to rpm-4.15.1 - update to rpm-4.15.0 - Fix python-module compatibility with older distros - remove rpmlint-Factory buildignore - Switch really to singlespec thus allowing us to build without python2-devel present in the distribution - update to rpm-4.14.1 - Update RPM groups - Add a comment to note that prep and build stages come from rpm.spec - Properly quote the conditional for Obsoletes+Provides - Unify rpm-python and python3-rpm into singlespec - Switch the build to use setuptools-based build, so that the Python module is properly built with all its metadata - adapt to python-3.3, which no longer looks at XXXmodule.so - update to rpm-4.11.1 - Update to 4.10.2 - modified capsule api diff to match rpm upstream - Fix usage of deprecated AsVoidPtr Python/C API, replaced by Capsule API - Spec file cleanup: * Don't rm -rf %{buildroot} * Removed %clean section * Removed authors from description - add libtool as explicit buildrequire - drop standard python directories from filelist [bnc#229189] - adapt second spec file to changes done to rpm.spec - adapt buildrequires - adapt buildrequires - added libelf-devel to BuildRequires to fix build - update to 4.4.2.3 to get rid of >50 patches - add libselinux-devel to BuildRequires - fix build against python 2.6 - fix buildrequires - fix unicode queries - add ncurses-devel and zlib-devel BuildRequires. - use rpm.spec for building instead of duplication everything - delete superfluous .a and .la files [#202604] - create .pyc and .pyo files [#205711] - Make sure config.rpath is present. - Fix for python2.5. - do not package beecrypt python bindings as libbeecrypt is not packaged either - fix literal %{version} in Requires tag - fix build with python 2.5 by overriding autodetection - split from rpm package - Need to mention the changed patches for the python-setuptools to cmake migration: * Drop python_setup.diff * Add cmake_python_version.diff OBS-URL: https://build.opensuse.org/request/show/1143671 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=659 --- python-rpm.changes | 2 ++ rpm.changes | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/python-rpm.changes b/python-rpm.changes index 7b9513b..808fb53 100644 --- a/python-rpm.changes +++ b/python-rpm.changes @@ -2,6 +2,8 @@ Thu Feb 1 15:07:34 CET 2024 - mls@suse.de - Use cmake for compiling and installing the python modules + * Drop python_setup.diff + * Add cmake_python_version.diff ------------------------------------------------------------------- Thu Feb 1 11:59:47 UTC 2024 - Dirk Müller diff --git a/rpm.changes b/rpm.changes index 83a0fa0..399deaf 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Feb 2 15:27:57 UTC 2024 - Ben Greiner + +- Need to mention the changed patches for the python-setuptools to + cmake migration: + * Drop python_setup.diff + * Add cmake_python_version.diff + ------------------------------------------------------------------- Wed Dec 13 17:39:13 UTC 2023 - Dirk Müller