buildpackage-rpm: fail patch-export if local patches found
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 8 Nov 2012 10:27:43 +0000 (12:27 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Mar 2015 08:07:46 +0000 (10:07 +0200)
Make patch export fail if local patch files (not marked for manual
maintenance) exist.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/scripts/buildpackage_rpm.py

index 2b8f97c6e4fc04b8db995cd574c1f36bf4d92c20..63db6eb785f2191583ca08002889bd754db5d92c 100755 (executable)
@@ -239,6 +239,14 @@ def git_archive_build_orig(repo, spec, output_dir, options):
 
 def export_patches(repo, spec, export_treeish, options):
     """Generate patches and update spec file"""
+    # Fail if we have local patch files not marked for manual maintenance.
+    # Ignore patches listed in spec but not found in packaging dir
+    for patch in spec.patchseries():
+        if os.path.exists(patch.path):
+            raise GbpAutoGenerateError(
+                    'Patches not marked for manual maintenance found, '
+                    'refusing to overwrite! Fix by applying them to packaging '
+                    'branch and removing the files.')
     try:
         upstream_tree = get_upstream_tree(repo, spec, options)
         update_patch_series(repo, spec, upstream_tree, export_treeish, options)