summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-06-19 17:53:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-20 13:10:00 +0100
commit03d86123e9e804e62de38effd307f070d7863080 (patch)
treefb8bafc26d89ef69fb92dcade8b81038592cbf67 /meta/classes
parentdefa05f2085f78d9ec9ada7051c284e1fc72e6c1 (diff)
downloadopenembedded-core-03d86123e9e804e62de38effd307f070d7863080.tar.gz
openembedded-core-03d86123e9e804e62de38effd307f070d7863080.tar.bz2
openembedded-core-03d86123e9e804e62de38effd307f070d7863080.zip
classes/buildhistory: fix error when no packages are installed
"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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildhistory.bbclass6
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index c8fd68c39e..36e7fe13be 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