utils: create_cmdline_shebang_wrapper whitespace and sed refactor
PATCH v2 1/3 utils: create_cmdline_shebang_wrapper whitespace and sed refactor
Correct whitespace to match the rest of the code in utils. Refactored sed expression with a simpler equivalent.
--- meta/classes/utils.bbclass | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
meta/classes/utils.bbclass +5 -5
@@ -188,7 +188,7 @@ create_cmdline_shebang_wrapper () { # Create a wrapper script where commandline options are needed # # These are useful to work around shebang relocation issues, where shebangs are too - # long or have arguments in them, thus preventing them from using the /usr/bin/env + # long or have arguments in them, thus preventing them from using the /usr/bin/env # shebang # # Usage: create_cmdline_wrapper FILENAME <extra-options>
@@ -198,10 +198,10 @@ create_cmdline_shebang_wrapper () { echo "Generating wrapper script for $cmd" - # Strip #! and get remaining interpreter + arg - argument="$(basename "$(head -n1 $cmd | sed -e 's|#![ ]*||g' )")" - # strip the shebang from the real script as we do not want it to be usable anyway - tail -n +2 $cmd > $cmd.real + # Strip #! and get remaining interpreter + arg + argument="$(sed -ne 's/^#! *//p;q' $cmd)" + # strip the shebang from the real script as we do not want it to be usable anyway + tail -n +2 $cmd > $cmd.real cmdname=$(basename $cmd) dirname=$(dirname $cmd) cmdoptions=$@
Signature · 1 line
2.25.1
PATCH v2 2/3 utils: create_cmdline_shebang_wrapper preserve permission and ownership
The .real command was not given the same permissions and ownership as the original pre-wrap file and this is now fixed.
A situation where the original pre-wrap file did not have write permissions would cause a failure in the wrapping is also fixed.
Test update also included.
--- .../wrapper/cmdline-shebang-wrapper-test.bb | 11 ++++++++++- meta/classes/utils.bbclass | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-)
meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb +10 -1
@@ -8,7 +8,10 @@ SRC_URI += "file://test.awk" EXCLUDE_FROM_WORLD = "1" do_install() { install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/test.awk ${D}${bindir}/test + # was not able to make ownership preservation check + install -m 0400 ${WORKDIR}/test.awk ${D}${bindir}/test + + perm_old="$(stat --format='%a' ${D}${bindir}/test)" sed -i -e 's|@AWK_BIN@|${bindir}/awk|g' ${D}${bindir}/test create_cmdline_shebang_wrapper ${D}${bindir}/test if [ $(${D}${bindir}/test) != "Don't Panic!" ]; then
@@ -16,6 +19,12 @@ do_install() { else bbnote "Wrapper is good" fi + + perm_new="$(stat --format='%a' ${D}${bindir}/test.real)" + + if [ "$perm_new" != "$perm_old" ]; then + bbfatal "Wrapper permissions for ${D}${bindir}/test.real not preserved. Found $perm_new but expected $perm_old" + fi } BBCLASSEXTEND = "native"
meta/classes/utils.bbclass +3 -0
@@ -202,6 +202,9 @@ create_cmdline_shebang_wrapper () { argument="$(sed -ne 's/^#! *//p;q' $cmd)" # strip the shebang from the real script as we do not want it to be usable anyway tail -n +2 $cmd > $cmd.real + chown --reference=$cmd $cmd.real + chmod --reference=$cmd $cmd.real + rm -f $cmd cmdname=$(basename $cmd) dirname=$(dirname $cmd) cmdoptions=$@
Signature · 1 line
2.25.1
PATCH v2 3/3 oeqa/sysroot.py: Check bitbake return status
In reply to Paulo Nevesbitbake ran but we incorrectly did not check the exit status needs to be non 0. Now all sysroot tests commands expected to fail are verified to do so.
--- meta/lib/oeqa/selftest/cases/sysroot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
meta/lib/oeqa/selftest/cases/sysroot.py +6 -5
@@ -43,7 +43,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" Author: Paulo Neves <[email protected]> """ expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]" - res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-shebang-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) def test_sysroot_la(self):
@@ -54,11 +54,11 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" """ expected = "la-test.la failed sanity test (workdir) in path" - res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-la-test -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) self.assertTrue('[la]' in res.output, msg=res.output) - res = bitbake("sysroot-la-test-native -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-la-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) self.assertTrue('[la]' in res.output, msg=res.output)
@@ -70,10 +70,11 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" """ expected = "test.pc failed sanity test (tmpdir) in path" - res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-pc-test -c populate_sysroot") self.assertTrue('[pkgconfig]' in res.output, msg=res.output) self.assertTrue(expected in res.output, msg=res.output) - res = bitbake("sysroot-pc-test-native -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-pc-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) self.assertTrue('[pkgconfig]' in res.output, msg=res.output) + self.assertTrue(res.status != 0)
Signature · 1 line
2.25.1
Re: [OE-core] [PATCH v2 3/3] oeqa/sysroot.py: Check bitbake return status
Quoted 3 lines · Paulo Neves
bitbake ran but we incorrectly did not check the exit status needs to be non 0. Now all sysroot tests commands expected to fail are verified to do so.
This caused a series of failures on the autobuilder:
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3775/steps/15/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3786/steps/14/logs/stdio
(and a couple of others)
Not sure what happened at this point.
Cheers,
Richard