From: Ross Burton <ross.burton@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] archiver: don't change directory when generating tarball
Date: Thu, 8 Dec 2016 21:32:03 +0000 [thread overview]
Message-ID: <1481232723-12285-1-git-send-email-ross.burton@intel.com> (raw)
There's no need to chdir() as tarfile.add() can be told what name to use in the
archive.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/classes/archiver.bbclass | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 9239983..3543ca9 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -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
--
2.8.1
reply other threads:[~2016-12-08 21:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481232723-12285-1-git-send-email-ross.burton@intel.com \
--to=ross.burton@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox