* [PATCH v2 1/2] bootstrap: INSTALL: Require GNU patch
@ 2021-08-30 9:53 Petr Vorel
2021-08-30 9:53 ` [PATCH v2 2/2] autogen.sh: Detect python Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-08-30 9:53 UTC (permalink / raw)
To: grub-devel; +Cc: Petr Vorel, Daniel Kiper
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.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* mention patch in INSTALL
INSTALL | 1 +
bootstrap.conf | 1 +
2 files changed, 2 insertions(+)
diff --git a/INSTALL b/INSTALL
index 79a0af7d9..3270743b7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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)
diff --git a/bootstrap.conf b/bootstrap.conf
index 6b043fc35..0dd893c5c 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -70,6 +70,7 @@ autoconf 2.63
automake 1.11
gettext 0.18.3
git 1.5.5
+patch -
tar -
"
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] autogen.sh: Detect python
2021-08-30 9:53 [PATCH v2 1/2] bootstrap: INSTALL: Require GNU patch Petr Vorel
@ 2021-08-30 9:53 ` Petr Vorel
2021-08-31 18:13 ` Daniel Kiper
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-08-30 9:53 UTC (permalink / raw)
To: grub-devel; +Cc: Petr Vorel, Daniel Kiper
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.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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(-)
diff --git a/INSTALL b/INSTALL
index 3270743b7..bf7695e21 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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
diff --git a/autogen.sh b/autogen.sh
index 31b0ced7e..81df21816 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -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
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] autogen.sh: Detect python
2021-08-30 9:53 ` [PATCH v2 2/2] autogen.sh: Detect python Petr Vorel
@ 2021-08-31 18:13 ` Daniel Kiper
2021-09-03 10:49 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2021-08-31 18:13 UTC (permalink / raw)
To: Petr Vorel; +Cc: grub-devel
On Mon, Aug 30, 2021 at 11:53:17AM +0200, Petr Vorel wrote:
> 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.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
I think you missed some minor requests from previous review. I can fix
them before committing. Anyway, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
for both patches...
Thank you for fixing these issues.
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] autogen.sh: Detect python
2021-08-31 18:13 ` Daniel Kiper
@ 2021-09-03 10:49 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2021-09-03 10:49 UTC (permalink / raw)
To: daniel.kiper; +Cc: grub-devel
Hi Daniel,
> On Mon, Aug 30, 2021 at 11:53:17AM +0200, Petr Vorel wrote:
> > 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.
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> I think you missed some minor requests from previous review. I can fix
> them before committing. Anyway, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> for both patches...
Not sure what I left, but sure, feel free to further tweak it before merge.
Kind regards,
Petr
> Thank you for fixing these issues.
> Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-03 10:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-30 9:53 [PATCH v2 1/2] bootstrap: INSTALL: Require GNU patch Petr Vorel
2021-08-30 9:53 ` [PATCH v2 2/2] autogen.sh: Detect python Petr Vorel
2021-08-31 18:13 ` Daniel Kiper
2021-09-03 10:49 ` Petr Vorel
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.