diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-11-10 07:42:05 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-11-10 07:53:51 +0100 |
commit | d9fb2dfff4cfa94262d8def5ccd501a1fe4478a5 (patch) | |
tree | 763b8fcde9f5782dc39fd17d5f7728d57eee1d22 | |
parent | 8a8bf54ea033230a780169700dcf8dc1ea2f1f6b (diff) |
import-dsc: Apply filters on debian tarballs too
Closes: #881311
-rw-r--r-- | docs/manpages/gbp-import-dsc.xml | 9 | ||||
-rw-r--r-- | gbp/scripts/import_dsc.py | 6 | ||||
-rw-r--r-- | tests/component/deb/test_import_dsc.py | 20 |
3 files changed, 30 insertions, 5 deletions
diff --git a/docs/manpages/gbp-import-dsc.xml b/docs/manpages/gbp-import-dsc.xml index ea1261e8..39a37ec2 100644 --- a/docs/manpages/gbp-import-dsc.xml +++ b/docs/manpages/gbp-import-dsc.xml @@ -153,7 +153,14 @@ </term> <listitem> <para> - filter out files glob-matching pattern. Can be given multiple times. + Filter out files glob-matching + <option><replaceable>pattern</replaceable></option> from + upstream tarballs and the debian tarball of 3.0(quilt) + packages. Note that the <emphasis>.diff.gz</emphasis> of 1.0 + source format packages is currently not filtered. + </para> + <para> + This option can be given multiple times. </para> </listitem> </varlistentry> diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py index ecd2c039..e212a530 100644 --- a/gbp/scripts/import_dsc.py +++ b/gbp/scripts/import_dsc.py @@ -85,12 +85,12 @@ def apply_patch(diff): raise GbpError("Error importing %s: %s" % (diff, err[0])) -def apply_deb_tgz(deb_tgz): +def apply_deb_tgz(deb_tgz, filters): """Apply .debian.tar.gz (V3 source format)""" # Remove any existing data in debian/ as dpkg-source -x does if os.path.isdir('debian'): shutil.rmtree('debian') - gbpc.UnpackTarArchive(deb_tgz, ".")() + gbpc.UnpackTarArchive(deb_tgz, ".", filters)() def get_changes(dir, repo, debian_branch): @@ -162,7 +162,7 @@ def apply_debian_patch(repo, source, dsc, upstream_commit, options): if dsc.diff: apply_patch(dsc.diff) elif dsc.deb_tgz: - apply_deb_tgz(dsc.deb_tgz) + apply_deb_tgz(dsc.deb_tgz, options.filters) else: raise GbpError("Neither a Debian diff nor tarball found") diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py index 9a91f14f..b0a6218a 100644 --- a/tests/component/deb/test_import_dsc.py +++ b/tests/component/deb/test_import_dsc.py @@ -1,6 +1,6 @@ # vim: set fileencoding=utf-8 : # -# (C) 2013,2014,2015 Guido Günther <agx@sigxcpu.org> +# (C) 2013,2014,2015,2017 Guido Günther <agx@sigxcpu.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -349,3 +349,21 @@ class TestImportDsc(ComponentTestBase): self._check_repo_state(repo, 'debian', ['debian', 'master']) commits, expected = len(repo.get_commits()), 2 ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected)) + + def test_import_30_filters(self): + dscfile = self._dsc30('2.6-1') + assert import_dsc(['arg0', + '--verbose', + '--no-pristine-tar', + '--debian-branch=master', + '--upstream-branch=upstream', + '--filter=debian/patches/*', + '--filter=AUTHORS', + dscfile]) == 0 + repo = ComponentTestGitRepository('hello-debhelper') + self._check_repo_state(repo, 'master', ['master', 'upstream']) + os.chdir('hello-debhelper') + ok_(os.path.exists("./debian/changelog")) + ok_(os.path.exists("./configure.ac")) + ok_(not os.path.exists("./debian/patches/series")) + ok_(not os.path.exists("./debian/patches/AUTHORS")) |