Skip to contentSkip to conversation

bin_package: fail if ${S} doesn't actually contain anything

PATCH In review Ross Burton 2 participants 2 messages Nov 21, 2017 – Nov 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bin_package: fail if ${S} doesn't actually contain anything

If the user is trying to use bin_package but the SRC_URI hasn't extracted anything into ${S}, which is easily done when writing a recipe by hand, instead of silently shippping an empty package abort the build.

---
 meta/classes/bin_package.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/bin_package.bbclass +4 -1
index a52b75be5c0..cbc9b1fa131 100644
@@ -26,7 +26,10 @@ do_compile[noexec] = "1"
 bin_package_do_install () {
     # Do it carefully
     [ -d "${S}" ] || exit 1
-    cd ${S} || exit 1
+    if [ -z "$(ls -A ${S})" ]; then
+        bbfatal bin_package has nothing to install. Be sure the SRC_URI unpacks into S.
+    fi
+    cd ${S}
     tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
         | tar --no-same-owner -xpf - -C ${D}
 }
Signature · 1 line
2.11.0
#1 lore raw
Quoted 5 lines · Ross Burton

If the user is trying to use bin_package but the SRC_URI hasn't extracted anything into ${S}, which is easily done when writing a recipe by hand, instead
of silently shippping an empty package abort the build.

I was thinking about this the other day, as it’s a long standing annoyance, I think we should add a new pwd or cwd flag which is used in preference to the last entry in dirs if it’s set, and which errors if the dir doesn’t exist and isn’t listed in dirs, then drop ${S} from dirs. Thoughts?

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics