From a5707c5c48379b5575091148eb7fde3f8c5d18bc Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 15 Jun 2012 09:00:35 +0300 Subject: [PATCH] import-orig: move repacked_tarball_name() out from common Moves repacked_tarball_name() from scripts/common back to the Debian-specific script. The logic is too Debian-specific for RPM, after all. Signed-off-by: Markus Lehtonen --- gbp/scripts/common/import_orig.py | 20 ++------------------ gbp/scripts/import_orig.py | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gbp/scripts/common/import_orig.py b/gbp/scripts/common/import_orig.py index d941908..349ec59 100644 --- a/gbp/scripts/common/import_orig.py +++ b/gbp/scripts/common/import_orig.py @@ -108,25 +108,9 @@ def ask_package_version(default, ver_validator_func, err_msg): gbp.log.warn("\nNot a valid upstream version: '%s'.\n%s" % (version, err_msg)) -def repacked_tarball_name(source, name, version): - if source.is_orig(): - # Repacked orig tarball needs a different name since there's already - # one with that name - name = os.path.join( - os.path.dirname(source.path), - os.path.basename(source.path).replace(".tar", ".gbp.tar")) - else: - # Repacked sources or other archives get canonical name - name = os.path.join( - os.path.dirname(source.path), - "%s_%s.orig.tar.bz2" % (name, version)) - return name - - -def repack_source(source, name, version, unpack_dir, filters): +def repack_source(source, new_name, unpack_dir, filters): """Repack the source tree""" - name = repacked_tarball_name(source, name, version) - repacked = source.pack(name, filters) + repacked = source.pack(new_name, filters) if source.is_orig(): # the tarball was filtered on unpack repacked.unpacked = source.unpacked else: # otherwise unpack the generated tarball get a filtered tree diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py index 888cebb..3707186 100644 --- a/gbp/scripts/import_orig.py +++ b/gbp/scripts/import_orig.py @@ -173,6 +173,21 @@ def find_source(use_uscan, args): return archive +def repacked_tarball_name(source, name, version): + if source.is_orig(): + # Repacked orig tarball needs a different name since there's already + # one with that name + name = os.path.join( + os.path.dirname(source.path), + os.path.basename(source.path).replace(".tar", ".gbp.tar")) + else: + # Repacked sources or other archives get canonical name + name = os.path.join( + os.path.dirname(source.path), + "%s_%s.orig.tar.bz2" % (name, version)) + return name + + def set_bare_repo_options(options): """Modify options for import into a bare repository""" if options.pristine_tar or options.merge: @@ -312,7 +327,8 @@ def main(argv): if orig_needs_repack(source, options): gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked)) repack_dir = tempfile.mkdtemp(prefix='repack', dir=tmpdir) - source = repack_source(source, sourcepackage, version, repack_dir, options.filters) + repack_name = repacked_tarball_name(source, sourcepackage, version) + source = repack_source(source, repack_name, repack_dir, options.filters) (pristine_orig, linked) = prepare_pristine_tar(source.path, sourcepackage, -- 2.7.4