diff options
author | Ross Burton <ross.burton@intel.com> | 2016-12-08 21:29:57 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-13 22:55:20 +0000 |
commit | 113828ff861f4c2767d7265e88e432f427bba2cc (patch) | |
tree | dde9eb2f06b3faa7f2cfddc51b886b218f37082d /meta | |
parent | 3c3f5c5160927c9c3fd1187c55add4f23cc3cdfd (diff) | |
download | poky-113828ff861f4c2767d7265e88e432f427bba2cc.tar.gz |
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.
(From OE-Core rev: d0b282bce34db44dde4dd7f53a64dfaafe6789de)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/archiver.bbclass | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 9239983e8f..3543ca9c58 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass | |||
@@ -125,7 +125,7 @@ python () { | |||
125 | # (e.g. git repositories) is "unpacked" and then put into a tarball. | 125 | # (e.g. git repositories) is "unpacked" and then put into a tarball. |
126 | python do_ar_original() { | 126 | python do_ar_original() { |
127 | 127 | ||
128 | import shutil, tarfile, tempfile | 128 | import shutil, tempfile |
129 | 129 | ||
130 | if d.getVarFlag('ARCHIVER_MODE', 'src', True) != "original": | 130 | if d.getVarFlag('ARCHIVER_MODE', 'src', True) != "original": |
131 | return | 131 | return |
@@ -261,13 +261,9 @@ def create_tarball(d, srcdir, suffix, ar_outdir): | |||
261 | filename = '%s.tar.gz' % d.getVar('PF', True) | 261 | filename = '%s.tar.gz' % d.getVar('PF', True) |
262 | tarname = os.path.join(ar_outdir, filename) | 262 | tarname = os.path.join(ar_outdir, filename) |
263 | 263 | ||
264 | srcdir = srcdir.rstrip('/') | ||
265 | dirname = os.path.dirname(srcdir) | ||
266 | basename = os.path.basename(srcdir) | ||
267 | os.chdir(dirname) | ||
268 | bb.note('Creating %s' % tarname) | 264 | bb.note('Creating %s' % tarname) |
269 | tar = tarfile.open(tarname, 'w:gz') | 265 | tar = tarfile.open(tarname, 'w:gz') |
270 | tar.add(basename) | 266 | tar.add(srcdir, arcname=os.path.basename(srcdir)) |
271 | tar.close() | 267 | tar.close() |
272 | 268 | ||
273 | # creating .diff.gz between source.orig and source | 269 | # creating .diff.gz between source.orig and source |