* [Buildroot] [PATCH 0/2] Ensure host python is python2
@ 2012-05-08 20:45 Samuel Martin
2012-05-08 20:45 ` [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection Samuel Martin
2012-05-08 20:45 ` [Buildroot] [PATCH 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
0 siblings, 2 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-08 20:45 UTC (permalink / raw)
To: buildroot
This patch series ensures that host python is python2.
This fixes some distro weirdnesses that makes /usr/bin/python pointed
to python3 instead of python2, with some bad consequences for some
install/post-install python scripts.
Samuel Martin (2):
Makefile.in: add host python2 binary detection
libglib2: fix install even if the host python binary refers to
python3
package/Makefile.in | 12 ++++++++++++
package/libglib2/libglib2.mk | 19 ++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
--
1.7.10.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection
2012-05-08 20:45 [Buildroot] [PATCH 0/2] Ensure host python is python2 Samuel Martin
@ 2012-05-08 20:45 ` Samuel Martin
2012-05-11 22:15 ` Arnout Vandecappelle
2012-05-08 20:45 ` [Buildroot] [PATCH 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
1 sibling, 1 reply; 9+ messages in thread
From: Samuel Martin @ 2012-05-08 20:45 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
diff --git a/package/Makefile.in b/package/Makefile.in
index df7042c..84968da 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -151,6 +151,18 @@ FLEX:=$(shell which flex || type -p flex)
BISON:=$(shell which bison || type -p bison)
SED:=$(shell which sed || type -p sed) -i -e
+PYTHON2:=$(shell \
+ which python &>/dev/null && \
+ python --version 2>&1 | grep -qE 'Python 2\.[6-7]*' && \
+ which python || \
+ which python2 &>/dev/null && \
+ python2 --version 2>&1 | grep -qE 'Python 2\.[6-7]*' && \
+ which python2 || \
+ echo $(HOST_DIR)/usr/bin/python)
+HOST_PYTHON2:=$(shell \
+ test $(PYTHON2) != $(HOST_DIR)/usr/bin/python || \
+ echo host-python)
+
HOST_CFLAGS ?= -O2
HOST_CFLAGS += -I$(HOST_DIR)/include -I$(HOST_DIR)/usr/include
HOST_CXXFLAGS += -I$(HOST_DIR)/include -I$(HOST_DIR)/usr/include
--
1.7.10.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH 2/2] libglib2: fix install even if the host python binary refers to python3
2012-05-08 20:45 [Buildroot] [PATCH 0/2] Ensure host python is python2 Samuel Martin
2012-05-08 20:45 ` [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection Samuel Martin
@ 2012-05-08 20:45 ` Samuel Martin
1 sibling, 0 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-08 20:45 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index d2445a1..4c372d8 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -42,7 +42,10 @@ LIBGLIB2_CONF_ENV = \
ac_use_included_regex=no gl_cv_c_restrict=no \
ac_cv_path_GLIB_GENMARSHAL=$(HOST_DIR)/usr/bin/glib-genmarshal ac_cv_prog_F77=no \
ac_cv_func_posix_getgrgid_r=no \
- gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no)
+ gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no) \
+ ac_cv_path_PYTHON=$(PYTHON2)
+
+HOST_LIBGLIB2_CONF_ENV += ac_cv_path_PYTHON=$(PYTHON2)
# old uClibc versions don't provide qsort_r
ifeq ($(BR2_UCLIBC_VERSION_0_9_31)$(BR2_UCLIBC_VERSION_0_9_32)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
@@ -55,9 +58,19 @@ HOST_LIBGLIB2_CONF_OPT = \
--disable-gtk-doc \
--enable-debug=no \
-LIBGLIB2_DEPENDENCIES = host-pkg-config host-libglib2 libffi zlib $(if $(BR2_NEEDS_GETTEXT),gettext libintl)
+LIBGLIB2_DEPENDENCIES = \
+ host-pkg-config \
+ host-libglib2 \
+ $(HOST_PYTHON2) \
+ libffi \
+ zlib \
+ $(if $(BR2_NEEDS_GETTEXT),gettext libintl)
-HOST_LIBGLIB2_DEPENDENCIES = host-pkg-config host-libffi host-zlib
+HOST_LIBGLIB2_DEPENDENCIES = \
+ host-pkg-config \
+ host-libffi \
+ host-zlib \
+ $(HOST_PYTHON2)
ifneq ($(BR2_ENABLE_LOCALE),y)
LIBGLIB2_DEPENDENCIES += libiconv
--
1.7.10.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection
2012-05-08 20:45 ` [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection Samuel Martin
@ 2012-05-11 22:15 ` Arnout Vandecappelle
2012-05-11 22:50 ` Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Samuel Martin
0 siblings, 2 replies; 9+ messages in thread
From: Arnout Vandecappelle @ 2012-05-11 22:15 UTC (permalink / raw)
To: buildroot
On 05/08/12 22:45, Samuel Martin wrote:
>
> Signed-off-by: Samuel Martin<s.martin49@gmail.com>
>
> diff --git a/package/Makefile.in b/package/Makefile.in
> index df7042c..84968da 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -151,6 +151,18 @@ FLEX:=$(shell which flex || type -p flex)
> BISON:=$(shell which bison || type -p bison)
> SED:=$(shell which sed || type -p sed) -i -e
>
> +PYTHON2:=$(shell \
> + which python&>/dev/null&& \
> + python --version 2>&1 | grep -qE 'Python 2\.[6-7]*'&& \
> + which python || \
> + which python2&>/dev/null&& \
> + python2 --version 2>&1 | grep -qE 'Python 2\.[6-7]*'&& \
> + which python2 || \
> + echo $(HOST_DIR)/usr/bin/python)
> +HOST_PYTHON2:=$(shell \
> + test $(PYTHON2) != $(HOST_DIR)/usr/bin/python || \
> + echo host-python)
> +
This is probably better placed in support/dependencies, using the
suitable-host-package infrastructure. Put the PYTHON2 script in
support/dependencies/check-host-python2.sh, and create a
support/dependencies/check-host-python2.mk containing:
PYTHON2 := python python2
PYTHON2 := $(call suitable-host-package,$(PYTHON2))
ifeq ($(PYTHON2),$(HOST_DIR)/usr/bin/python)
HOST_PYTHON2 = host-python
endif
Actually, maybe DEP_PYTHON2 is a better name for the dependency. Or
NEEDS_PYTHON2.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection
2012-05-11 22:15 ` Arnout Vandecappelle
@ 2012-05-11 22:50 ` Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Samuel Martin
1 sibling, 0 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-11 22:50 UTC (permalink / raw)
To: buildroot
Hi,
2012/5/12 Arnout Vandecappelle <arnout@mind.be>:
> On 05/08/12 22:45, Samuel Martin wrote:
>>
>>
>> Signed-off-by: Samuel Martin<s.martin49@gmail.com>
>>
>> diff --git a/package/Makefile.in b/package/Makefile.in
>> index df7042c..84968da 100644
>> --- a/package/Makefile.in
>> +++ b/package/Makefile.in
>> @@ -151,6 +151,18 @@ FLEX:=$(shell which flex || type -p flex)
>> ?BISON:=$(shell which bison || type -p bison)
>> ?SED:=$(shell which sed || type -p sed) -i -e
>>
>> +PYTHON2:=$(shell \
>> + ? ? ? which python&>/dev/null&& ?\
>> + ? ? ? ? ? ? ? python --version 2>&1 | grep -qE 'Python 2\.[6-7]*'&& ?\
>> + ? ? ? ? ? ? ? which python || \
>> + ? ? ? which python2&>/dev/null&& ?\
>> + ? ? ? ? ? ? ? python2 --version 2>&1 | grep -qE 'Python 2\.[6-7]*'&& ?\
>> + ? ? ? ? ? ? ? which python2 || \
>> + ? ? ? echo $(HOST_DIR)/usr/bin/python)
>> +HOST_PYTHON2:=$(shell \
>> + ? ? ? test $(PYTHON2) != $(HOST_DIR)/usr/bin/python || \
>> + ? ? ? echo host-python)
>> +
>
>
> ?This is probably better placed in support/dependencies, using the
> suitable-host-package infrastructure. ?Put the PYTHON2 script in
> support/dependencies/check-host-python2.sh, and create a
> support/dependencies/check-host-python2.mk containing:
>
> PYTHON2 := python python2
> PYTHON2 := $(call suitable-host-package,$(PYTHON2))
> ifeq ($(PYTHON2),$(HOST_DIR)/usr/bin/python)
> ?HOST_PYTHON2 = host-python
> endif
>
> ?Actually, maybe DEP_PYTHON2 is a better name for the dependency. ?Or
> NEEDS_PYTHON2.
>
I've never noticed this stuff before.
Looks like exactly what I wanted to do!
Thx for the tip.
> ?Regards,
> ?Arnout
>
> --
> Arnout Vandecappelle ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? arnout at mind be
> Senior Embedded Software Architect ? ? ? ? ? ? ? ? +32-16-286540
> Essensium/Mind ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium ? ? ? ? ? ? ? ?BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint: ?7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
Cheers,
Sam
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found
2012-05-11 22:15 ` Arnout Vandecappelle
2012-05-11 22:50 ` Samuel Martin
@ 2012-05-13 10:43 ` Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
2012-05-15 21:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Arnout Vandecappelle
1 sibling, 2 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-13 10:43 UTC (permalink / raw)
To: buildroot
Some distros choose to change the /usr/bin/python binary, make it pointed to
python3 instead of python2.
This may have some bad consequences for packages that uses some
non-python3-compliant python scripts in their build system (eg. in install or
post-install scripts).
This patch checks for a suitable python2 version (2.6 or 2.7) on the host
system, and declares the following variables:
- PYTHON2: pointing to the host python2 binary;
- NEED_PYTHON2: sets to "host-python" if no python2 binary has been found.
This way, a package using some python2 scripts must:
- adds $(NEED_PYTHON2) to its dependency list;
- sets $(PYTHON2) as the python binary to be used.
A side effect of this patch is getting rid of any host python requirement.
Buildroot can runs on a host without python, or with a too old python2 version,
or with only python3.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
create mode 100644 support/dependencies/check-host-python2.mk
create mode 100755 support/dependencies/check-host-python2.sh
diff --git a/support/dependencies/check-host-python2.mk b/support/dependencies/check-host-python2.mk
new file mode 100644
index 0000000..79197cb
--- /dev/null
+++ b/support/dependencies/check-host-python2.mk
@@ -0,0 +1,7 @@
+PYTHON2 := $(call suitable-host-package,python2)
+NEED_PYTHON2 :=
+
+ifeq (,$(PYTHON2))
+ NEED_PYTHON2 = host-python
+ PYTHON2 = $(HOST_DIR)/usr/bin/python
+endif
diff --git a/support/dependencies/check-host-python2.sh b/support/dependencies/check-host-python2.sh
new file mode 100755
index 0000000..6adb328
--- /dev/null
+++ b/support/dependencies/check-host-python2.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+candidates="python python2"
+
+for candidate in ${candidates} ; do
+ which ${candidate} &>/dev/null || continue
+ # restrict version of python2 to 2.6 or 2.7
+ if ${candidate} --version 2>&1 | grep -qE 'Python 2\.[6-7]*' ; then
+ # found a valid candidate, so quit now
+ echo $(which ${candidate})
+ exit
+ fi
+done
--
1.7.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 2/2] libglib2: fix install even if the host python binary refers to python3
2012-05-13 10:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Samuel Martin
@ 2012-05-13 10:43 ` Samuel Martin
2012-05-15 21:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Arnout Vandecappelle
1 sibling, 0 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-13 10:43 UTC (permalink / raw)
To: buildroot
The libglib2's build system uses some python2 scripts in the install rules.
This patch ensures to have a valid host python2 binary and enforces this python2
binary at configure-time.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index d2445a1..500f309 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -42,7 +42,10 @@ LIBGLIB2_CONF_ENV = \
ac_use_included_regex=no gl_cv_c_restrict=no \
ac_cv_path_GLIB_GENMARSHAL=$(HOST_DIR)/usr/bin/glib-genmarshal ac_cv_prog_F77=no \
ac_cv_func_posix_getgrgid_r=no \
- gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no)
+ gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no) \
+ ac_cv_path_PYTHON=$(PYTHON2)
+
+HOST_LIBGLIB2_CONF_ENV += ac_cv_path_PYTHON=$(PYTHON2)
# old uClibc versions don't provide qsort_r
ifeq ($(BR2_UCLIBC_VERSION_0_9_31)$(BR2_UCLIBC_VERSION_0_9_32)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
@@ -57,7 +60,9 @@ HOST_LIBGLIB2_CONF_OPT = \
LIBGLIB2_DEPENDENCIES = host-pkg-config host-libglib2 libffi zlib $(if $(BR2_NEEDS_GETTEXT),gettext libintl)
-HOST_LIBGLIB2_DEPENDENCIES = host-pkg-config host-libffi host-zlib
+HOST_LIBGLIB2_DEPENDENCIES = host-pkg-config host-libffi host-zlib $(NEED_PYTHON2)
+
+LIBGLIB2_DEPENDENCIES += $(NEED_PYTHON2)
ifneq ($(BR2_ENABLE_LOCALE),y)
LIBGLIB2_DEPENDENCIES += libiconv
--
1.7.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found
2012-05-13 10:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
@ 2012-05-15 21:43 ` Arnout Vandecappelle
2012-05-15 22:01 ` Samuel Martin
1 sibling, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2012-05-15 21:43 UTC (permalink / raw)
To: buildroot
On 05/13/12 12:43, Samuel Martin wrote:
> diff --git a/support/dependencies/check-host-python2.mk b/support/dependencies/check-host-python2.mk
> new file mode 100644
> index 0000000..79197cb
> --- /dev/null
> +++ b/support/dependencies/check-host-python2.mk
> @@ -0,0 +1,7 @@
> +PYTHON2 := $(call suitable-host-package,python2)
> +NEED_PYTHON2 :=
This can be removed, empty is the default.
> +
> +ifeq (,$(PYTHON2))
> + NEED_PYTHON2 = host-python
> + PYTHON2 = $(HOST_DIR)/usr/bin/python
> +endif
Does this work? I thought it wasn't allowed to mix := and = assignments.
> diff --git a/support/dependencies/check-host-python2.sh b/support/dependencies/check-host-python2.sh
> new file mode 100755
> index 0000000..6adb328
> --- /dev/null
> +++ b/support/dependencies/check-host-python2.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +candidates="python python2"
> +
> +for candidate in ${candidates} ; do
> + which ${candidate}&>/dev/null || continue
> + # restrict version of python2 to 2.6 or 2.7
> + if ${candidate} --version 2>&1 | grep -qE 'Python 2\.[6-7]*' ; then
The * is a mistake, I think. This way, 2.5 also matches (zero repetitions).
The -E is also a redundant since you're not using extended regexp.
Regards,
Arnout
> + # found a valid candidate, so quit now
> + echo $(which ${candidate})
> + exit
> + fi
> +done
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found
2012-05-15 21:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Arnout Vandecappelle
@ 2012-05-15 22:01 ` Samuel Martin
0 siblings, 0 replies; 9+ messages in thread
From: Samuel Martin @ 2012-05-15 22:01 UTC (permalink / raw)
To: buildroot
2012/5/15 Arnout Vandecappelle <arnout@mind.be>:
> On 05/13/12 12:43, Samuel Martin wrote:
>>
>> diff --git a/support/dependencies/check-host-python2.mk
>> b/support/dependencies/check-host-python2.mk
>> new file mode 100644
>> index 0000000..79197cb
>> --- /dev/null
>> +++ b/support/dependencies/check-host-python2.mk
>> @@ -0,0 +1,7 @@
>> +PYTHON2 := $(call suitable-host-package,python2)
>> +NEED_PYTHON2 :=
>
>
> ?This can be removed, empty is the default.
Fair enough
>
>
>> +
>> +ifeq (,$(PYTHON2))
>> + ?NEED_PYTHON2 = host-python
>> + ?PYTHON2 = $(HOST_DIR)/usr/bin/python
>> +endif
>
>
> ?Does this work? ?I thought it wasn't allowed to mix := and = assignments.
In my test runs, it does, though I can get rid of the immediat
assignment I think.
>
>
>> diff --git a/support/dependencies/check-host-python2.sh
>> b/support/dependencies/check-host-python2.sh
>> new file mode 100755
>> index 0000000..6adb328
>> --- /dev/null
>> +++ b/support/dependencies/check-host-python2.sh
>> @@ -0,0 +1,13 @@
>> +#!/bin/sh
>> +
>> +candidates="python python2"
>> +
>> +for candidate in ${candidates} ; do
>> + ?which ${candidate}&>/dev/null || continue
>> + ?# restrict version of python2 to 2.6 or 2.7
>> + ?if ${candidate} --version 2>&1 | grep -qE 'Python 2\.[6-7]*' ; then
>
>
> ?The * is a mistake, I think. ?This way, 2.5 also matches (zero
> repetitions).
You're right, .* will fix that.
> The -E is also a redundant since you're not using extended regexp.
ok
Cheers,
Sam
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-05-15 22:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-08 20:45 [Buildroot] [PATCH 0/2] Ensure host python is python2 Samuel Martin
2012-05-08 20:45 ` [Buildroot] [PATCH 1/2] Makefile.in: add host python2 binary detection Samuel Martin
2012-05-11 22:15 ` Arnout Vandecappelle
2012-05-11 22:50 ` Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Samuel Martin
2012-05-13 10:43 ` [Buildroot] [PATCH v2 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
2012-05-15 21:43 ` [Buildroot] [PATCH v2 1/2] dependencies: build a host python2 if no suitable one can be found Arnout Vandecappelle
2012-05-15 22:01 ` Samuel Martin
2012-05-08 20:45 ` [Buildroot] [PATCH 2/2] libglib2: fix install even if the host python binary refers to python3 Samuel Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox