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
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")
# 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"""