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>
Fri, 14 Nov 2014 12:45:07 +0000 (14:45 +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 8d9a9b8..0add68e 100755 (executable)
@@ -227,6 +227,15 @@ 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)