bootstrap: Require patch
PATCH 1/2 bootstrap: Require patch
bootstrap.conf uses patch, let's require it.
Better than multiple messages:
./bootstrap.conf: line 84: patch: command not found
--- bootstrap.conf | 1 + 1 file changed, 1 insertion(+)
bootstrap.conf +1 -0
@@ -70,6 +70,7 @@ autoconf 2.63 automake 1.11 gettext 0.18.3 git 1.5.5 +patch - tar - "
Signature · 1 line
2.32.0
PATCH 2/2 autogen.sh: Detect python
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not found
Using bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
Keep the possibility to define PYTHON.
--- autogen.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
autogen.sh +15 -2
@@ -7,8 +7,21 @@ if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then exit 1 fi -# Set ${PYTHON} to plain 'python' if not set already -: ${PYTHON:=python} +# Detect python +if [ -z "$PYTHON" ]; then + for i in python python3 python2; do + if command -v "$i" > /dev/null 2>&1; then + PYTHON="$i" + echo "Using $PYTHON" >&2 + break + fi + done + + if [ -z "$PYTHON" ]; then + echo "python not found" >&2 + exit 1 + fi +fi export LC_COLLATE=C unset LC_ALL
Signature · 1 line
2.32.0
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 5 lines · Petr Vorel
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
Quoted 12 lines
Keep the possibility to define PYTHON.
Signed-off-by Petr Vorel <[email protected]>--- autogen.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)autogen.sh +0
-0
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 12
Quoted 8 lines
autogen.sh +3
-2@@ -7,8 +7,21 @@ if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then exit 1 fi -# Set ${PYTHON} to plain 'python' if not set already -: ${PYTHON:=python} +# Detect python +if [ -z "$PYTHON" ]; then + for i in python python3 python2; do
May I ask you to use (multiple of) 2 space indention as it is done in most of this file?
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 13
Quoted 1 line
autogen.sh +1
-0+ if command -v "$i" > /dev/null 2>&1; then
Ditto and below please...
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 15
Quoted 2 lines
autogen.sh +2
-0+ PYTHON="$i" + echo "Using $PYTHON" >&2
Please drop ">&2" redirection here.
And I think it should be "Using $PYTHON...".
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 21
Quoted 6 lines
autogen.sh +6
-0+ break + fi + done + + if [ -z "$PYTHON" ]; then + echo "python not found" >&2
s/found/found./
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 24
Quoted 3 lines
autogen.sh +3
-0+ exit 1 + fi +fi
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 9 lines · Daniel Kiper
Quoted 5 lines · Petr Vorel
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
...and python requirement is missing from the list too. Additionally, please update autogen.sh python usage in the INSTALL file.
Last but not least, patch tool requirement is missing from INSTALL file too. Of course this requires update to patch #1 in this series.
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 5 lines · Daniel Kiper
Quoted 3 lines · Petr Vorel
Quoted 2 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not found
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Using bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
...and python requirement is missing from the list too. Additionally, please update
autogen.shpython usage in the INSTALL file.
There is Python 2.6 or later, not sure if it still works on 2.6 (which is EOL) or it requires now 2.7).
Also "If you use a development snapshot or want to hack on GRUB you may need the following." is obsolete (from 2009), I'll move python, autoconf and automake to the list on the top.
Quoted 2 lines
Last but not least, patch tool requirement is missing from INSTALL file too. Of course this requires update to patch #1 in this series.
I first thought "Other standard GNU/Unix tools" would cover it, but it does not harm to mention it (for those who compile on containers which have minimal dependencies).
Kind regards,
Petr
Quoted 1 line
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 8 lines · Petr Vorel
Quoted 7 lines · Daniel Kiper
Quoted 6 lines · Petr Vorel
Quoted 5 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
...and python requirement is missing from the list too. Additionally, please update
autogen.shpython usage in the INSTALL file.There is Python 2.6 or later, not sure if it still works on 2.6 (which is EOL) or it requires now 2.7).
Actually all of Python 2 is EOL for the last year and a half.
https://www.python.org/doc/sunset-python-2/
-- Bruce
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 12 lines · Bruce Dubbs
Quoted 11 lines · Petr Vorel
Quoted 10 lines · Daniel Kiper
Quoted 9 lines · Petr Vorel
Quoted 5 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
...and python requirement is missing from the list too. Additionally, please update
autogen.shpython usage in the INSTALL file.There is Python 2.6 or later, not sure if it still works on 2.6 (which is EOL) or it requires now 2.7).
Actually all of Python 2 is EOL for the last year and a half.
Then we should drop python2 detection from the patch...
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
In reply to Petr VorelQuoted 8 lines · Petr Vorel
Quoted 7 lines · Daniel Kiper
Quoted 6 lines · Petr Vorel
Quoted 5 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
...and python requirement is missing from the list too. Additionally, please update
autogen.shpython usage in the INSTALL file.There is Python 2.6 or later, not sure if it still works on 2.6 (which is EOL) or it requires now 2.7).
I think we should update this requirement to "Python 3.0.0 or later".
Quoted 3 lines
Also "If you use a development snapshot or want to hack on GRUB you may need the following." is obsolete (from 2009), I'll move python, autoconf and automake to the list on the top.
OK...
There is also:
3. Type `./bootstrap'.
* autogen.sh (called by bootstrap) uses python. By default the invocation is "python", but it can be overridden by setting the variable $PYTHON.
I think this should be updated too.
Quoted 5 lines
Quoted 2 lines
Last but not least, patch tool requirement is missing from INSTALL file too. Of course this requires update to patch #1 in this series.
I first thought "Other standard GNU/Unix tools" would cover it, but it does not harm to mention it (for those who compile on containers which have minimal dependencies).
Yep!
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
Hi Daniel,
Quoted 12 lines · Petr Vorel
Quoted 10 lines
Quoted 10 lines · Daniel Kiper
Quoted 9 lines · Petr Vorel
Quoted 5 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
...and python requirement is missing from the list too. Additionally, please update
autogen.shpython usage in the INSTALL file.There is Python 2.6 or later, not sure if it still works on 2.6 (which is EOL) or it requires now 2.7).
I think we should update this requirement to "Python 3.0.0 or later".
I'll just note Python 3, because 1) IMHO it would not work on 3.0, first reasonable python 3 version which allowed 2 and 3 reasonably easily coexist together was IMHO 3.3, 2) no distro uses 3.0, they either use match higher 3 version (3.6 at least) or 2.7 (or 2.6 the oldest ones).
Quoted 8 lines
Quoted 3 lines
Also "If you use a development snapshot or want to hack on GRUB you may need the following." is obsolete (from 2009), I'll move python, autoconf and automake to the list on the top.
OK...
There is also:
Quoted 7 lines
3. Type `./bootstrap'.
*
autogen.sh(called by bootstrap) uses python. By default the invocation is "python", but it can be overridden by setting the variable $PYTHON.I think this should be updated too.
+1.
Kind regards,
Petr
Re: [PATCH 2/2] autogen.sh: Detect python
In reply to Daniel KiperHi Daniel,
sorry for longer time to reply (vacation).
Quoted 6 lines · Petr Vorel
Quoted 5 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
command -v is supported in other common shells (busybox sh and dash), I'll add it to the commit message.
IMHO it's non-POSIX extension, but because it's support we use it in LTP shell API, where we expect very minimal shell tools (i.e. no bash, no core utils).
Quoted 2 lines
It looks the bash dependency is not specified in the INSTALL file in "The Requirements" section. May I ask you to add it?
Due previous and the fact shebang in various scripts (bootstrap, geninit.sh, docs/mdate-sh, grub-core/genemuinit.sh, ...) is /bin/sh and checkbashisms does not complain it would be wrong to list bash as a dependency. IMHO Debian build tools which use dash do not need any special patch (Colin Watson would know), also Alpine which uses busybox sh does need any patch either.
Quoted 15 lines
Quoted 14 lines
Keep the possibility to define PYTHON.
Signed-off-by Petr Vorel <[email protected]>--- autogen.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)autogen.sh +0
-0@@ -7,8 +7,21 @@ if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then exit 1 fi
Quoted 8 lines
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 12
Quoted 5 lines
autogen.sh +3
-2-# Set ${PYTHON} to plain 'python' if not set already -: ${PYTHON:=python} +# Detect python +if [ -z "$PYTHON" ]; then + for i in python python3 python2; doMay I ask you to use (multiple of) 2 space indention as it is done in most of this file?
Sure, sorry to overlook it.
Quoted 3 lines
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 13
Quoted 1 line
autogen.sh +1
-0+ if command -v "$i" > /dev/null 2>&1; thenDitto and below please...
Sure.
Quoted 4 lines
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 15
Quoted 2 lines
autogen.sh +2
-0+ PYTHON="$i" + echo "Using $PYTHON" >&2Please drop ">&2" redirection here.
IMHO there is no useful value for user to see "python not found", but no problem to drop it.
Quoted 1 line
And I think it should be "Using $PYTHON...".
Sure.
Quoted 8 lines
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 21
Quoted 6 lines
autogen.sh +6
-0+ break + fi + done + + if [ -z "$PYTHON" ]; then + echo "python not found" >&2s/found/found./
Sure.
Kind regards,
Petr
Quoted 5 lines
autogen.sh if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then · line 24
Quoted 3 lines
autogen.sh +3
-0+ exit 1 + fi +fiDaniel
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 8 lines
Hi Daniel,
sorry for longer time to reply (vacation).
Quoted 3 lines · Petr Vorel
Quoted 2 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not found
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Using bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
command -v is supported in other common shells (busybox sh and dash), I'll add it to the commit message.
IMHO it's non-POSIX extension, but because it's support we use it in LTP shell API, where we expect very minimal shell tools (i.e. no bash, no core utils).
Actually "command -v" [1] and "type" [2] are POSIX.
Kind regards,
Petr
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 8 lines · Petr Vorel
Quoted 7 lines
Hi Daniel,
sorry for longer time to reply (vacation).
Quoted 3 lines · Petr Vorel
Quoted 2 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not found
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Using bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
command -v is supported in other common shells (busybox sh and dash), I'll add it to the commit message.
IMHO it's non-POSIX extension, but because it's support we use it in LTP shell API, where we expect very minimal shell tools (i.e. no bash, no core utils).Actually "command -v" [1] and "type" [2] are POSIX.
OK, then ignore my comment WRT adding bash to the requirements into the INSTALL file.
Daniel
Re: [PATCH 2/2] autogen.sh: Detect python
In reply to Petr VorelPersonally I would just change it to "set PYTHON to python3 if not set" and that's it.
Python2 is irrelevant.
Quoted 50 lines · On Fri, 6 Aug 2021, 07:45 Petr Vorel, <[email protected]> wrote:
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUsing bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers).
Keep the possibility to define PYTHON.
Signed-off-by Petr Vorel <[email protected]>--- autogen.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)autogen.sh +15
-3@@ -7,8 +7,21 @@ if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then exit 1 fi -# Set ${PYTHON} to plain 'python' if not set already -: ${PYTHON:=python} +# Detect python +if [ -z "$PYTHON" ]; then + for i in python python3 python2; do + if command -v "$i" > /dev/null 2>&1; then + PYTHON="$i" + echo "Using $PYTHON" >&2 + break + fi + done + + if [ -z "$PYTHON" ]; then + echo "python not found" >&2 + exit 1 + fi +fi export LC_COLLATE=C unset LC_ALL --2.32.0
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH 2/2] autogen.sh: Detect python
Hi,
Quoted 2 lines
Personally I would just change it to "set PYTHON to python3 if not set" and that's it.
Why bothering user to set environment variable when autodetection is possible?
Quoted 1 line
Python2 is irrelevant.
Fair enough for me to drop python 2 from autodetection. There probably aren't many people who would like to use new grub in old distros. But again, when the support is there, why to drop it?
Kind regards,
Petr
Re: [PATCH 2/2] autogen.sh: Detect python
Quoted 11 lines · Petr Vorel
Hi,
Quoted 2 lines
Personally I would just change it to "set PYTHON to python3 if not set" and that's it.
Why bothering user to set environment variable when autodetection is possible?
Quoted 1 line
Python2 is irrelevant.
Fair enough for me to drop python 2 from autodetection. There probably aren't many people who would like to use new grub in old distros. But again, when the support is there, why to drop it?
10 year old distributions have python3.
--
Regards,
Dimitri.
Quoted 6 lines · Petr Vorel
bootstrap.conf uses patch, let's require it.
Better than multiple messages:
./bootstrap.conf: line 84: patch: command not foundSigned-off-by Petr Vorel <[email protected]>
Daniel