From 7f6b72e039efa5e2c3517b9336f9b29b4cb65c71 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 15 May 2012 10:02:40 +0300 Subject: Move get_compression() out of pkg.PkgPolicy class Renames the function to parse_archive_filename() and changes it's return values. Filename parsing is merely generic functionality, not tied to any packaging policy. The function now returns the base name of the file (that is, filename without, archive and compression extensions), archive format and compression method. Adds supported archive formats 'tar' and 'zip' and file extension aliases, e.g. 'tgz'. Signed-off-by: Markus Lehtonen --- gbp/scripts/buildpackage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gbp/scripts') diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index 0ef6e9c..8d79e8b 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -37,7 +37,8 @@ from gbp.scripts.common.buildpackage import (index_name, wc_name, git_archive_submodules, git_archive_single, dump_tree, write_wc, drop_index) -from gbp.pkg import (UpstreamSource, compressor_opts, compressor_aliases) +from gbp.pkg import (UpstreamSource, compressor_opts, compressor_aliases, + parse_archive_filename) def git_archive(repo, cp, output_dir, treeish, comp_type, comp_level, with_submodules): "create a compressed orig tarball in output_dir using git_archive" @@ -318,7 +319,7 @@ def guess_comp_type(repo, comp_type, cp, tarball_dir): else: commit = repo.pristine_tar_branch tarball = repo.get_commit_info(commit)['subject'] - comp_type = du.DebianPkgPolicy.get_compression(tarball) + (base_name, archive_fmt, comp_type) = parse_archive_filename(tarball) gbp.log.debug("Determined compression type '%s'" % comp_type) if not comp_type: comp_type = 'gzip' -- cgit v1.2.3