package_tar: avoid chdir warnings and restore cwd after packaging

Fixed:
WARNING: attr-2.4.47-r0 do_package_write_tar: Task do_package_tar changed cwd to /path/to/attr/2.4.47-r0/packages-split/attr-locale-sv

(From OE-Core rev: 3753d07c9ff33b9a97aca61ad312b0e283c4c68d)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang 2016-10-12 02:19:05 -07:00 committed by Richard Purdie
parent a618501774
commit 49d189e241
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,9 @@ IMAGE_PKGTYPE ?= "tar"
python do_package_tar () {
import subprocess
oldcwd = os.getcwd()
workdir = d.getVar('WORKDIR', True)
if not workdir:
bb.error("WORKDIR not defined, unable to package")
@ -49,6 +52,8 @@ python do_package_tar () {
ret = subprocess.call(args + [tarfn] + dlist)
if ret != 0:
bb.error("Creation of tar %s failed." % tarfn)
os.chdir(oldcwd)
}
python () {