diff mbox series

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

Message ID 20171121235323.29727-1-ross.burton@intel.com
State Accepted
Commit bf5627ddbe5371eba62f73c33735fb1cf35c2194
Headers show
Series bin_package: fail if ${S} doesn't actually contain anything | expand

Commit Message

Ross Burton Nov. 21, 2017, 11:53 p.m. UTC
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.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/bin_package.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Christopher Larson Nov. 22, 2017, 3:21 p.m. UTC | #1
On Tue, Nov 21, 2017 at 4:53 PM, Ross Burton <ross.burton@intel.com> wrote:

> 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?
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
<div dir="ltr">On Tue, Nov 21, 2017 at 4:53 PM, Ross Burton <span dir="ltr">&lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If the user is trying to use bin_package but the SRC_URI hasn&#39;t extracted<br>
anything into ${S}, which is easily done when writing a recipe by hand, instead<br>
of silently shippping an empty package abort the build.<br></blockquote><div><br></div><div>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?</div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Senior Software Engineer, Mentor Graphics</div></div></div></div>
</div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/classes/bin_package.bbclass b/meta/classes/bin_package.bbclass
index a52b75be5c0..cbc9b1fa131 100644
--- a/meta/classes/bin_package.bbclass
+++ b/meta/classes/bin_package.bbclass
@@ -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}
 }