All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [XEN PATCH 0/2] Fix installation of python scripts
@ 2020-03-11 17:59 Anthony PERARD
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap Anthony PERARD
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Anthony PERARD @ 2020-03-11 17:59 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.fix-python-install-v1

Hi,

A patch to make packaging of xen on centos8 easier. rpmbuild
prevents unversions python shebang from been packaged.
And the first patch fix a bug discovered with the second.

Cheers,

Anthony PERARD (2):
  tools/python: Fix install-wrap
  tools: Use INSTALL_PYTHON_PROG

 tools/misc/xencov_split   | 2 +-
 tools/python/Makefile     | 4 ++--
 tools/python/install-wrap | 2 +-
 tools/xenmon/Makefile     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap
  2020-03-11 17:59 [Xen-devel] [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
@ 2020-03-11 17:59 ` Anthony PERARD
  2020-05-19  8:58   ` Wei Liu
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG Anthony PERARD
  2020-05-18 13:15 ` [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
  2 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD @ 2020-03-11 17:59 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

This allows to use install-wrap when the source scripts is in a
subdirectory.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/python/install-wrap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/python/install-wrap b/tools/python/install-wrap
index 00e2014016f9..fef24e01708d 100755
--- a/tools/python/install-wrap
+++ b/tools/python/install-wrap
@@ -44,7 +44,7 @@ shift
 destf="$dest"
 for srcf in ${srcs}; do
 	if test -d "$dest"; then
-		destf="$dest/${srcf%%*/}"
+		destf="$dest/${srcf##*/}"
 	fi
 	org="$(sed -n '2q; /^#! *\/usr\/bin\/env python *$/p' $srcf)"
 	if test "x$org" = x; then
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Xen-devel] [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG
  2020-03-11 17:59 [Xen-devel] [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap Anthony PERARD
@ 2020-03-11 17:59 ` Anthony PERARD
  2020-05-19  8:58   ` Wei Liu
  2020-05-18 13:15 ` [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
  2 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD @ 2020-03-11 17:59 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

Whenever python scripts are install, have the shebang be modified to use
whatever PYTHON_PATH is. This is useful for system where python isn't available, or
where the package build tools prevent unversioned shebang.

INSTALL_PYTHON_PROG only looks for "#!/usr/bin/env python".

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/misc/xencov_split | 2 +-
 tools/python/Makefile   | 4 ++--
 tools/xenmon/Makefile   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xencov_split b/tools/misc/xencov_split
index 1f20518b8637..5771f6cfc285 100755
--- a/tools/misc/xencov_split
+++ b/tools/misc/xencov_split
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 import sys, os, os.path as path, struct, errno
 from optparse import OptionParser
diff --git a/tools/python/Makefile b/tools/python/Makefile
index e99f78a5373a..8d22c0367657 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -20,8 +20,8 @@ install:
 		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
 		--root="$(DESTDIR)" --force
 
-	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PYTHON_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
diff --git a/tools/xenmon/Makefile b/tools/xenmon/Makefile
index e1712304d07d..3e150b065998 100644
--- a/tools/xenmon/Makefile
+++ b/tools/xenmon/Makefile
@@ -32,7 +32,7 @@ install: build
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
 	$(INSTALL_PROG) xenbaked $(DESTDIR)$(sbindir)/xenbaked
 	$(INSTALL_PROG) xentrace_setmask  $(DESTDIR)$(sbindir)/xentrace_setmask
-	$(INSTALL_PROG) xenmon.py  $(DESTDIR)$(sbindir)/xenmon
+	$(INSTALL_PYTHON_PROG) xenmon.py  $(DESTDIR)$(sbindir)/xenmon
 
 .PHONY: uninstall
 uninstall:
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [XEN PATCH 0/2] Fix installation of python scripts
  2020-03-11 17:59 [Xen-devel] [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap Anthony PERARD
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG Anthony PERARD
@ 2020-05-18 13:15 ` Anthony PERARD
  2 siblings, 0 replies; 8+ messages in thread
From: Anthony PERARD @ 2020-05-18 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

Ping?

Cheers.

On Wed, Mar 11, 2020 at 05:59:31PM +0000, Anthony PERARD wrote:
> Patch series available in this git branch:
> https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.fix-python-install-v1
> 
> Hi,
> 
> A patch to make packaging of xen on centos8 easier. rpmbuild
> prevents unversions python shebang from been packaged.
> And the first patch fix a bug discovered with the second.
> 
> Cheers,
> 
> Anthony PERARD (2):
>   tools/python: Fix install-wrap
>   tools: Use INSTALL_PYTHON_PROG
> 
>  tools/misc/xencov_split   | 2 +-
>  tools/python/Makefile     | 4 ++--
>  tools/python/install-wrap | 2 +-
>  tools/xenmon/Makefile     | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [XEN PATCH 1/2] tools/python: Fix install-wrap
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap Anthony PERARD
@ 2020-05-19  8:58   ` Wei Liu
  2020-05-19  9:42     ` Anthony PERARD
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Liu @ 2020-05-19  8:58 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: xen-devel, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

On Wed, Mar 11, 2020 at 05:59:32PM +0000, Anthony PERARD wrote:
> This allows to use install-wrap when the source scripts is in a
> subdirectory.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  tools/python/install-wrap | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/python/install-wrap b/tools/python/install-wrap
> index 00e2014016f9..fef24e01708d 100755
> --- a/tools/python/install-wrap
> +++ b/tools/python/install-wrap
> @@ -44,7 +44,7 @@ shift
>  destf="$dest"
>  for srcf in ${srcs}; do
>  	if test -d "$dest"; then
> -		destf="$dest/${srcf%%*/}"
> +		destf="$dest/${srcf##*/}"

This seems to have changed the pattern from "Remove Largest Suffix" to
"Remove Largest Prefix".

What does it do in practice?

For POSIX sh

x=posix/src/std
echo ${x%%*/} -> posix/src/std
echo ${x##*/} -> std

I would think the former is what you want. But I could be missing
something obvious.

Wei.

>  	fi
>  	org="$(sed -n '2q; /^#! *\/usr\/bin\/env python *$/p' $srcf)"
>  	if test "x$org" = x; then
> -- 
> Anthony PERARD
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG
  2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG Anthony PERARD
@ 2020-05-19  8:58   ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2020-05-19  8:58 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: xen-devel, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

On Wed, Mar 11, 2020 at 05:59:33PM +0000, Anthony PERARD wrote:
> Whenever python scripts are install, have the shebang be modified to use
> whatever PYTHON_PATH is. This is useful for system where python isn't available, or
> where the package build tools prevent unversioned shebang.
> 
> INSTALL_PYTHON_PROG only looks for "#!/usr/bin/env python".
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Wei Liu <wl@xen.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [XEN PATCH 1/2] tools/python: Fix install-wrap
  2020-05-19  8:58   ` Wei Liu
@ 2020-05-19  9:42     ` Anthony PERARD
  2020-05-19 10:06       ` Wei Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD @ 2020-05-19  9:42 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Ian Jackson, Marek Marczykowski-Górecki

On Tue, May 19, 2020 at 09:58:15AM +0100, Wei Liu wrote:
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.
> 
> On Wed, Mar 11, 2020 at 05:59:32PM +0000, Anthony PERARD wrote:
> > This allows to use install-wrap when the source scripts is in a
> > subdirectory.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > ---
> >  tools/python/install-wrap | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/python/install-wrap b/tools/python/install-wrap
> > index 00e2014016f9..fef24e01708d 100755
> > --- a/tools/python/install-wrap
> > +++ b/tools/python/install-wrap
> > @@ -44,7 +44,7 @@ shift
> >  destf="$dest"
> >  for srcf in ${srcs}; do
> >  	if test -d "$dest"; then
> > -		destf="$dest/${srcf%%*/}"
> > +		destf="$dest/${srcf##*/}"
> 
> This seems to have changed the pattern from "Remove Largest Suffix" to
> "Remove Largest Prefix".
> 
> What does it do in practice?
> 
> For POSIX sh
> 
> x=posix/src/std
> echo ${x%%*/} -> posix/src/std
> echo ${x##*/} -> std
> 
> I would think the former is what you want. But I could be missing
> something obvious.

The former is a noop. It's the same as not doing anything.

Unless x="dir/dir/" and in that case, the %% would remove everything,
resulting in an empty string.

$srcf contains the path to where the script which we want to install is,
which is a relative path from where the ./install-wrap is executed from.
$destf is the final destination of the script, but if $dest is a
directory, then ./install-wrap wants to install the script in $dest, not
in some sub-directory of it. ./install-wrap doesn't handle this
sub-directory it fails to execute when there is one. (It's probably the
$install that failed to copy $srcf in a non-existing directory.)

This from the next patch is probably where things fails
    $(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [XEN PATCH 1/2] tools/python: Fix install-wrap
  2020-05-19  9:42     ` Anthony PERARD
@ 2020-05-19 10:06       ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2020-05-19 10:06 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: xen-devel, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu

On Tue, May 19, 2020 at 10:42:22AM +0100, Anthony PERARD wrote:
> On Tue, May 19, 2020 at 09:58:15AM +0100, Wei Liu wrote:
> > [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.
> > 

Haha :-)

> > On Wed, Mar 11, 2020 at 05:59:32PM +0000, Anthony PERARD wrote:
> > > This allows to use install-wrap when the source scripts is in a
> > > subdirectory.
> > > 
> > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > > ---
> > >  tools/python/install-wrap | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/python/install-wrap b/tools/python/install-wrap
> > > index 00e2014016f9..fef24e01708d 100755
> > > --- a/tools/python/install-wrap
> > > +++ b/tools/python/install-wrap
> > > @@ -44,7 +44,7 @@ shift
> > >  destf="$dest"
> > >  for srcf in ${srcs}; do
> > >  	if test -d "$dest"; then
> > > -		destf="$dest/${srcf%%*/}"
> > > +		destf="$dest/${srcf##*/}"
> > 
> > This seems to have changed the pattern from "Remove Largest Suffix" to
> > "Remove Largest Prefix".
> > 
> > What does it do in practice?
> > 
> > For POSIX sh
> > 
> > x=posix/src/std
> > echo ${x%%*/} -> posix/src/std
> > echo ${x##*/} -> std
> > 
> > I would think the former is what you want. But I could be missing
> > something obvious.
> 
> The former is a noop. It's the same as not doing anything.
> 
> Unless x="dir/dir/" and in that case, the %% would remove everything,
> resulting in an empty string.
> 
> $srcf contains the path to where the script which we want to install is,
> which is a relative path from where the ./install-wrap is executed from.
> $destf is the final destination of the script, but if $dest is a
> directory, then ./install-wrap wants to install the script in $dest, not
> in some sub-directory of it. ./install-wrap doesn't handle this
> sub-directory it fails to execute when there is one. (It's probably the
> $install that failed to copy $srcf in a non-existing directory.)
> 
> This from the next patch is probably where things fails
>     $(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)

I see. Thanks for explaining.

Acked-by: Wei Liu <wl@xen.org>

> 
> -- 
> Anthony PERARD


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-19 10:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 17:59 [Xen-devel] [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD
2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 1/2] tools/python: Fix install-wrap Anthony PERARD
2020-05-19  8:58   ` Wei Liu
2020-05-19  9:42     ` Anthony PERARD
2020-05-19 10:06       ` Wei Liu
2020-03-11 17:59 ` [Xen-devel] [XEN PATCH 2/2] tools: Use INSTALL_PYTHON_PROG Anthony PERARD
2020-05-19  8:58   ` Wei Liu
2020-05-18 13:15 ` [XEN PATCH 0/2] Fix installation of python scripts Anthony PERARD

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.