rpm.SpecFile: drop the internal 'patches' structure
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 11 Jan 2013 14:41:38 +0000 (16:41 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 14 Nov 2014 12:46:23 +0000 (14:46 +0200)
To get rid of duplicate data tracking. Also, add test for testing the
macro expansion of patch and source names.

Also add tests for SpecFile.patchseries.

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

index 8a938fa3896ee187ad0bbfdb3f4824795a8fa372..d3da13a8a6989ad67a7fe3eb7575ea9ffb1d64d8 100755 (executable)
@@ -140,17 +140,15 @@ def rm_patch_files(spec):
     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)
+    for patch in spec.patchseries(unapplied=True):
+        gbp.log.debug("Removing '%s'" % patch.path)
+        try:
+            os.unlink(patch.path)
+        except OSError as err:
+            if err.errno != errno.ENOENT:
+                raise GbpError("Failed to remove patch: %s" % err)
+            else:
+                gbp.log.debug("Patch %s does not exist." % patch.path)
 
 
 def update_patch_series(repo, spec, start, end, options):