Skip to contentSkip to conversation

perl-native: fixed bad interpreter error

PATCH New Robert Yang 1 participant 3 messages Aug 28, 2014

lore
Share & tools
lore
#0 lore raw

cover perl-native: fixed bad interpreter error

The following changes since commit d0be4b37743492fc9c178fd6f9ef73a5eb2fd9c3:

chrpath: Drop warning from darwn builds (2014-08-17 10:01:30 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/perl
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/perl

Robert Yang (2):
perl-native: fixed bad interpreter error
cpan.bbclass: matches more lines

 meta/classes/cpan.bbclass                        |    4 ++--
 meta/recipes-devtools/perl/perl-native_5.20.0.bb |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 perl-native: fixed bad interpreter error

We may get the error on some hosts when build in deeper dir:
/bin/sh: /path/to/tmp/sysroots/i686-linux/usr/bin/perl-native/pod2man: /path/to/tmp/sysroots/i686-li:
bad interpreter: No such file or directory

Note the "i686-li", it should be "i686-linux", but is truncated by the host.

We can use "/usr/bin/env nativeperl" as we have done in cpan.bbclass for other recipe's perl script to fix the problem.

---
 meta/recipes-devtools/perl/perl-native_5.20.0.bb |    5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/perl/perl-native_5.20.0.bb +5 -0
index 4364d41..069696a 100644
@@ -105,6 +105,11 @@ do_install () {
 
 	create_wrapper ${D}${bindir}/perl PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/${PV}:${STAGING_LIBDIR}/perl/'
 	create_wrapper ${D}${bindir}/perl${PV} PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/${PV}:${STAGING_LIBDIR}/perl/'
+
+	# Use /usr/bin/env nativeperl for the perl script.
+	for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do
+		sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f
+	done
 }
 
 SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper"
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 cpan.bbclass: matches more lines

In reply to Robert Yang

Fixed:
- There might be a space between "#!" and "/pat/to/usr/bin/perl", e.g.:
"#! /usr/bin/perl", now also matches it.

- There might be the lines like the following in the body:
eval 'exec /path/to/usr/bin/perl-native/perl -S $0 ${1+"$@"}'

Now we only check "#! */path/to/usr/bin/perl" to make sure it is a perl script, but match and fix the lines in both header and body.

---
 meta/classes/cpan.bbclass |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/cpan.bbclass +2 -2
index 7088039..e2bbd2f 100644
@@ -47,8 +47,8 @@ cpan_do_compile () {
 
 cpan_do_install () {
 	oe_runmake DESTDIR="${D}" install_vendor
-	for PERLSCRIPT in `grep -rIEl '#!${bindir}/perl-native.*/perl' ${D}`; do
-		sed -i -e 's|^#!${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' $PERLSCRIPT
+	for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; do
+		sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env nativeperl|' $PERLSCRIPT
 	done
 }
 
Signature · 1 line
1.7.9.5