diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-06-19 17:53:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-20 13:10:46 +0100 |
commit | 827400fd0927eaa1280bac6368f4d1199849c3ed (patch) | |
tree | 7aa80ad3d1b56df08bca1d99af8bd06685a1d210 | |
parent | e04e6dab0afa8f72bf001b0cc106cd13b7694a91 (diff) | |
download | poky-827400fd0927eaa1280bac6368f4d1199849c3ed.tar.gz |
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).
(From OE-Core rev: 03d86123e9e804e62de38effd307f070d7863080)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/buildhistory.bbclass | 6 |
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() { | |||
319 | list_installed_packages file | sort > $pkgcache | 319 | list_installed_packages file | sort > $pkgcache |
320 | 320 | ||
321 | cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt | 321 | cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt |
322 | cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt | 322 | if [ -s $pkgcache ] ; then |
323 | cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt | ||
324 | else | ||
325 | printf "" > $1/installed-packages.txt | ||
326 | fi | ||
323 | 327 | ||
324 | # Produce dependency graph | 328 | # Produce dependency graph |
325 | # First, filter out characters that cause issues for dot | 329 | # First, filter out characters that cause issues for dot |