From: Markus Lehtonen Date: Mon, 25 Feb 2013 10:11:14 +0000 (+0200) Subject: rpm: support conditionals in patch-export X-Git-Tag: tizen/0.6.22-20150206~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef44e8eaa2b7d75c5535e6b67d8d8a6e9307a376;p=tools%2Fgit-buildpackage.git rpm: support conditionals in patch-export One can now define conditional patches that are enclosed in '%if' or '%ifarch' when the spec file is updated. One can do this by defining 'Gbp-Rpm-If: ' and 'Gbp-Rpm-IfArch: ' in the commit message. Only one conditional per patch is supported, i.e. you cannot define 'IfArch' and 'If' for the same patch. Signed-off-by: Markus Lehtonen --- diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index d3da13a8..edb327f6 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -110,7 +110,8 @@ def generate_patches(repo, start, squash, end, outdir, options): # Generate patches for commit in reversed(repo.get_commits(start, end_commit)): info = repo.get_commit_info(commit) - cmds = parse_gbp_commands(info, 'gbp-rpm', ('ignore'), None)[0] + cmds = parse_gbp_commands(info, 'gbp-rpm', ('ignore'), + ('if', 'ifarch'))[0] if not 'ignore' in cmds: patch_fn = format_patch(outdir, repo, info, patches, options.patch_numbers, @@ -164,9 +165,9 @@ def update_patch_series(repo, spec, start, end, options): # Unlink old patch files and generate new patches rm_patch_files(spec) - patches, _commands = generate_patches(repo, start, squash, end, - spec.specdir, options) - spec.update_patches(patches) + patches, commands = generate_patches(repo, start, squash, end, + spec.specdir, options) + spec.update_patches(patches, commands) spec.write_spec_file()