diff options
author | Harald Braumann <harry@unheit.net> | 2008-02-23 21:45:00 +0100 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2008-02-23 21:45:00 +0100 |
commit | 4f4af28050d11d21300b59917893cc48f87fa562 (patch) | |
tree | 03db4e1feaea58751b66adc98f1997fa2831c89b /gbp/command_wrappers.py | |
parent | 5082194530a089312b9fda1d62d800c834f224ab (diff) |
Allow multiple file filters for git-import-{orig,dsc}
Diffstat (limited to 'gbp/command_wrappers.py')
-rw-r--r-- | gbp/command_wrappers.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index 42177e5..f11d486 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -87,17 +87,17 @@ class PristineTar(Command): class UnpackTarArchive(Command): """Wrap tar to Unpack a gzipped tar archive""" - def __init__(self, archive, dir, filter=""): + def __init__(self, archive, dir, filters=[]): self.archive = archive self.dir = dir - exclude = [ "", "--exclude=%s" % filter ][len(filter) > 0] + exclude = [("--exclude=%s" % filter) for filter in filters] if archive.lower().endswith(".bz2"): decompress = "--bzip2" else: decompress = "--gzip" - Command.__init__(self, 'tar', [ exclude, '-C', dir, decompress, '-xf', archive ]) + Command.__init__(self, 'tar', exclude + ['-C', dir, decompress, '-xf', archive ]) self.run_error = "Couldn't unpack %s" % self.archive @@ -222,7 +222,7 @@ class GitCommitAll(GitCommand): GitCommand.__call__(self, args) -def copy_from(orig_dir, filter=""): +def copy_from(orig_dir, filters=[]): """ copy a source tree over via tar @param orig_dir: where to copy from @@ -230,10 +230,10 @@ def copy_from(orig_dir, filter=""): @return: list of copied files @rtype: list """ - exclude = [ "", "--exclude=%s" % filter ][len(filter) > 0] + exclude = [("--exclude=%s" % filter) for filter in filters] try: - p1 = subprocess.Popen(["tar", exclude, "-cSpf", "-", "." ], stdout=subprocess.PIPE, cwd=orig_dir) + p1 = subprocess.Popen(["tar"] + exclude + ["-cSpf", "-", "." ], stdout=subprocess.PIPE, cwd=orig_dir) p2 = subprocess.Popen(["tar", "-xvSpf", "-" ], stdin=p1.stdout, stdout=subprocess.PIPE) files = p2.communicate()[0].split('\n') except OSError, err: |