Control: tag -1 + patch

On Mon, 17 Jul 2017 19:07:13 +0200, Felix Geyer wrote:

> Control: reassign -1 libsolv 0.6.28-1
> Control: notforwarded -1
> 
> On Tue, 11 Jul 2017 22:57:08 +0200 Felix Geyer <fge...@debian.org> wrote:

> > Please note however that libsolv doesn't follow the recommended way to find 
> > the Python interpreter
> > + libs:
> > 
> > > If calling both ``find_package(PythonInterp)`` and
> > > ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first 
> > > to> get the currently active Python version by default with a consistent 
> > > version
> > > of PYTHON_LIBRARIES.
> 
> I'm reassigning the bug since it's the caller's responsibility to pass a 
> valid version to
> find_package().
> PYTHONLIBS_VERSION_STRING contains the full version string by design.
> libsolv would have to parse the x.y.z version from the variable.

In pratice it seems to be enough to switch the 2 lines.
That's probably not totally correct, as ${PYTHONLIBS_VERSION_STRING}
then is undefined but both the log output and the resulting packages
look ok.

From the log:

-- Found PythonInterp: /usr/bin/python (found version "2.7.13")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable 
version "2.7.13+", minimum required is "2")
-- Python executable: /usr/bin/python
-- Python installation dir: /usr/lib/python2.7/dist-packages
-- Python include path: /usr/include/python2.7
-- Python3 executable: /usr/bin/python3
-- Python3 installation dir: /usr/lib/python3/dist-packages
-- Python3 include path: /usr/include/python3.5m


With the correcter version from 
https://gitlab.kitware.com/cmake/cmake/merge_requests/1047#note_288680
the log output is:

-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable 
version "2.7.13+", minimum required is "2")
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.13", 
minimum required is "2.7.13")
-- Python executable: /usr/bin/python2.7
-- Python installation dir: /usr/lib/python2.7/dist-packages
-- Python include path: /usr/include/python2.7
-- Python3 executable: /usr/bin/python3
-- Python3 installation dir: /usr/lib/python3/dist-packages
-- Python3 include path: /usr/include/python3.5m

and the packages look fine as well.


I'm attaching a debdiff which includes both patches (and changelog
entries for both); whoever uploads can pick and remove the unused one
:)


Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at/ - Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Hair: Age of Aquarius
diff -Nru libsolv-0.6.28/debian/changelog libsolv-0.6.28/debian/changelog
--- libsolv-0.6.28/debian/changelog	2017-07-06 22:11:26.000000000 +0200
+++ libsolv-0.6.28/debian/changelog	2017-07-22 15:39:46.000000000 +0200
@@ -1,3 +1,19 @@
+libsolv (0.6.28-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix "python2.7/cmake: find_package called with invalid argument
+    "2.7.13+"":
+
+    Add 1008_cmake-python.patch to switch order of invocation of
+    'FIND_PACKAGE (PythonInterp)' and 'FIND_PACKAGE (PythonLibs)'.
+
+    Add 1008_cmake-python-version.patch to sanitize PYTHONLIBS_VERSION_STRING
+    before passing it to 'FIND_PACKAGE (PythonInterp)'.
+
+    (Closes: #867514)
+
+ -- gregor herrmann <gre...@debian.org>  Sat, 22 Jul 2017 15:39:46 +0200
+
 libsolv (0.6.28-1) unstable; urgency=medium
 
   * New upstream release. (Closes: #865033).
diff -Nru libsolv-0.6.28/debian/patches/1008_cmake-python-version.patch libsolv-0.6.28/debian/patches/1008_cmake-python-version.patch
--- libsolv-0.6.28/debian/patches/1008_cmake-python-version.patch	1970-01-01 01:00:00.000000000 +0100
+++ libsolv-0.6.28/debian/patches/1008_cmake-python-version.patch	2017-07-22 15:39:46.000000000 +0200
@@ -0,0 +1,23 @@
+Description: sanitize PYTHONLIBS_VERSION_STRING before passing it to 'FIND_PACKAGE (PythonInterp)'
+Origin: https://gitlab.kitware.com/cmake/cmake/merge_requests/1047#note_288680
+Bug-Debian: https://bugs.debian.org/867514
+Author: Brad King
+Reviewed-by: gregor herrmann <gre...@debian.org>
+Last-Update: 2017-07-22
+
+--- a/bindings/python/CMakeLists.txt
++++ b/bindings/python/CMakeLists.txt
+@@ -6,7 +6,12 @@
+ ENDIF (ENABLE_PYTHON3 AND NOT DEFINED PythonLibs_FIND_VERSION)
+ 
+ FIND_PACKAGE (PythonLibs REQUIRED)
+-FIND_PACKAGE (PythonInterp ${PYTHONLIBS_VERSION_STRING} REQUIRED)
++IF(PYTHONLIBS_VERSION_STRING MATCHES "^([0-9.]+)")
++    SET(python_version "${CMAKE_MATCH_1}")
++ELSE()
++    MESSAGE(FATAL_ERROR "PythonLibs version format unknown '${PYTHONLIBS_VERSION_STRING}'")
++ENDIF()
++FIND_PACKAGE (PythonInterp ${python_version} REQUIRED)
+ 
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ 
diff -Nru libsolv-0.6.28/debian/patches/1008_cmake-python.patch libsolv-0.6.28/debian/patches/1008_cmake-python.patch
--- libsolv-0.6.28/debian/patches/1008_cmake-python.patch	1970-01-01 01:00:00.000000000 +0100
+++ libsolv-0.6.28/debian/patches/1008_cmake-python.patch	2017-07-22 15:39:46.000000000 +0200
@@ -0,0 +1,18 @@
+Description: run 'FIND_PACKAGE (PythonInterp)' before 'FIND_PACKAGE (PythonLibs)'
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/867514
+Author: gregor herrmann <gre...@debian.org>
+Last-Update: 2017-07-22
+
+--- a/bindings/python/CMakeLists.txt
++++ b/bindings/python/CMakeLists.txt
+@@ -5,8 +5,8 @@
+     SET (PythonLibs_FIND_VERSION_MAJOR 2)
+ ENDIF (ENABLE_PYTHON3 AND NOT DEFINED PythonLibs_FIND_VERSION)
+ 
+-FIND_PACKAGE (PythonLibs REQUIRED)
+ FIND_PACKAGE (PythonInterp ${PYTHONLIBS_VERSION_STRING} REQUIRED)
++FIND_PACKAGE (PythonLibs REQUIRED)
+ 
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ 
diff -Nru libsolv-0.6.28/debian/patches/series libsolv-0.6.28/debian/patches/series
--- libsolv-0.6.28/debian/patches/series	2017-01-02 16:37:50.000000000 +0100
+++ libsolv-0.6.28/debian/patches/series	2017-07-22 15:39:46.000000000 +0200
@@ -1,3 +1,5 @@
 1004_cmake-module-path-fix.patch
 1006_various-types.patch
 2001_build-for-SUSE-and-find-rpmdb.patch
+#1008_cmake-python.patch
+1008_cmake-python-version.patch

Attachment: signature.asc
Description: Digital Signature

Reply via email to