bootstrap: INSTALL: Require GNU patch
PATCH v2 1/2 bootstrap: INSTALL: Require GNU patch
bootstrap.conf uses patch, let's require it.
Better than multiple messages:
./bootstrap.conf: line 84: patch: command not found
Mention it also in INSTALL.
---
Changes v1->v2:
* mention patch in INSTALL
INSTALL | 1 + bootstrap.conf | 1 + 2 files changed, 2 insertions(+)
INSTALL +1 -0
@@ -20,6 +20,7 @@ configuring the GRUB. * GNU binutils 2.9.1.0.23 or later * Flex 2.5.35 or later * pkg-config +* GNU patch * Other standard GNU/Unix tools * a libc with large file support (e.g. glibc 2.1 or later)
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.33.0
PATCH v2 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
Use python3 as the default as python2 is EOL since Jan 2020, but check also python which is on most distros if not all python2 because code still works on python2.
Although it should not be needed keep the possibility to define PYTHON.
For detection use "command -v" which is POSIX [3] and supported on all common shells (bash, zsh, dash, busybox sh, mksh) instead requiring "which" as extra dependency (usable on containers).
Update INSTALL.
---
Changes v1->v2:
* update INSTALL (Require python 3, but still note python 2.6)
NOTE: 2.6 is dead most people who still use python 2 use python 2.7, but I suggest to keep it ()
* drop python2
INSTALL | 7 +++---- autogen.sh | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-)
INSTALL +3 -4
@@ -42,7 +42,7 @@ To build GRUB's graphical terminal (gfxterm), you need: If you use a development snapshot or want to hack on GRUB you may need the following. -* Python 2.6 or later +* Python 3 (NOTE: python 2.6 should still work, but it's not tested) * Autoconf 2.63 or later * Automake 1.11 or later
@@ -87,9 +87,8 @@ The simplest way to compile this package is: 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. + * autogen.sh (called by bootstrap) uses python. By default autodetect + it, but it can be overridden by setting the $PYTHON variable. 4. Type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might
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 python3 python; 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.33.0
Re: [PATCH v2 2/2] autogen.sh: Detect python
Quoted 9 lines · Petr Vorel
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUse python3 as the default as python2 is EOL since Jan 2020, but check also python which is on most distros if not all python2 because code still works on python2.
Although it should not be needed keep the possibility to define PYTHON.
Quoted 7 lines
For detection use "command -v" which is POSIX [3] and supported on all common shells (bash, zsh, dash, busybox sh, mksh) instead requiring "which" as extra dependency (usable on containers).
Update INSTALL.
Signed-off-by Petr Vorel <[email protected]>
I think you missed some minor requests from previous review. I can fix them before committing. Anyway, Reviewed-by: Daniel Kiper <[email protected]> for both patches...
Thank you for fixing these issues.
Daniel
Re: [PATCH v2 2/2] autogen.sh: Detect python
Hi Daniel,
Quoted 14 lines · Petr Vorel
Quoted 12 lines
It help to avoid error on distros which has only python3 binary:
./autogen.sh: line 20: python: command not foundUse python3 as the default as python2 is EOL since Jan 2020, but check also python which is on most distros if not all python2 because code still works on python2.
Although it should not be needed keep the possibility to define PYTHON.
For detection use "command -v" which is POSIX [3] and supported on all common shells (bash, zsh, dash, busybox sh, mksh) instead requiring "which" as extra dependency (usable on containers).
Quoted 7 lines
Quoted 3 lines
Update INSTALL.
Signed-off-by Petr Vorel <[email protected]>I think you missed some minor requests from previous review. I can fix them before committing. Anyway, Reviewed-by: Daniel Kiper <[email protected]> for both patches...
Not sure what I left, but sure, feel free to further tweak it before merge.
Kind regards,
Petr
Quoted 3 lines
Thank you for fixing these issues.
Daniel