diff options
author | Mehdi Dogguy <dogguy@pps.jussieu.fr> | 2009-06-12 12:37:55 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-06-13 22:20:13 +0200 |
commit | 7de9f129883b95374240fa177948e12ddd17a342 (patch) | |
tree | 65e3c5cd1715e5d5265b1c0b71b310307ea823b3 /gbp | |
parent | 882f9716762fb086046f58b5c22ff658e69a2298 (diff) |
add filter-pristine-tar
to filter upstream tarball before passing it to pristine-tar
Closes: #520722
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/command_wrappers.py | 13 | ||||
-rw-r--r-- | gbp/config.py | 3 | ||||
-rw-r--r-- | gbp/deb_utils.py | 11 |
3 files changed, 27 insertions, 0 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index 1439cc59..8cfa7cb9 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -132,6 +132,19 @@ class UnpackTarArchive(Command): Command.__init__(self, 'tar', exclude + ['-C', dir, decompress, '-xf', archive ]) self.run_error = 'Couldn\'t unpack "%s"' % self.archive +class RepackTarArchive(Command): + """Wrap tar to Repack a gzipped tar archive""" + def __init__(self, archive, dir, dest): + self.archive = archive + self.dir = dir + + if archive.lower().endswith(".bz2"): + compress = "--bzip2" + else: + compress = "--gzip" + + Command.__init__(self, 'tar', ['-C', dir, compress, '-cf', archive, dest]) + self.run_error = 'Couldn\'t repack "%s"' % self.archive class RemoveTree(Command): "Wrap rm to remove a whole directory tree" diff --git a/gbp/config.py b/gbp/config.py index 6fa223a6..0ffcc327 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -30,6 +30,7 @@ class GbpOptionParser(OptionParser): 'debian-branch' : 'master', 'upstream-branch' : 'upstream', 'pristine-tar' : 'False', + 'filter-pristine-tar' : 'False', 'sign-tags' : 'False', 'no-create-orig' : 'False', 'keyid' : '', @@ -66,6 +67,8 @@ class GbpOptionParser(OptionParser): "GPG keyid to sign tags with, default is '%(keyid)s'", 'pristine-tar': "use pristine-tar to create .orig.tar.gz, default is '%(pristine-tar)s'", + 'filter-pristine-tar': + "Filter pristine-tar when filter option is used", 'filter': "files to filter out during import (can be given multiple times)", 'git-author': diff --git a/gbp/deb_utils.py b/gbp/deb_utils.py index f20033a0..c439ba36 100644 --- a/gbp/deb_utils.py +++ b/gbp/deb_utils.py @@ -199,6 +199,17 @@ def unpack_orig(archive, tmpdir, filters): raise GbpError return unpackArchive.dir +def repack_orig(archive, tmpdir, dest): + """ + recreate a new .orig.tar.gz from tmpdir (useful when using filter option) + """ + try: + repackArchive = gbpc.RepackTarArchive(archive, tmpdir, dest) + repackArchive() + except gbpc.CommandExecFailed: + print >>sys.stderr, "Failed to create %s" % archive + raise GbpError + return repackArchive.dir def tar_toplevel(dir): """tar archives can contain a leading directory not""" |