diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-08-20 11:56:48 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-03-08 13:13:38 +0200 |
commit | 71911049c1556fa39102126d771df09ea96944aa (patch) | |
tree | 0100ae4cfa5a02d8a8bc3dffc54c8305e855326a | |
parent | ad1d9be4f61dc4468960fad3af485c64353206ab (diff) | |
download | git-buildpackage-71911049c1556fa39102126d771df09ea96944aa.tar.gz git-buildpackage-71911049c1556fa39102126d771df09ea96944aa.tar.bz2 git-buildpackage-71911049c1556fa39102126d771df09ea96944aa.zip |
rpm: support to define filename of squashed diffs
Adds the ability to define the filename of the monolithic diff generated
with the --patch-export-squash-until option. The new format of the
cmdline option filename is commit-ish followed by (optionally) a colon
and the desired filename base. Suffix '.diff' is added by GBP.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp-rpm.conf | 4 | ||||
-rw-r--r-- | gbp/config.py | 5 | ||||
-rwxr-xr-x | gbp/scripts/pq_rpm.py | 22 |
3 files changed, 22 insertions, 9 deletions
diff --git a/gbp-rpm.conf b/gbp-rpm.conf index 05678e2f..3609f379 100644 --- a/gbp-rpm.conf +++ b/gbp-rpm.conf @@ -29,7 +29,7 @@ # Compress auto-generated patches #patch-export-compress=100k # Squash commits until certain tree-ish into one diff -#patch-export-squash-until = stable-updates +#patch-export-squash-until = stable-updates:stable # Export patches with numbering in filenames #patch-numbers = False @@ -112,7 +112,7 @@ ### [gbp-pq-rpm] # Name of the patch-queue / development branch -pq-branch = %(branch)s-devel +#pq-branch = %(branch)s-devel ### ### Options only affecting gbp-clone diff --git a/gbp/config.py b/gbp/config.py index a99b3ae1..9fe9a483 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -515,7 +515,10 @@ class GbpOptionParserRpm(GbpOptionParser): 'patch-export-compress': "Compress (auto-generated) patches larger than given number of bytes, 0 never compresses, default is '%(patch-export-compress)s'", 'patch-export-squash-until': - "Squash commits (from upstream) until given tree-ish into one big diff, default is '%(patch-export-squash-until)s'", + ("Squash commits (from upstream) until given tree-ish " + "into one big diff, format is " + "'<commit_ish>[:<filename_base>]'. " + "Default is '%(patch-export-squash-until)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'", 'orig-prefix': diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index 9d2440c7..c5139d43 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -108,7 +108,8 @@ def write_diff_file(repo, start, end, diff_filename): raise GbpError, "Unable to create diff file" -def generate_git_patches(repo, start, squash_point, end, outdir): +def generate_git_patches(repo, start, squash_point, end, squash_diff_name, + outdir): """ Generate patch files from git """ @@ -127,10 +128,15 @@ def generate_git_patches(repo, start, squash_point, end, outdir): squash_sha1 = repo.rev_parse(squash_sha1, short=7) start_sha1 = repo.rev_parse(start_sha1, short=7) - gbp.log.info("Squashing commits %s..%s into one monolithic diff" % (start_sha1, squash_sha1)) - diff_filename = os.path.join(outdir, '%s-to-%s.diff' % (start_sha1, squash_sha1)) - write_diff_file(repo, start_sha1, squash_sha1, diff_filename) - patches.append(diff_filename) + if squash_diff_name: + diff_filename = squash_diff_name + ".diff" + else: + diff_filename = '%s-to-%s.diff' % (start_sha1, squash_sha1) + gbp.log.info("Squashing commits %s..%s into one monolithic '%s'" % + (start_sha1, squash_sha1, diff_filename)) + diff_filepath = os.path.join(outdir, diff_filename) + write_diff_file(repo, start_sha1, squash_sha1, diff_filepath) + patches.append(diff_filepath) start = squash_sha1 @@ -171,10 +177,14 @@ def update_patch_series(repo, spec, start, end, options): """ tmpdir = tempfile.mkdtemp(dir=options.tmp_dir, prefix='patchexport_') # Create "vanilla" patches + squash = options.patch_export_squash_until.split(':', 1) + squash_point = squash[0] + squash_name = squash[1] if len(squash) > 1 else "" patches = generate_git_patches(repo, start, - options.patch_export_squash_until, + squash_point, end, + squash_name, tmpdir) # Unlink old patch files and generate new patches |