From 8d24e7b7541816b8384b2ba0d8e33e36aed4d5b1 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 13 Feb 2014 12:41:39 +0200 Subject: [PATCH] import-orig-rpm: implement automatic downloading Automatically try to download the archive if the archive filename points to a remote location. Signed-off-by: Markus Lehtonen --- gbp/scripts/import_orig_rpm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gbp/scripts/import_orig_rpm.py b/gbp/scripts/import_orig_rpm.py index a8f874c..8a6df9e 100755 --- a/gbp/scripts/import_orig_rpm.py +++ b/gbp/scripts/import_orig_rpm.py @@ -23,6 +23,7 @@ import os import sys import gbp.tmpfile as tempfile import gbp.command_wrappers as gbpc +import re import string from gbp.pkg import parse_archive_filename from gbp.rpm import (RpmUpstreamSource, SpecFile, NoSpecError, guess_spec, @@ -35,6 +36,7 @@ import gbp.log from gbp.scripts.common.import_orig import (cleanup_tmp_tree, ask_package_name, ask_package_version, prepare_sources) +from gbp.scripts.import_srpm import download_file def upstream_import_commit_msg(options, version): @@ -99,7 +101,10 @@ def find_source(options, args): elif len(args) == 0: raise GbpError, "No archive to import specified. Try --help." else: - return RpmUpstreamSource(args[0]) + path = args[0] + if re.match(r'[a-z]{1,5}://', path): + path = download_file('.', path) + return RpmUpstreamSource(path) def pristine_tarball_name(source, pkg_name, pkg_version, pristine_name): -- 2.7.4