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>