diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-05-11 14:19:24 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-03-08 13:13:37 +0200 |
commit | 1c2a739ef1ddf83b37bb291e02b76d9f435617ef (patch) | |
tree | 25b7c289105b3b6834018b9003a79824cb6cc94e | |
parent | fd7d8e29652b26e13d35994f8e01fd6d13513e70 (diff) | |
download | git-buildpackage-1c2a739ef1ddf83b37bb291e02b76d9f435617ef.tar.gz git-buildpackage-1c2a739ef1ddf83b37bb291e02b76d9f435617ef.tar.bz2 git-buildpackage-1c2a739ef1ddf83b37bb291e02b76d9f435617ef.zip |
buildpackage-rpm: implement patch export filters
Implements a filter option which can be used to filter out certain
commits from the patch-generation. A commit is ignored if any line
of the commit message matches the given regex.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp-rpm.conf | 2 | ||||
-rw-r--r-- | gbp/config.py | 3 | ||||
-rwxr-xr-x | gbp/scripts/buildpackage_rpm.py | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gbp-rpm.conf b/gbp-rpm.conf index 99eac632..4bdc573b 100644 --- a/gbp-rpm.conf +++ b/gbp-rpm.conf @@ -24,6 +24,8 @@ #packaging-dir=rpm # Spec file to be used #spec-file = gbp.spec +# Don't create patches from commits whose message matches regex +#patch-export-ignore-regex = ignore-autopatch-gen # Export patches with numbering in filenames #patch-numbers = False diff --git a/gbp/config.py b/gbp/config.py index 52f27a17..81bb18ea 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -484,6 +484,7 @@ class GbpOptionParserRpm(GbpOptionParser): 'rpmbuild-srpmdir' : 'SRPMS', 'rpmbuild-buildrootdir' : 'BUILDROOT', 'patch-export' : 'False', + 'patch-export-ignore-regex' : '^GBP: patch-export-ignore', 'pristine-tarball-name' : 'auto', } ) @@ -501,6 +502,8 @@ class GbpOptionParserRpm(GbpOptionParser): "Spec file to use, 'auto' makes gbp to guess, other values make the packaging-dir option to be ignored, default is '%(spec-file)s'", 'patch-export': "Create patches between upstream and export-treeish, default is '%(patch-export)s'", + 'patch-export-ignore-regex': + "Don't create patches from commits whose message matches given regex, default is '%(patch-export-ignore-regex)s'", 'pristine-tarball-name': "Filename to record to pristine-tar, set to 'auto' to not mangle the file name, default is '%(pristine-tarball-name)s'", } ) diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 6a955867..ce3efafb 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -203,6 +203,13 @@ def write_patch(patch, options): tmp.write(line) break else: + if re.match(options.patch_export_ignore_regex, line): + gbp.log.debug("Ignoring patch %s, matches ignore-regex" % patch) + old.close() + tmp.close() + os.unlink(patch) + os.unlink(tmpname) + return if line.lower().startswith("gbp-pq-topic: "): topic = line.split(" ",1)[1].strip() gbp.log.debug("Topic %s found for %s" % (topic, patch)) @@ -270,7 +277,9 @@ def gen_patches(repo, spec, totree, options): if patches: gbp.log.info("Regenerating patch series in '%s'." % spec.specdir) for patch in patches: - filenames.append(os.path.basename(write_patch(patch, options))) + patch_file = write_patch(patch, options) + if patch_file != None: + filenames.append(os.path.basename(patch_file)) spec.update_patches(filenames) spec.write_spec_file() @@ -396,6 +405,7 @@ def parse_args(argv, prefix): export_group.add_option("--git-export-only", action="store_true", dest="export_only", default=False, help="only export packaging files, don't build") export_group.add_boolean_config_file_option("patch-export", dest="patch_export") + export_group.add_config_file_option("patch-export-ignore-regex", dest="patch_export_ignore_regex") export_group.add_boolean_config_file_option(option_name="patch-numbers", dest="patch_numbers") options, args = parser.parse_args(args) |