Skip to contentSkip to conversation

support/dependencies: add a check for python3

PATCH Superseded Romain Naour 4 participants 6 messages Mar 10, 2019 – Mar 12, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 support/dependencies: add a check for python3

Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library [1].

We add a new check to verify the version of python3 interpreter installed on the host. If no suitable python3 interpreter is found, define BR2_PYTHON3_HOST_DEPENDENCY to add host-python3 in package dependencies when needed.

[1] https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html

---
 support/dependencies/check-host-python3.mk | 13 ++++++++++
 support/dependencies/check-host-python3.sh | 41 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 support/dependencies/check-host-python3.mk
 create mode 100755 support/dependencies/check-host-python3.sh
support/dependencies/check-host-python3.mk new file +13 -0
new file mode 100644
index 0000000000..ceb48c969e
@@ -0,0 +1,13 @@
+# Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library.
+# https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html
+
+# Set this to either 3.4 or higher, depending on the highest minimum
+# version required by any of the packages bundled in Buildroot. If a
+# package is bumped or a new one added, and it requires a higher
+# version, our package infra will catch it and whine.
+#
+BR2_PYTHON3_VERSION_MIN = 3.4
+
+ifeq (,$(call suitable-host-package,python3,$(BR2_PYTHON3_VERSION_MIN) python3 python))
+BR2_PYTHON3_HOST_DEPENDENCY = host-python3
+endif
support/dependencies/check-host-python3.sh new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.14.5
#1 lore raw

PATCH 2/2 package/glibc: bump to version 2.29

Changes to build and runtime requirements:

* Python 3.4 or later is required to build the GNU C Library.

* On most architectures, GCC 5 or later is required to build the GNU C Library. (On powerpc64le, GCC 6.2 or later is still required, as before.)

https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html

---
 package/gcc/Config.in.host                                          | 6 ++----
 .../glibc.hash                                                      | 2 +-
 package/glibc/glibc.mk                                              | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)
 rename package/glibc/{glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1 => glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61}/glibc.hash (69%)
package/gcc/Config.in.host +2 -4
index 8ec406a117..222251f43c 100644
@@ -30,10 +30,8 @@ config BR2_GCC_VERSION_4_9_X
 	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_microblazeel || BR2_microblazebe))
 	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64le))
 	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_mips64 || BR2_mips64el))
-	# glibc >= 2.26 needs gcc >= 6.2
-	depends on !(BR2_TOOLCHAIN_USES_GLIBC && BR2_powerpc64le)
-	# glibc >= 2.27 needs gcc >= 5
-	depends on !(BR2_TOOLCHAIN_USES_GLIBC && (BR2_aarch64 || BR2_aarch64_be))
+	# glibc >= 2.29 needs gcc >= 5 on all architectures.
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
 
 config BR2_GCC_VERSION_5_X
package/glibc/glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61/glibc.hash renamed from package/glibc/glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1/glibc.hash +1 -1
similarity index 69%
rename from package/glibc/glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1/glibc.hash
rename to package/glibc/glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61/glibc.hash
index e83b1caf4c..21efeef43f 100644
@@ -1,5 +1,5 @@
 # Locally calculated (fetched from Github)
-sha256  ebf04c7b00153d6df8beceec0666d4b13e1ac613b40d5774d1b8c6f61c1686e6  glibc-glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1.tar.gz
+sha256  fdc2f7966eac7071ac4d66bc38d9236476d670f042645f9566746a1fd42a6a9d  glibc-glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61.tar.gz
 
 # Hashes for license files
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/glibc/glibc.mk +2 -2
index ec5b3cedc9..1437f87368 100644
@@ -13,7 +13,7 @@ GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
-GLIBC_VERSION = glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1
+GLIBC_VERSION = glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61
 # Upstream doesn't officially provide an https download link.
 # There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
 # sometimes the connection times out. So use an unofficial github mirror.
@@ -32,7 +32,7 @@ GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
 # Before glibc is configured, we must have the first stage
 # cross-compiler and the kernel headers
 GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk \
-	$(BR2_MAKE_HOST_DEPENDENCY)
+	$(BR2_MAKE_HOST_DEPENDENCY) $(BR2_PYTHON3_HOST_DEPENDENCY)
 
 GLIBC_SUBDIR = build
 
Signature · 1 line
2.14.5
#2 lore raw

PATCH 2/2 package/glibc: bump to version 2.29

Romain, All,

On 2019-03-10 17:59 +0100, Romain Naour spake thusly:
[--SNIP--]

package/glibc/glibc.mk GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION)) · line 16

Quoted 10 lines
package/glibc/glibc.mk +1 -1
index ec5b3cedc9..1437f87368 100644
@@ -13,7 +13,7 @@ GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
-GLIBC_VERSION = glibc-2.28-69-g1e5c5303a522764d7e9d2302a60e4a32cdb902f1
+GLIBC_VERSION = glibc-2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61

I think at some point, someone suggested we drop the 'glibc-' prefix, and jsut use e.g. 2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61.

I just checked, and it seems to work:

    $ git show 2.29-6-g067fc32968b601493f4b247a3ac00caeea3f3d61
    commit 067fc32968b601493f4b247a3ac00caeea3f3d61 (origin/release/2.29/master)
    Author: Florian Weimer <[email protected]>
    Date:   Fri Feb 15 21:27:01 2019 +0100

nptl: Fix invalid Systemtap probe in pthread_join [BZ #24211]

[...]

I think it is nicer...

Regards,
Yann E. MORIN.

Quoted 19 lines
package/glibc/glibc.mk +1 -1
 # Upstream doesn't officially provide an https download link.
 # There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
 # sometimes the connection times out. So use an unofficial github mirror.
@@ -32,7 +32,7 @@ GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
 # Before glibc is configured, we must have the first stage
 # cross-compiler and the kernel headers
 GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk \
-	$(BR2_MAKE_HOST_DEPENDENCY)
+	$(BR2_MAKE_HOST_DEPENDENCY) $(BR2_PYTHON3_HOST_DEPENDENCY)
 
 GLIBC_SUBDIR = build
 
Signature · 6 lines
2.14.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/2 support/dependencies: add a check for python3

In reply to Romain Naour

Hello;

Quoted 55 lines · Romain Naour

Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library [1].

We add a new check to verify the version of python3 interpreter installed on the host. If no suitable python3 interpreter is found, define BR2_PYTHON3_HOST_DEPENDENCY to add host-python3 in package dependencies when needed.

[1] https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html

---
 support/dependencies/check-host-python3.mk | 13 ++++++++++
 support/dependencies/check-host-python3.sh | 41 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 support/dependencies/check-host-python3.mk
 create mode 100755 support/dependencies/check-host-python3.sh
support/dependencies/check-host-python3.mk new file +13 -0
new file mode 100644
index 0000000000..ceb48c969e
@@ -0,0 +1,13 @@
+# Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library.
+# https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html
+
+# Set this to either 3.4 or higher, depending on the highest minimum
+# version required by any of the packages bundled in Buildroot. If a
+# package is bumped or a new one added, and it requires a higher
+# version, our package infra will catch it and whine.
+#
+BR2_PYTHON3_VERSION_MIN = 3.4
+
+ifeq (,$(call suitable-host-package,python3,$(BR2_PYTHON3_VERSION_MIN) python3 python))
+BR2_PYTHON3_HOST_DEPENDENCY = host-python3
+endif
support/dependencies/check-host-python3.sh new file +13 -0
new file mode 100755
index 0000000000..e5745fa7c4
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# prevent shift error
+[ $# -lt 2 ] && exit 1
+
+major_min="${1%.*}"
+minor_min="${1#*.}"
+
+shift
+
+# The host python interpreter is already checked by dependencies.sh but
+# it only check if the version is at least 2.7.
+# We want to check the version number of the python3 interpreter even

support/dependencies/check-host-python3.sh line 23

Quoted 10 lines
support/dependencies/check-host-python3.sh new file +10 -0
+# if Buildroot is able to use any version but some packages may require
+# a more recent version.
+python3_candidates="$1"
+
+for candidate in $python3_candidates ; do
+       python3=`which $candidate 2>/dev/null`
+       if [ ! -x "$python3" ]; then
+               continue
+       fi
+       version=`$python3 -V 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-].*//g' -e '1q'`

I personally prefer the syntax foo=$(command) rather than foo=$command

support/dependencies/check-host-python3.sh line 27

Quoted 4 lines
support/dependencies/check-host-python3.sh new file +4 -0
+
+       major=`echo "$version" | cut -d. -f1`
+       minor=`echo "$version" | cut -d. -f2`
+

I have a bit of issue with this:
Why can't we use the same line as we use in dependencies.sh? version=$(python3 -V 2>&1 |awk '{ split($2, v, "."); print v[1] v[2] }') On Fedora29 this produces 37, which makes the check much easier.

Quoted 15 lines
support/dependencies/check-host-python3.sh new file +14 -1
+       if [ $major -lt $major_min ]; then
+               # no suitable python3 found
+               continue
+       fi
+
+       if [ $major -eq $major_min -a $minor -lt $minor_min ]; then
+               # no suitable python3 found
+               continue
+       fi
+
+       # suitable python3 found
+       echo $python3
+       break
+done
--
Quoted 1 line

2.14.5

Is there a reason this logic can't go in dependencies.sh?

Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Thanks!
Adam

#4 lore raw

PATCH 1/2 support/dependencies: add a check for python3

Hi Adam,

Le 12/03/2019 ? 14:09, Adam Duskett a ?crit?:

Quoted 60 lines

Hello;

Quoted 58 lines · Romain Naour

Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library [1].

We add a new check to verify the version of python3 interpreter installed on the host. If no suitable python3 interpreter is found, define BR2_PYTHON3_HOST_DEPENDENCY to add host-python3 in package dependencies when needed.

[1] https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html

---
 support/dependencies/check-host-python3.mk | 13 ++++++++++
 support/dependencies/check-host-python3.sh | 41 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 support/dependencies/check-host-python3.mk
 create mode 100755 support/dependencies/check-host-python3.sh
support/dependencies/check-host-python3.mk new file +13 -0
new file mode 100644
index 0000000000..ceb48c969e
@@ -0,0 +1,13 @@
+# Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library.
+# https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html
+
+# Set this to either 3.4 or higher, depending on the highest minimum
+# version required by any of the packages bundled in Buildroot. If a
+# package is bumped or a new one added, and it requires a higher
+# version, our package infra will catch it and whine.
+#
+BR2_PYTHON3_VERSION_MIN = 3.4
+
+ifeq (,$(call suitable-host-package,python3,$(BR2_PYTHON3_VERSION_MIN) python3 python))
+BR2_PYTHON3_HOST_DEPENDENCY = host-python3
+endif
support/dependencies/check-host-python3.sh new file +16 -0
new file mode 100755
index 0000000000..e5745fa7c4
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# prevent shift error
+[ $# -lt 2 ] && exit 1
+
+major_min="${1%.*}"
+minor_min="${1#*.}"
+
+shift
+
+# The host python interpreter is already checked by dependencies.sh but
+# it only check if the version is at least 2.7.
+# We want to check the version number of the python3 interpreter even
+# if Buildroot is able to use any version but some packages may require
+# a more recent version.
+python3_candidates="$1"
Quoted 8 lines

support/dependencies/check-host-python3.sh line 23

Quoted 7 lines
support/dependencies/check-host-python3.sh new file +7 -0
+
+for candidate in $python3_candidates ; do
+       python3=`which $candidate 2>/dev/null`
+       if [ ! -x "$python3" ]; then
+               continue
+       fi
+       version=`$python3 -V 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-].*//g' -e '1q'`

I personally prefer the syntax foo=$(command) rather than foo=$command

I tried to keep the same convention as for other check-host-*.sh script. (see check-host-cmake.sh).

Quoted 8 lines

support/dependencies/check-host-python3.sh line 27

Quoted 4 lines
support/dependencies/check-host-python3.sh new file +4 -0
+
+       major=`echo "$version" | cut -d. -f1`
+       minor=`echo "$version" | cut -d. -f2`
+

I have a bit of issue with this:
Why can't we use the same line as we use in dependencies.sh? version=$(python3 -V 2>&1 |awk '{ split($2, v, "."); print v[1] v[2] }') On Fedora29 this produces 37, which makes the check much easier.

It should be possible, I'll try.
I want to keep BR2_PYTHON3_VERSION_MIN = 3.4.

Quoted 10 lines
Quoted 10 lines
support/dependencies/check-host-python3.sh new file +9 -0
+       if [ $major -lt $major_min ]; then
+               # no suitable python3 found
+               continue
+       fi
+
+       if [ $major -eq $major_min -a $minor -lt $minor_min ]; then
+               # no suitable python3 found
+               continue
+       fi
Quoted 8 lines
Quoted 7 lines
support/dependencies/check-host-python3.sh new file +5 -1
+
+       # suitable python3 found
+       echo $python3
+       break
+done
--

2.14.5

Is there a reason this logic can't go in dependencies.sh?

We need to define "BR2_PYTHON3_HOST_DEPENDENCY = host-python3" from the Makefile (check-host-python3.mk) if no suitable python3 is found on the host.

BR2_PYTHON3_HOST_DEPENDENCY is used latter by glibc.mk to add host-python3 in GLIBC_DEPENDENCIES only if the python installed on the host is python2 or a too old python3.

I don't see how we can do that if the logic is located in dependencies.sh.

Thanks for the review.
Romain

Quoted 14 lines
Quoted 6 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Thanks!
Adam
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw

PATCH 1/2 support/dependencies: add a check for python3

In reply to Romain Naour

Romain, All,

On 2019-03-10 17:59 +0100, Romain Naour spake thusly:

Quoted 23 lines

Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library [1].

We add a new check to verify the version of python3 interpreter installed on the host. If no suitable python3 interpreter is found, define BR2_PYTHON3_HOST_DEPENDENCY to add host-python3 in package dependencies when needed.

[1] https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html

---
 support/dependencies/check-host-python3.mk | 13 ++++++++++
 support/dependencies/check-host-python3.sh | 41 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 support/dependencies/check-host-python3.mk
 create mode 100755 support/dependencies/check-host-python3.sh
support/dependencies/check-host-python3.mk new file +1 -0
new file mode 100644
index 0000000000..ceb48c969e
@@ -0,0 +1,13 @@
+# Since version 2.29, glibc requires python 3.4 or later to build the GNU C Library.

support/dependencies/check-host-python3.mk line 11

Quoted 10 lines
support/dependencies/check-host-python3.mk new file +10 -0
+# https://www.sourceware.org/ml/libc-alpha/2019-01/msg00723.html
+
+# Set this to either 3.4 or higher, depending on the highest minimum
+# version required by any of the packages bundled in Buildroot. If a
+# package is bumped or a new one added, and it requires a higher
+# version, our package infra will catch it and whine.
+#
+BR2_PYTHON3_VERSION_MIN = 3.4
+
+ifeq (,$(call suitable-host-package,python3,$(BR2_PYTHON3_VERSION_MIN) python3 python))

This call is turned into:

    $(shell support/dependencies/check-host-python3.sh 3.4 python3 python)

which means that support/dependencies/check-host-python3.sh is called with three arguments, not two, which means that...

Quoted 8 lines
support/dependencies/check-host-python3.mk new file +2 -0
+BR2_PYTHON3_HOST_DEPENDENCY = host-python3
+endif
support/dependencies/check-host-python3.sh new file +0 -0
new file mode 100755
index 0000000000..e5745fa7c4

support/dependencies/check-host-python3.sh line 9

Quoted 9 lines
support/dependencies/check-host-python3.sh new file +9 -0
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# prevent shift error
+[ $# -lt 2 ] && exit 1
+
+major_min="${1%.*}"
+minor_min="${1#*.}"
+
+shift

... here we're left with two remaining arguments, and thus...

support/dependencies/check-host-python3.sh line 16

Quoted 6 lines
support/dependencies/check-host-python3.sh new file +6 -0
+# The host python interpreter is already checked by dependencies.sh but
+# it only check if the version is at least 2.7.
+# We want to check the version number of the python3 interpreter even
+# if Buildroot is able to use any version but some packages may require
+# a more recent version.
+python3_candidates="$1"

... here ${1} is only ever going to contain "python3", not "python3 python" as you think it does. Does it?

support/dependencies/check-host-python3.sh line 18

Quoted 1 line
support/dependencies/check-host-python3.sh new file +1 -0
+for candidate in $python3_candidates ; do

The simplest is to drop the python3_candidates variable, and simply use:

    for candidate in "${@}"; do
        [...]
    done

Regards,
Yann E. MORIN.

Quoted 30 lines
support/dependencies/check-host-python3.sh new file +23 -0
+	python3=`which $candidate 2>/dev/null`
+	if [ ! -x "$python3" ]; then
+		continue
+	fi
+	version=`$python3 -V 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-].*//g' -e '1q'`
+
+	major=`echo "$version" | cut -d. -f1`
+	minor=`echo "$version" | cut -d. -f2`
+
+	if [ $major -lt $major_min ]; then
+		# no suitable python3 found
+		continue
+	fi
+
+	if [ $major -eq $major_min -a $minor -lt $minor_min ]; then
+		# no suitable python3 found
+		continue
+	fi
+
+	# suitable python3 found
+	echo $python3
+	break
+done
Signature · 6 lines
2.14.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'