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
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
>
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
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
© 2016 - 2026 Red Hat, Inc.