summaryrefslogtreecommitdiff
path: root/gbp/scripts/pq_rpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/scripts/pq_rpm.py')
-rwxr-xr-xgbp/scripts/pq_rpm.py33
1 files changed, 21 insertions, 12 deletions
diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py
index 17e25701..bc8256f9 100755
--- a/gbp/scripts/pq_rpm.py
+++ b/gbp/scripts/pq_rpm.py
@@ -146,6 +146,25 @@ def generate_git_patches(repo, start, squash_point, end, outdir):
return patches
+def rm_patch_files(spec):
+ """
+ Delete the patch files listed in the spec files. Doesn't delete patches
+ marked as not maintained by gbp.
+ """
+ # Remove all old patches from the spec dir
+ for n, p in spec.patches.iteritems():
+ if p['autoupdate']:
+ f = os.path.join(spec.specdir, p['filename'])
+ gbp.log.debug("Removing '%s'" % f)
+ try:
+ os.unlink(f)
+ except OSError, (e, msg):
+ if e != errno.ENOENT:
+ raise GbpError, "Failed to remove patch: %s" % msg
+ else:
+ gbp.log.debug("%s does not exist." % f)
+
+
def update_patch_series(repo, spec, start, end, options):
"""
Export patches to packaging directory and update spec file accordingly.
@@ -159,18 +178,8 @@ def update_patch_series(repo, spec, start, end, options):
end,
tmpdir)
- # Remove all old patches from packaging dir
- for n, p in spec.patches.iteritems():
- if p['autoupdate']:
- f = os.path.join(spec.specdir, p['filename'])
- gbp.log.debug("Removing '%s'" % f)
- try:
- os.unlink(f)
- except OSError, (e, msg):
- if e != errno.ENOENT:
- raise GbpError, "Failed to remove patch: %s" % msg
- else:
- gbp.log.debug("%s does not exist." % f)
+ # Unlink old patch files and generate new patches
+ rm_patch_files(spec)
# Filter "vanilla" patches through write_patch()
filenames = []