aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gbp/scripts/import_dsc.py20
m---------tests/component/deb/data0
-rw-r--r--tests/component/deb/test_import_dsc.py12
3 files changed, 21 insertions, 11 deletions
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index be74bd03..d4a11b27 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -197,13 +197,13 @@ def move_tag_stamp(repo, format, version):
repo.move_tag(old, new)
-def set_bare_repo_options(options):
- """Modify options for import into a bare repository"""
+def disable_pristine_tar(options, reason):
+ """Disable pristine tar if enabled"""
if options.pristine_tar:
- gbp.log.info("Bare repository: setting %s option"
- % (["", " '--no-pristine-tar'"][options.pristine_tar], ))
+ gbp.log.info("%s: setting '--no-pristine-tar' option" % reason)
options.pristine_tar = False
+
def build_parser(name):
try:
parser = GbpOptionParserDebian(command=os.path.basename(name), prefix='',
@@ -317,10 +317,6 @@ def main(argv):
if options.verbose:
print_dsc(src)
- if src.additional_tarballs:
- raise GbpError("Cannot import package with additional tarballs but found '%s'" %
- ", ".join([os.path.basename(t) for t in src.additional_tarballs]))
-
if needs_repo:
if os.path.exists(src.pkg):
raise GbpError("Directory '%s' already exists. If you want to import into it, "
@@ -331,11 +327,17 @@ def main(argv):
os.chdir(repo.path)
if repo.bare:
- set_bare_repo_options(options)
+ disable_pristine_tar(options, "Bare repository")
+ elif src.additional_tarballs:
+ disable_pristine_tar(options, "Component tarballs found")
dirs['tmp'] = os.path.abspath(tempfile.mkdtemp(dir='..'))
upstream = DebianUpstreamSource(src.tgz)
upstream.unpack(dirs['tmp'], options.filters)
+ for tarball in src.additional_tarballs:
+ gbp.log.info("Found component tarball '%s'" % os.path.basename(tarball))
+ subtarball = DebianUpstreamSource(tarball)
+ subtarball.unpack(upstream.unpacked, options.filters)
format = [(options.upstream_tag, "Upstream"), (options.debian_tag, "Debian")][src.native]
tag = repo.version_to_tag(format[0], src.upstream_version)
diff --git a/tests/component/deb/data b/tests/component/deb/data
-Subproject 60892e9d88e88a94147ffc5ae6f4016a598f0d2
+Subproject b53e6ec2a785e1d9df3fbb2590f8fe974362910
diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py
index 760b3657..7a82ce0c 100644
--- a/tests/component/deb/test_import_dsc.py
+++ b/tests/component/deb/test_import_dsc.py
@@ -97,8 +97,16 @@ class TestImportDsc(ComponentTestBase):
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
- dsc]) == 1
- self._check_log(0, "gbp:error: Cannot import package with additional tarballs but found 'hello-debhelper_2.8.orig-foo.tar.gz")
+ dsc]) == 0
+ repo = ComponentTestGitRepository('hello-debhelper')
+ self._check_repo_state(repo, 'master', ['master', 'upstream'])
+ commits, expected = len(repo.get_commits()), 2
+
+ for file in ['foo/test1', 'foo/test2']:
+ ok_(file in repo.ls_tree('HEAD'),
+ "Could not find component tarball file %s in %s" % (file, repo.ls_tree('HEAD')))
+
+ ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
def test_existing_dir(self):
"""