All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/python-packaging: add host variant
@ 2022-01-03 22:54 Romain Naour
  2022-01-03 22:54 ` [Buildroot] [PATCH 2/2] package/zfs: fix python3 version check Romain Naour
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2022-01-03 22:54 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/python-packaging/python-packaging.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/python-packaging/python-packaging.mk b/package/python-packaging/python-packaging.mk
index 6b54d2416d..1fd6f26d64 100644
--- a/package/python-packaging/python-packaging.mk
+++ b/package/python-packaging/python-packaging.mk
@@ -12,3 +12,4 @@ PYTHON_PACKAGING_LICENSE = Apache-2.0 or BSD-2-Clause
 PYTHON_PACKAGING_LICENSE_FILES = LICENSE LICENSE.APACHE LICENSE.BSD
 
 $(eval $(python-package))
+$(eval $(host-python-package))
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 2/2] package/zfs: fix python3 version check
  2022-01-03 22:54 [Buildroot] [PATCH 1/2] package/python-packaging: add host variant Romain Naour
@ 2022-01-03 22:54 ` Romain Naour
  2022-01-04 18:31   ` Arnout Vandecappelle
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2022-01-03 22:54 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

Backport a patch to fix the python 3 version check that
broke the build since the python 3.10 version bump.

Add host-python-packaging dependency since the backport
add "from packaging import version" while checking the
python version.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1935414730
https://gitlab.com/buildroot.org/buildroot/-/jobs/1935415049

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 ...law-in-the-Python-3-version-checking.patch | 106 ++++++++++++++++++
 package/zfs/zfs.mk                            |   5 +-
 2 files changed, 109 insertions(+), 2 deletions(-)
 create mode 100644 package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch

diff --git a/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch b/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
new file mode 100644
index 0000000000..70978f9f4d
--- /dev/null
+++ b/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
@@ -0,0 +1,106 @@
+From 4dc82e9d503518a00e54972be7c0cb5f342f985e Mon Sep 17 00:00:00 2001
+From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
+Date: Tue, 8 Jun 2021 20:20:16 -0400
+Subject: [PATCH] Correct a flaw in the Python 3 version checking
+
+It turns out the ax_python_devel.m4 version check assumes that
+("3.X+1.0" >= "3.X.0") is True in Python, which is not when X+1
+is 10 or above and X is not. (Also presumably X+1=100 and ...)
+
+So let's remake the check to behave consistently, using the
+"packaging" or (if absent) the "distlib" modules.
+
+(Also, update the Github workflows to use the new packages.)
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Reviewed-by: John Kennedy <john.kennedy@delphix.com>
+Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
+Closes: #12073
+(cherry picked from commit 08cd0717359b1a18693e3c8e6d6e5a2819b35a48)
+[Romain: drop rpm spec and github workflows changes]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ config/always-pyzfs.m4    | 15 +++++++++++++++
+ config/ax_python_devel.m4 | 33 +++++++++++++++++++++++++++------
+ 2 files changed, 42 insertions(+), 6 deletions(-)
+
+diff --git a/config/always-pyzfs.m4 b/config/always-pyzfs.m4
+index 76e07b593..fa39fd885 100644
+--- a/config/always-pyzfs.m4
++++ b/config/always-pyzfs.m4
+@@ -46,6 +46,21 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
+ 	])
+ 	AC_SUBST(DEFINE_PYZFS)
+ 
++	dnl #
++	dnl # Python "packaging" (or, failing that, "distlib") module is required to build and install pyzfs
++	dnl #
++	AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
++		ZFS_AC_PYTHON_MODULE([packaging], [], [
++			ZFS_AC_PYTHON_MODULE([distlib], [], [
++				AS_IF([test "x$enable_pyzfs" = xyes], [
++					AC_MSG_ERROR("Python $PYTHON_VERSION packaging and distlib modules are not installed")
++				], [test "x$enable_pyzfs" != xno], [
++					enable_pyzfs=no
++				])
++			])
++		])
++	])
++
+ 	dnl #
+ 	dnl # Require python-devel libraries
+ 	dnl #
+diff --git a/config/ax_python_devel.m4 b/config/ax_python_devel.m4
+index c51b45b7d..cdfbbf81f 100644
+--- a/config/ax_python_devel.m4
++++ b/config/ax_python_devel.m4
+@@ -97,9 +97,18 @@ AC_DEFUN([AX_PYTHON_DEVEL],[
+ 	# Check for a version of Python >= 2.1.0
+ 	#
+ 	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
+-	ac_supports_python_ver=`$PYTHON -c "import sys; \
+-		ver = sys.version.split ()[[0]]; \
+-		print (ver >= '2.1.0')"`
++	ac_supports_python_ver=`cat<<EOD | $PYTHON -
++from __future__ import print_function;
++import sys;
++try:
++	from packaging import version;
++except ImportError:
++	from distlib import version;
++ver = sys.version.split ()[[0]];
++(tst_cmp, tst_ver) = ">= '2.1.0'".split ();
++tst_ver = tst_ver.strip ("'");
++eval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
++EOD`
+ 	if test "$ac_supports_python_ver" != "True"; then
+ 		if test -z "$PYTHON_NOVERSIONCHECK"; then
+ 			AC_MSG_RESULT([no])
+@@ -126,9 +135,21 @@ to something else than an empty string.
+ 	#
+ 	if test -n "$1"; then
+ 		AC_MSG_CHECKING([for a version of Python $1])
+-		ac_supports_python_ver=`$PYTHON -c "import sys; \
+-			ver = sys.version.split ()[[0]]; \
+-			print (ver $1)"`
++		# Why the strip ()?  Because if we don't, version.parse
++		# will, for example, report 3.10.0 >= '3.11.0'
++		ac_supports_python_ver=`cat<<EOD | $PYTHON -
++
++from __future__ import print_function;
++import sys;
++try:
++	from packaging import version;
++except ImportError:
++	from distlib import version;
++ver = sys.version.split ()[[0]];
++(tst_cmp, tst_ver) = "$1".split ();
++tst_ver = tst_ver.strip ("'");
++eval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
++EOD`
+ 		if test "$ac_supports_python_ver" = "True"; then
+ 		   AC_MSG_RESULT([yes])
+ 		else
+-- 
+2.31.1
+
diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
index 3b1afb419a..0e7e3e4e74 100644
--- a/package/zfs/zfs.mk
+++ b/package/zfs/zfs.mk
@@ -11,6 +11,7 @@ ZFS_LICENSE_FILES = LICENSE COPYRIGHT
 ZFS_CPE_ID_VENDOR = openzfs
 ZFS_CPE_ID_PRODUCT = openzfs
 
+# 0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
 ZFS_AUTORECONF = YES
 
 ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib
@@ -39,7 +40,7 @@ endif
 # The optional PyZFS uses different scripts depending on the python
 # version (ex: arc_summary2 or arc_summary3).
 ifeq ($(BR2_PACKAGE_PYTHON),y)
-ZFS_DEPENDENCIES += python python-setuptools host-python-cffi
+ZFS_DEPENDENCIES += python python-setuptools host-python-cffi host-python-packaging
 ZFS_CONF_ENV += \
 	PYTHON=$(HOST_DIR)/usr/bin/python2 \
 	PYTHON_CPPFLAGS="`$(STAGING_DIR)/usr/bin/python2-config --includes`" \
@@ -47,7 +48,7 @@ ZFS_CONF_ENV += \
 	PYTHON_SITE_PKG="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"
 ZFS_CONF_OPTS += --enable-pyzfs
 else ifeq ($(BR2_PACKAGE_PYTHON3),y)
-ZFS_DEPENDENCIES += python3 python-setuptools host-python-cffi
+ZFS_DEPENDENCIES += python3 python-setuptools host-python-cffi host-python-packaging
 ZFS_CONF_ENV += \
 	PYTHON=$(HOST_DIR)/usr/bin/python3 \
 	PYTHON_CPPFLAGS="`$(STAGING_DIR)/usr/bin/python3-config --includes`" \
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 2/2] package/zfs: fix python3 version check
  2022-01-03 22:54 ` [Buildroot] [PATCH 2/2] package/zfs: fix python3 version check Romain Naour
@ 2022-01-04 18:31   ` Arnout Vandecappelle
  0 siblings, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2022-01-04 18:31 UTC (permalink / raw)
  To: Romain Naour, buildroot



On 03/01/2022 23:54, Romain Naour wrote:
> Backport a patch to fix the python 3 version check that
> broke the build since the python 3.10 version bump.
> 
> Add host-python-packaging dependency since the backport
> add "from packaging import version" while checking the
> python version.
> 
> Fixes:
> https://gitlab.com/buildroot.org/buildroot/-/jobs/1935414730
> https://gitlab.com/buildroot.org/buildroot/-/jobs/1935415049
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>

  Both applied to master, thanks.

  Regards,
  Arnout

> ---
>   ...law-in-the-Python-3-version-checking.patch | 106 ++++++++++++++++++
>   package/zfs/zfs.mk                            |   5 +-
>   2 files changed, 109 insertions(+), 2 deletions(-)
>   create mode 100644 package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
> 
> diff --git a/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch b/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
> new file mode 100644
> index 0000000000..70978f9f4d
> --- /dev/null
> +++ b/package/zfs/0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
> @@ -0,0 +1,106 @@
> +From 4dc82e9d503518a00e54972be7c0cb5f342f985e Mon Sep 17 00:00:00 2001
> +From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
> +Date: Tue, 8 Jun 2021 20:20:16 -0400
> +Subject: [PATCH] Correct a flaw in the Python 3 version checking
> +
> +It turns out the ax_python_devel.m4 version check assumes that
> +("3.X+1.0" >= "3.X.0") is True in Python, which is not when X+1
> +is 10 or above and X is not. (Also presumably X+1=100 and ...)
> +
> +So let's remake the check to behave consistently, using the
> +"packaging" or (if absent) the "distlib" modules.
> +
> +(Also, update the Github workflows to use the new packages.)
> +
> +Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
> +Reviewed-by: John Kennedy <john.kennedy@delphix.com>
> +Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
> +Closes: #12073
> +(cherry picked from commit 08cd0717359b1a18693e3c8e6d6e5a2819b35a48)
> +[Romain: drop rpm spec and github workflows changes]
> +Signed-off-by: Romain Naour <romain.naour@gmail.com>
> +---
> + config/always-pyzfs.m4    | 15 +++++++++++++++
> + config/ax_python_devel.m4 | 33 +++++++++++++++++++++++++++------
> + 2 files changed, 42 insertions(+), 6 deletions(-)
> +
> +diff --git a/config/always-pyzfs.m4 b/config/always-pyzfs.m4
> +index 76e07b593..fa39fd885 100644
> +--- a/config/always-pyzfs.m4
> ++++ b/config/always-pyzfs.m4
> +@@ -46,6 +46,21 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
> + 	])
> + 	AC_SUBST(DEFINE_PYZFS)
> +
> ++	dnl #
> ++	dnl # Python "packaging" (or, failing that, "distlib") module is required to build and install pyzfs
> ++	dnl #
> ++	AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
> ++		ZFS_AC_PYTHON_MODULE([packaging], [], [
> ++			ZFS_AC_PYTHON_MODULE([distlib], [], [
> ++				AS_IF([test "x$enable_pyzfs" = xyes], [
> ++					AC_MSG_ERROR("Python $PYTHON_VERSION packaging and distlib modules are not installed")
> ++				], [test "x$enable_pyzfs" != xno], [
> ++					enable_pyzfs=no
> ++				])
> ++			])
> ++		])
> ++	])
> ++
> + 	dnl #
> + 	dnl # Require python-devel libraries
> + 	dnl #
> +diff --git a/config/ax_python_devel.m4 b/config/ax_python_devel.m4
> +index c51b45b7d..cdfbbf81f 100644
> +--- a/config/ax_python_devel.m4
> ++++ b/config/ax_python_devel.m4
> +@@ -97,9 +97,18 @@ AC_DEFUN([AX_PYTHON_DEVEL],[
> + 	# Check for a version of Python >= 2.1.0
> + 	#
> + 	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
> +-	ac_supports_python_ver=`$PYTHON -c "import sys; \
> +-		ver = sys.version.split ()[[0]]; \
> +-		print (ver >= '2.1.0')"`
> ++	ac_supports_python_ver=`cat<<EOD | $PYTHON -
> ++from __future__ import print_function;
> ++import sys;
> ++try:
> ++	from packaging import version;
> ++except ImportError:
> ++	from distlib import version;
> ++ver = sys.version.split ()[[0]];
> ++(tst_cmp, tst_ver) = ">= '2.1.0'".split ();
> ++tst_ver = tst_ver.strip ("'");
> ++eval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
> ++EOD`
> + 	if test "$ac_supports_python_ver" != "True"; then
> + 		if test -z "$PYTHON_NOVERSIONCHECK"; then
> + 			AC_MSG_RESULT([no])
> +@@ -126,9 +135,21 @@ to something else than an empty string.
> + 	#
> + 	if test -n "$1"; then
> + 		AC_MSG_CHECKING([for a version of Python $1])
> +-		ac_supports_python_ver=`$PYTHON -c "import sys; \
> +-			ver = sys.version.split ()[[0]]; \
> +-			print (ver $1)"`
> ++		# Why the strip ()?  Because if we don't, version.parse
> ++		# will, for example, report 3.10.0 >= '3.11.0'
> ++		ac_supports_python_ver=`cat<<EOD | $PYTHON -
> ++
> ++from __future__ import print_function;
> ++import sys;
> ++try:
> ++	from packaging import version;
> ++except ImportError:
> ++	from distlib import version;
> ++ver = sys.version.split ()[[0]];
> ++(tst_cmp, tst_ver) = "$1".split ();
> ++tst_ver = tst_ver.strip ("'");
> ++eval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
> ++EOD`
> + 		if test "$ac_supports_python_ver" = "True"; then
> + 		   AC_MSG_RESULT([yes])
> + 		else
> +--
> +2.31.1
> +
> diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
> index 3b1afb419a..0e7e3e4e74 100644
> --- a/package/zfs/zfs.mk
> +++ b/package/zfs/zfs.mk
> @@ -11,6 +11,7 @@ ZFS_LICENSE_FILES = LICENSE COPYRIGHT
>   ZFS_CPE_ID_VENDOR = openzfs
>   ZFS_CPE_ID_PRODUCT = openzfs
>   
> +# 0001-Correct-a-flaw-in-the-Python-3-version-checking.patch
>   ZFS_AUTORECONF = YES
>   
>   ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib
> @@ -39,7 +40,7 @@ endif
>   # The optional PyZFS uses different scripts depending on the python
>   # version (ex: arc_summary2 or arc_summary3).
>   ifeq ($(BR2_PACKAGE_PYTHON),y)
> -ZFS_DEPENDENCIES += python python-setuptools host-python-cffi
> +ZFS_DEPENDENCIES += python python-setuptools host-python-cffi host-python-packaging
>   ZFS_CONF_ENV += \
>   	PYTHON=$(HOST_DIR)/usr/bin/python2 \
>   	PYTHON_CPPFLAGS="`$(STAGING_DIR)/usr/bin/python2-config --includes`" \
> @@ -47,7 +48,7 @@ ZFS_CONF_ENV += \
>   	PYTHON_SITE_PKG="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"
>   ZFS_CONF_OPTS += --enable-pyzfs
>   else ifeq ($(BR2_PACKAGE_PYTHON3),y)
> -ZFS_DEPENDENCIES += python3 python-setuptools host-python-cffi
> +ZFS_DEPENDENCIES += python3 python-setuptools host-python-cffi host-python-packaging
>   ZFS_CONF_ENV += \
>   	PYTHON=$(HOST_DIR)/usr/bin/python3 \
>   	PYTHON_CPPFLAGS="`$(STAGING_DIR)/usr/bin/python3-config --includes`" \
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-04 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 22:54 [Buildroot] [PATCH 1/2] package/python-packaging: add host variant Romain Naour
2022-01-03 22:54 ` [Buildroot] [PATCH 2/2] package/zfs: fix python3 version check Romain Naour
2022-01-04 18:31   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.