Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] lttng-ust: Patch python shebang appropriately for native builds
@ 2016-12-14 21:38 Phil Blundell
  2016-12-14 23:38 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Blundell @ 2016-12-14 21:38 UTC (permalink / raw)
  To: openembedded-core

If we are building a native package then ${bindir}/python3 is not guaranteed
to be available, and if it is available then it is probably a directory not a
file.  In either case, attempting to use it as an interpreter will not end
well.  Let's use ${bindir}/nativepython instead.

Signed-off-by: Phil Blundell <philb@gnu.org>
---
 meta/recipes-kernel/lttng/lttng-ust_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/lttng/lttng-ust_git.bb b/meta/recipes-kernel/lttng/lttng-ust_git.bb
index 5869093..df22352 100644
--- a/meta/recipes-kernel/lttng/lttng-ust_git.bb
+++ b/meta/recipes-kernel/lttng/lttng-ust_git.bb
@@ -29,10 +29,12 @@ SRC_URI = "git://git.lttng.org/lttng-ust.git;branch=stable-2.7 \
 
 PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
 
+usepython="${bindir}/python3"
+usepython_class-native="${bindir}/nativepython"
 do_install_append() {
         # Patch python tools to use Python 3; they should be source compatible, but
         # still refer to Python 2 in the shebang
-        sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp
+        sed -i -e '1s,#!.*python.*,#!${usepython},' ${D}${bindir}/lttng-gen-tp
 }
 
 S = "${WORKDIR}/git"
-- 
2.10.1


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

* Re: [PATCH] lttng-ust: Patch python shebang appropriately for native builds
  2016-12-14 21:38 [PATCH] lttng-ust: Patch python shebang appropriately for native builds Phil Blundell
@ 2016-12-14 23:38 ` Khem Raj
  2016-12-15  8:43   ` Burton, Ross
  2016-12-15 12:11   ` Phil Blundell
  0 siblings, 2 replies; 4+ messages in thread
From: Khem Raj @ 2016-12-14 23:38 UTC (permalink / raw)
  To: Phil Blundell; +Cc: Patches and discussions about the oe-core layer

On Wed, Dec 14, 2016 at 1:38 PM, Phil Blundell <pb@pbcl.net> wrote:
> If we are building a native package then ${bindir}/python3 is not guaranteed
> to be available, and if it is available then it is probably a directory not a
> file.  In either case, attempting to use it as an interpreter will not end
> well.  Let's use ${bindir}/nativepython instead.
>
> Signed-off-by: Phil Blundell <philb@gnu.org>
> ---
>  meta/recipes-kernel/lttng/lttng-ust_git.bb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-kernel/lttng/lttng-ust_git.bb b/meta/recipes-kernel/lttng/lttng-ust_git.bb
> index 5869093..df22352 100644
> --- a/meta/recipes-kernel/lttng/lttng-ust_git.bb
> +++ b/meta/recipes-kernel/lttng/lttng-ust_git.bb
> @@ -29,10 +29,12 @@ SRC_URI = "git://git.lttng.org/lttng-ust.git;branch=stable-2.7 \
>
>  PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
>
> +usepython="${bindir}/python3"
> +usepython_class-native="${bindir}/nativepython"
>  do_install_append() {
>          # Patch python tools to use Python 3; they should be source compatible, but
>          # still refer to Python 2 in the shebang
> -        sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp
> +        sed -i -e '1s,#!.*python.*,#!${usepython},' ${D}${bindir}/lttng-gen-tp

This also means we need to add a dependency on python-native may be it
should inherit the python native class.

>  }
>
>  S = "${WORKDIR}/git"
> --
> 2.10.1
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH] lttng-ust: Patch python shebang appropriately for native builds
  2016-12-14 23:38 ` Khem Raj
@ 2016-12-15  8:43   ` Burton, Ross
  2016-12-15 12:11   ` Phil Blundell
  1 sibling, 0 replies; 4+ messages in thread
From: Burton, Ross @ 2016-12-15  8:43 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

On 14 December 2016 at 23:38, Khem Raj <raj.khem@gmail.com> wrote:

> This also means we need to add a dependency on python-native may be it
> should inherit the python native class.
>

Indeed.  For python-native, '#! /usr/bin/env python3' will always work as
that should find the Python that bitbake is running in.

Ross

[-- Attachment #2: Type: text/html, Size: 818 bytes --]

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

* Re: [PATCH] lttng-ust: Patch python shebang appropriately for native builds
  2016-12-14 23:38 ` Khem Raj
  2016-12-15  8:43   ` Burton, Ross
@ 2016-12-15 12:11   ` Phil Blundell
  1 sibling, 0 replies; 4+ messages in thread
From: Phil Blundell @ 2016-12-15 12:11 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On Wed, 2016-12-14 at 15:38 -0800, Khem Raj wrote:
> On Wed, Dec 14, 2016 at 1:38 PM, Phil Blundell <pb@pbcl.net> wrote:
> > If we are building a native package then ${bindir}/python3 is not
> > guaranteed
> > to be available, and if it is available then it is probably a
> > directory not a
> > file.  In either case, attempting to use it as an interpreter will
> > not end
> > well.  Let's use ${bindir}/nativepython instead.
> > 
> > Signed-off-by: Phil Blundell <philb@gnu.org>
> > ---
> >  meta/recipes-kernel/lttng/lttng-ust_git.bb | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-kernel/lttng/lttng-ust_git.bb
> > b/meta/recipes-kernel/lttng/lttng-ust_git.bb
> > index 5869093..df22352 100644
> > --- a/meta/recipes-kernel/lttng/lttng-ust_git.bb
> > +++ b/meta/recipes-kernel/lttng/lttng-ust_git.bb
> > @@ -29,10 +29,12 @@ SRC_URI = "git://git.lttng.org/lttng-
> > ust.git;branch=stable-2.7 \
> > 
> >  PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-
> > pages, asciidoc-native xmlto-native libxslt-native"
> > 
> > +usepython="${bindir}/python3"
> > +usepython_class-native="${bindir}/nativepython"
> >  do_install_append() {
> >          # Patch python tools to use Python 3; they should be
> > source compatible, but
> >          # still refer to Python 2 in the shebang
> > -        sed -i -e '1s,#!.*python.*,#!${bindir}/python3,'
> > ${D}${bindir}/lttng-gen-tp
> > +        sed -i -e '1s,#!.*python.*,#!${usepython},'
> > ${D}${bindir}/lttng-gen-tp
> 
> This also means we need to add a dependency on python-native may be
> it
> should inherit the python native class.

I suppose it probably should.  That'd be a bit suboptimal in the sense
that the non-native version does not need to depend on python-native,
but given that python-native is probably installed in the sysroot
anyway I don't suppose it is likely to hurt very much.  And I don't
think it is worth the complexity of trying to do a conditional inherit
of pythonnative.

p.



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

end of thread, other threads:[~2016-12-15 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 21:38 [PATCH] lttng-ust: Patch python shebang appropriately for native builds Phil Blundell
2016-12-14 23:38 ` Khem Raj
2016-12-15  8:43   ` Burton, Ross
2016-12-15 12:11   ` Phil Blundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox