* [PATCH] classes/buildhistory: fix error when no packages are installed
@ 2013-06-19 16:53 Paul Eggleton
0 siblings, 0 replies; only message in thread
From: Paul Eggleton @ 2013-06-19 16:53 UTC (permalink / raw)
To: openembedded-core
"xargs -n1 basename" will execute basename even if there are no lines
piped into it, causing a "basename: missing operand" error if no
packages are installed, which will happen for the target portion of
buildtools-tarball.
(xargs' -r option could have been used here, but it is a GNU extension
and I thought it best to avoid that for the sake of future
interoperability).
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
meta/classes/buildhistory.bbclass | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index c8fd68c..36e7fe1 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -319,7 +319,11 @@ buildhistory_get_installed() {
list_installed_packages file | sort > $pkgcache
cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt
- cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt
+ if [ -s $pkgcache ] ; then
+ cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt
+ else
+ printf "" > $1/installed-packages.txt
+ fi
# Produce dependency graph
# First, filter out characters that cause issues for dot
--
1.8.1.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-06-19 16:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 16:53 [PATCH] classes/buildhistory: fix error when no packages are installed Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox