diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-02-26 12:01:32 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-03-08 14:04:00 +0200 |
commit | 1bfff84f088ab1e361f4cb3b7beb160a53d8d959 (patch) | |
tree | 93192a6167a195ff19335ce536621491b26379e7 | |
parent | d5dd63be6d861b863a67e5e290826d10f4437f99 (diff) | |
download | git-buildpackage-1bfff84f088ab1e361f4cb3b7beb160a53d8d959.tar.gz git-buildpackage-1bfff84f088ab1e361f4cb3b7beb160a53d8d959.tar.bz2 git-buildpackage-1bfff84f088ab1e361f4cb3b7beb160a53d8d959.zip |
import-srpm: skip pristine-tar for non-tar sources archives
Don't even try to import non-tar archives to pristine-tar because that
fails. Instead, print a warning and continue without using pristine-tar.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-x | gbp/scripts/import_srpm.py | 12 | ||||
-rw-r--r-- | tests/component/rpm/test_import_srpm.py | 10 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index 1efde58e..0b53632b 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -39,6 +39,7 @@ from gbp.errors import GbpError import gbp.log from gbp.scripts.pq_rpm import safe_patches, rm_patch_files, get_packager from gbp.scripts.common.pq import apply_and_commit_patch +from gbp.pkg import parse_archive_filename no_packaging_branch_msg = """ Repository does not have branch '%s' for packaging/distribution sources. If there is none see @@ -404,9 +405,14 @@ def main(argv): if not options.native: if options.pristine_tar: - repo.pristine_tar.commit(orig_tarball, - 'refs/heads/%s' % - options.upstream_branch) + archive_fmt = parse_archive_filename(orig_tarball)[1] + if archive_fmt == 'tar': + repo.pristine_tar.commit(orig_tarball, + 'refs/heads/%s' % + options.upstream_branch) + else: + gbp.log.warn('Ignoring pristine-tar, %s archives ' + 'not supported' % archive_fmt) else: gbp.log.info("No orig source archive imported") diff --git a/tests/component/rpm/test_import_srpm.py b/tests/component/rpm/test_import_srpm.py index 1a9d0c68..33d2b940 100644 --- a/tests/component/rpm/test_import_srpm.py +++ b/tests/component/rpm/test_import_srpm.py @@ -303,6 +303,16 @@ class TestPristineTar(ComponentTestBase): # of imported patches assert len(repo.get_commits()) == 4 + def test_unsupported_archive(self): + """Test importing of src.rpm with a zip source archive""" + srpm = os.path.join(DATA_DIR, 'gbp-test-native-1.0-1.src.rpm') + assert import_srpm(['arg0', '--pristine-tar', srpm]) == 0 + # Check repository state + repo = GitRepository('gbp-test-native') + self._check_repo_state(repo, 'master', ['master', 'upstream']) + # Check that a warning is printed + self._check_log(-1, "gbp:warning: Ignoring pristine-tar") + class TestBareRepo(ComponentTestBase): """Test importing to a bare repository""" |