summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Pentchev <roam@debian.org>2022-09-05 11:50:56 +0300
committerPeter Pentchev <roam@debian.org>2022-09-05 15:12:52 +0300
commit0fe940ac169400900baf49ecde05403d5ce9cd20 (patch)
tree66f61ccc84c35c57d453d5e5447d7df7112cf7f8
parent71b14ca55d62fcaeaa99073d8c7b4e9aa3f9164c (diff)
Update the Debian packaging for createrepo-c-0.17.3
The Python module now uses scikit-build for CMake integration, so adapt our packaging to it and tweak the upstream CMake definitions a bit.
-rw-r--r--debian/changelog4
-rw-r--r--debian/control2
-rw-r--r--debian/patches/python-platlib-debian.patch16
-rw-r--r--debian/patches/python-skbuild-path.patch53
-rw-r--r--debian/patches/series2
-rwxr-xr-xdebian/rules2
6 files changed, 77 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index a1a3149..204877c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-createrepo-c (0.17.2-1) UNRELEASED; urgency=medium
+createrepo-c (0.17.3-1) UNRELEASED; urgency=medium
* Declare compliance with Debian Policy 4.6.0 with no changes.
* Use debhelper compat 14 for the CMake fixes and add LD_LIBRARY_PATH
@@ -8,6 +8,8 @@ createrepo-c (0.17.2-1) UNRELEASED; urgency=medium
- uses Python's unittest module instead of nose to run the tests, so
drop the nosetests3 patch
- refresh the python-path patch
+ - add python3-setuptools and python3-skbuild as build-time dependencies
+ - add the python-skbuild-path and python-platlib-debian patches
-- Peter Pentchev <roam@debian.org> Sun, 26 Dec 2021 22:47:40 +0200
diff --git a/debian/control b/debian/control
index 6f5cc4e..33b4be1 100644
--- a/debian/control
+++ b/debian/control
@@ -21,6 +21,8 @@ Build-Depends:
libxml2-dev,
libzck-dev,
python3-dev,
+ python3-setuptools,
+ python3-skbuild,
rpm <!nocheck>,
zchunk <!nocheck>,
zlib1g-dev
diff --git a/debian/patches/python-platlib-debian.patch b/debian/patches/python-platlib-debian.patch
new file mode 100644
index 0000000..d427efc
--- /dev/null
+++ b/debian/patches/python-platlib-debian.patch
@@ -0,0 +1,16 @@
+Description: Use the Debian directory layout for Python modules
+Forwarded: not-needed
+Author: Peter Pentchev <roam@ringlet.net>
+Last-Update: 2022-09-05
+
+--- a/src/python/CMakeLists.txt
++++ b/src/python/CMakeLists.txt
+@@ -15,7 +15,7 @@
+ FIND_PACKAGE(PythonInterp 3 REQUIRED)
+ FIND_PACKAGE(PythonLibs 3 REQUIRED)
+
+-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
++EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib', scheme='deb_system'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
+
+ MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
diff --git a/debian/patches/python-skbuild-path.patch b/debian/patches/python-skbuild-path.patch
new file mode 100644
index 0000000..886e3ca
--- /dev/null
+++ b/debian/patches/python-skbuild-path.patch
@@ -0,0 +1,53 @@
+Description: Make the Python module build with scikit-build
+Forwarded: no
+Author: Peter Pentchev <roam@ringlet.net>
+Last-Update: 2022-09-05
+
+--- a/src/python/CMakeLists.txt
++++ b/src/python/CMakeLists.txt
+@@ -10,10 +10,11 @@
+ if (NOT SKBUILD)
+ PYTHON_UNSET()
+ SET(Python_ADDITIONAL_VERSIONS 3.0 CACHE INTERNAL "")
+- FIND_PACKAGE(PythonInterp 3 REQUIRED)
+- FIND_PACKAGE(PythonLibs 3 REQUIRED)
+ endif (NOT SKBUILD)
+
++FIND_PACKAGE(PythonInterp 3 REQUIRED)
++FIND_PACKAGE(PythonLibs 3 REQUIRED)
++
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
+
+@@ -58,23 +59,19 @@
+ )
+
+ IF (SKBUILD)
++ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import importlib.resources; print(importlib.resources.path('skbuild', 'resources') / 'cmake', end='')" OUTPUT_VARIABLE PYTHON_SKLIB_CMAKE_DIR)
++ MESSAGE(STATUS "Python skbuild CMake dir is ${PYTHON_SKLIB_CMAKE_DIR}")
++ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PYTHON_SKLIB_CMAKE_DIR}/")
+ find_package(PythonExtensions REQUIRED)
+ python_extension_module(_createrepo_c)
+ ELSE ()
+ TARGET_LINK_LIBRARIES(_createrepo_c ${PYTHON_LIBRARY})
+ ENDIF ()
+
+-IF (NOT SKBUILD)
+- FILE(COPY createrepo_c/__init__.py DESTINATION createrepo_c)
+-ENDIF()
++FILE(COPY createrepo_c/__init__.py DESTINATION createrepo_c)
+
+-IF (SKBUILD)
+- INSTALL(FILES createrepo_c/__init__.py DESTINATION src/python/createrepo_c)
+- INSTALL(TARGETS _createrepo_c LIBRARY DESTINATION src/python/createrepo_c)
+-ELSE ()
+- INSTALL(FILES createrepo_c/__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/createrepo_c)
+- INSTALL(TARGETS _createrepo_c LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/createrepo_c)
++INSTALL(FILES createrepo_c/__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/createrepo_c)
++INSTALL(TARGETS _createrepo_c LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/createrepo_c)
+
+- # Version has to be passed as last argument.
+- INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/setup_for_python_metadata.py install_egg_info --install-dir \$ENV{DESTDIR}/${PYTHON_INSTALL_DIR} ${VERSION})")
+-ENDIF ()
++# Version has to be passed as last argument.
++INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/setup_for_python_metadata.py install_egg_info --install-dir \$ENV{DESTDIR}/${PYTHON_INSTALL_DIR} ${VERSION})")
diff --git a/debian/patches/series b/debian/patches/series
index 1f6189a..f6a6ffb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
python-path.patch
+python-skbuild-path.patch
+python-platlib-debian.patch
diff --git a/debian/rules b/debian/rules
index 4192d5f..0a5dd4b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,7 +11,7 @@ MARCH:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
dh "$@" --buildsystem cmake
override_dh_auto_configure:
- dh_auto_configure -- -DENABLE_DRPM=ON
+ dh_auto_configure -- -DENABLE_DRPM=ON -DENABLE_PYTHON=ON -DSKBUILD=ON
execute_after_dh_auto_test:
env PYTHONPATH='obj-${MARCH}/src/python' PATH="${CURDIR}/obj-${MARCH}/src:$$PATH" LD_LIBRARY_PATH='${CURDIR}/obj-${MARCH}/src' python3 -B '$D/tests/repotest.py' --source '$D/tests/pkg/foo-0.1.0' --spec '$D/tests/pkg/foo.spec'