diff mbox series

[1/2] pygrub: fix python3 cross-compile: install with INSTALL_PYTHON_PROG

Message ID 20200210043516.1996-2-christopher.w.clark@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] pygrub: fix python3 cross-compile: install with INSTALL_PYTHON_PROG | expand

Commit Message

Christopher Clark Feb. 10, 2020, 4:35 a.m. UTC
Install pygrub with INSTALL_PYTHON_PROG, as per the other Xen python
executables, to ensure that the hashbang path to the interpreter
is written correctly in cross-compile builds, eg. with OpenEmbedded.

Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
---
 tools/pygrub/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ian Jackson Feb. 10, 2020, 4:16 p.m. UTC | #1
Christopher Clark writes ("[PATCH 1/2] pygrub: fix python3 cross-compile: install with INSTALL_PYTHON_PROG"):
> Install pygrub with INSTALL_PYTHON_PROG, as per the other Xen python
> executables, to ensure that the hashbang path to the interpreter
> is written correctly in cross-compile builds, eg. with OpenEmbedded.

Hrm.  There is definitely a bug here and I think
tools/python/install-wrap needs to be called.

What I don't understand is...

> diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
> index 3063c4998f..b4f6f10ddd 100644
> --- a/tools/pygrub/Makefile
> +++ b/tools/pygrub/Makefile
> @@ -18,6 +18,8 @@ install: all
>  	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
>  		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
>  		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
> +	rm -f $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
> +	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
>  	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
>  	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
>  	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \

... why this is the right approach in tools/pygrub when it is *not*
the approach used in tools/python, where install-wrap lives, and which
is the other directory which has a setup.py.

tools/python seems to use $(INSTALL_PROG) and not have anything in
`scripts' in setup.py.  Is that wrong, too ?

Perhaps instead of the rm, pygrub/setup.py should lose the line
      scripts = ["src/pygrub"],
?

Or is there maybe a way to get setup.py to use a different `install' ?

Thanks,
Ian.
diff mbox series

Patch

diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index 3063c4998f..b4f6f10ddd 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -18,6 +18,8 @@  install: all
 	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
 		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
 		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
+	rm -f $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
+	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
 	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \