Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters
@ 2013-06-12 16:49 Ross Burton
  2013-06-12 16:49 ` [PATCH 1/4] dpkg: drop the usage of create_wrapper Ross Burton
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ross Burton @ 2013-06-12 16:49 UTC (permalink / raw)
  To: openembedded-core

Hi,

create_wrapper was previously abused to invoke the Python/Perl interpretters
directly instead of relying on #! parsing, which is read into a 128 byte buffer
so breaks with deep build directories.

The new create_wrapper is stricter about it's input so this trick doesn't work
anymore.  Luckily there's already a "nativeperl" binary in the sysroot's
/usr/bin, so by adding a "nativepython" alongside it[1] recipes that used
create_wrapper can be changed to munge the #! line to e.g. /usr/bin/env
nativeperl.

(this series obsoletes 3 of the patches that Saul sent earlier involve
create_wrapper)

Ross

[1] The existing nativeperl is a wrapper, the new nativepython is a
symlink. Both seem to work and I can't see a good reason for a wrapper instead
of a relative symlink.

The following changes since commit b87429fdb45f82ebe4060fea8c4ecd6e4bc1ae52:

  bitbake: Add missing file that went out of sync (2013-06-12 13:13:21 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ross/wrap

for you to fetch changes up to 8237763ebcc3cfe4388690056a7c0fed8d65a6c2:

  gnome-doc-utils: drop the usage of create_wrapper (2013-06-12 17:44:39 +0100)

----------------------------------------------------------------
Ross Burton (4):
      dpkg: drop the usage of create_wrapper
      python-native: add nativepython symlink
      createrepo: drop the usage of create_wrapper
      gnome-doc-utils: drop the usage of create_wrapper

 meta/recipes-devtools/dpkg/dpkg.inc                  |   10 +---------
 meta/recipes-devtools/python/python-native_2.7.3.bb  |    6 ++++++
 meta/recipes-gnome/gnome/gnome-doc-utils.inc         |    2 +-
 meta/recipes-support/createrepo/createrepo_0.4.11.bb |    2 +-
 4 files changed, 9 insertions(+), 11 deletions(-)

Ross Burton (4):
  dpkg: drop the usage of create_wrapper
  python-native: add nativepython symlink
  createrepo: drop the usage of create_wrapper
  gnome-doc-utils: drop the usage of create_wrapper

 meta/recipes-devtools/dpkg/dpkg.inc                  |   10 +---------
 meta/recipes-devtools/python/python-native_2.7.3.bb  |    6 ++++++
 meta/recipes-gnome/gnome/gnome-doc-utils.inc         |    2 +-
 meta/recipes-support/createrepo/createrepo_0.4.11.bb |    2 +-
 4 files changed, 9 insertions(+), 11 deletions(-)

-- 
1.7.10.4



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

* [PATCH 1/4] dpkg: drop the usage of create_wrapper
  2013-06-12 16:49 [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters Ross Burton
@ 2013-06-12 16:49 ` Ross Burton
  2013-06-12 16:49 ` [PATCH 2/4] python-native: add nativepython symlink Ross Burton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2013-06-12 16:49 UTC (permalink / raw)
  To: openembedded-core

create_wrapper was previously abused to invoke the Perl interpretter directly
instead of relying on #! parsing, which is read into a 128 byte buffer so breaks
with deep build directories.

However we already install a "nativeperl" binary into the native sysroot, so
use sed to change the #! line to /usr/bin/env nativeperl.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-devtools/dpkg/dpkg.inc |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
index 28c4f89..b9d4da1 100644
--- a/meta/recipes-devtools/dpkg/dpkg.inc
+++ b/meta/recipes-devtools/dpkg/dpkg.inc
@@ -45,21 +45,13 @@ do_install_append () {
 	if [ "${PN}" = "dpkg-native" ]; then
 		# update-alternatives doesn't have an offline mode
 		rm ${D}${bindir}/update-alternatives
+		sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' ${D}${bindir}/dpkg-*
 	else
 		mv ${D}${bindir}/update-alternatives ${D}${sbindir}
 		sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/dpkg-*
 	fi
 }
 
-# Create a wrapper for the perl script to avoid the "bad interpreter"
-# error when the tmpdir is longer than 150.
-do_install_append_class-native () {
-	tmp=`find ${D}${bindir} -type f -exec grep -m 1 -l '#!/.*/perl-native/perl' {} \;`
-	for i in $tmp; do
-		create_wrapper $i ${STAGING_BINDIR_NATIVE}/perl-native/perl
-	done
-}
-
 pkg_postinst_${PN} () {
 #!/bin/sh
 if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then
-- 
1.7.10.4



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

* [PATCH 2/4] python-native: add nativepython symlink
  2013-06-12 16:49 [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters Ross Burton
  2013-06-12 16:49 ` [PATCH 1/4] dpkg: drop the usage of create_wrapper Ross Burton
@ 2013-06-12 16:49 ` Ross Burton
  2013-06-12 16:49 ` [PATCH 3/4] createrepo: drop the usage of create_wrapper Ross Burton
  2013-06-12 16:49 ` [PATCH 4/4] gnome-doc-utils: " Ross Burton
  3 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2013-06-12 16:49 UTC (permalink / raw)
  To: openembedded-core

Add a symlink to the native Python so that scripts can just invoke
"nativepython" and get the right one without needing absolute paths (these often
end up too long for the #! parser in the kernel as the buffer is 128 bytes
long).

The name "nativepython" was chosen to match the existing "nativeperl" which
serves the same purpose.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-devtools/python/python-native_2.7.3.bb |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/recipes-devtools/python/python-native_2.7.3.bb b/meta/recipes-devtools/python/python-native_2.7.3.bb
index 722d92c..39d53bb 100644
--- a/meta/recipes-devtools/python/python-native_2.7.3.bb
+++ b/meta/recipes-devtools/python/python-native_2.7.3.bb
@@ -48,4 +48,10 @@ do_install() {
 	for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
 		sed -i -e '1s|^#!.*|#!/usr/bin/env python|' $PYTHSCRIPT
 	done
+
+	# Add a symlink to the native Python so that scripts can just invoke
+	# "nativepython" and get the right one without needing absolute paths
+	# (these often end up too long for the #! parser in the kernel as the
+	# buffer is 128 bytes long).
+	ln -s python-native/python ${D}${bindir}/nativepython
 }
-- 
1.7.10.4



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

* [PATCH 3/4] createrepo: drop the usage of create_wrapper
  2013-06-12 16:49 [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters Ross Burton
  2013-06-12 16:49 ` [PATCH 1/4] dpkg: drop the usage of create_wrapper Ross Burton
  2013-06-12 16:49 ` [PATCH 2/4] python-native: add nativepython symlink Ross Burton
@ 2013-06-12 16:49 ` Ross Burton
  2013-06-12 16:49 ` [PATCH 4/4] gnome-doc-utils: " Ross Burton
  3 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2013-06-12 16:49 UTC (permalink / raw)
  To: openembedded-core

create_wrapper was previously abused to invoke the Python interpretter directly
instead of relying on #! parsing, which is read into a 128 byte buffer so breaks
with deep build directories.

However now that we already install a "nativepython" binary into the native
sysroot, use sed to change the #! line to /usr/bin/env nativepython.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-support/createrepo/createrepo_0.4.11.bb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-support/createrepo/createrepo_0.4.11.bb b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
index c977c2e..523d31b 100644
--- a/meta/recipes-support/createrepo/createrepo_0.4.11.bb
+++ b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
@@ -35,7 +35,7 @@ do_install_append_class-native () {
 	for i in ${D}${datadir}/createrepo/genpkgmetadata.py \
 		 ${D}${datadir}/createrepo/modifyrepo.py \
 		 ${D}${bindir}/rpm-createsolvedb.py ; do
-		create_wrapper $i ${STAGING_BINDIR_NATIVE}/python-native/python
+		sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i
 	done
 
 	create_wrapper ${D}/${bindir}/createrepo \
-- 
1.7.10.4



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

* [PATCH 4/4] gnome-doc-utils: drop the usage of create_wrapper
  2013-06-12 16:49 [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters Ross Burton
                   ` (2 preceding siblings ...)
  2013-06-12 16:49 ` [PATCH 3/4] createrepo: drop the usage of create_wrapper Ross Burton
@ 2013-06-12 16:49 ` Ross Burton
  3 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2013-06-12 16:49 UTC (permalink / raw)
  To: openembedded-core

create_wrapper was previously abused to invoke the Python interpretter directly
instead of relying on #! parsing, which is read into a 128 byte buffer so breaks
with deep build directories.

However now that we already install a "nativepython" binary into the native
sysroot, use sed to change the #! line to /usr/bin/env nativepython.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-gnome/gnome/gnome-doc-utils.inc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-gnome/gnome/gnome-doc-utils.inc b/meta/recipes-gnome/gnome/gnome-doc-utils.inc
index 9d243a1..b0433ad 100644
--- a/meta/recipes-gnome/gnome/gnome-doc-utils.inc
+++ b/meta/recipes-gnome/gnome/gnome-doc-utils.inc
@@ -20,7 +20,7 @@ do_install_append() {
 }
 
 do_install_append_class-native () {
-	create_wrapper ${D}${bindir}/xml2po ${STAGING_BINDIR_NATIVE}/python-native/python
+	sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' ${D}${bindir}/xml2po
 }
 
 FILES_${PN} += "${datadir}/xml* ${PYTHON_SITEPACKAGES_DIR}/*"
-- 
1.7.10.4



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

end of thread, other threads:[~2013-06-12 16:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 16:49 [PATCH 0/4] Don't use create_wrapper to short-circuit interpretters Ross Burton
2013-06-12 16:49 ` [PATCH 1/4] dpkg: drop the usage of create_wrapper Ross Burton
2013-06-12 16:49 ` [PATCH 2/4] python-native: add nativepython symlink Ross Burton
2013-06-12 16:49 ` [PATCH 3/4] createrepo: drop the usage of create_wrapper Ross Burton
2013-06-12 16:49 ` [PATCH 4/4] gnome-doc-utils: " Ross Burton

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