archiver: don't change directory when generating tarball
PATCH 1/1 archiver: don't change directory when generating tarball
There's no need to chdir() as tarfile.add() can be told what name to use in the archive.
Signed-off-by Ross Burton <[email protected]>
--- meta/classes/archiver.bbclass | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
meta/classes/archiver.bbclass +2 -6
@@ -125,7 +125,7 @@ python () { # (e.g. git repositories) is "unpacked" and then put into a tarball. python do_ar_original() { - import shutil, tarfile, tempfile + import shutil, tempfile if d.getVarFlag('ARCHIVER_MODE', 'src', True) != "original": return
@@ -261,13 +261,9 @@ def create_tarball(d, srcdir, suffix, ar_outdir): filename = '%s.tar.gz' % d.getVar('PF', True) tarname = os.path.join(ar_outdir, filename) - srcdir = srcdir.rstrip('/') - dirname = os.path.dirname(srcdir) - basename = os.path.basename(srcdir) - os.chdir(dirname) bb.note('Creating %s' % tarname) tar = tarfile.open(tarname, 'w:gz') - tar.add(basename) + tar.add(srcdir, arcname=os.path.basename(srcdir)) tar.close() # creating .diff.gz between source.orig and source
Signature · 1 line
2.8.1