summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2014-07-21 23:25:50 +0200
committerOlav Vitters <olav@vitters.nl>2014-07-21 23:25:50 +0200
commit4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9 (patch)
treed78e3207d7188ffb601cb4a026ff8fd042f39b1d
parent15a5fa8bb2d0b5697a06dc8e80f353f26b654cd6 (diff)
downloadmgagnome-4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9.tar
mgagnome-4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9.tar.gz
mgagnome-4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9.tar.bz2
mgagnome-4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9.tar.xz
mgagnome-4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9.zip
fix autopatch check
-rwxr-xr-xmgagnome12
1 files changed, 9 insertions, 3 deletions
diff --git a/mgagnome b/mgagnome
index 032715f..967a3ed 100755
--- a/mgagnome
+++ b/mgagnome
@@ -464,14 +464,20 @@ class SpecFile(object):
return made_changes
def _clean_spec_patches(self, f, made_changes, data):
+ re_autopatch = re.compile(r'^[ \t]*\%autopatch(?:[ \t]+-p(?P<strip>[0-9]+))?$', re.MULTILINE)
+
re_patch_header = re.compile('^\Patch(?P<nr>[0-9]*):[ \t]*(?P<filename>[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
re_patch_any = re.compile(r'^[ \t]*\%patch(?P<nr>[0-9]*)', re.MULTILINE)
- re_patch_valid = re.compile(r'^[ \t+]*\%patch(?P<nr>[0-9]*)(?:[ \t]+-p(?P<strip>[0-9]+))?(?:[ \t]+-b[ \t]+\S+)$\n?', re.MULTILINE)
- re_prep_patches = re.compile(r'^\%setup[^\n]+$(?:' + re_patch_valid.pattern + r'|^#[^%\n]+\n|\s)+\n\%build', re.MULTILINE)
+ re_patch_valid = re.compile(r'^[ \t+]*\%patch(?P<nr>[0-9]*)(?:[ \t]+-p(?P<strip>[0-9]+))?(?:[ \t]+-b[ \t]+\S+)?$\n?', re.MULTILINE)
+ re_prep_patches = re.compile(r'^\%setup[^\n]+$(?:' + re_patch_valid.pattern + r'|^#[^%\n]+\n|^[ \t]*(?:%{_bindir}/|%_bindir)?autoreconf[ \t][^\n]+$|\s)+\n\%build', re.MULTILINE)
give_patchnr = lambda mo: (mo.group('nr') if len(mo.group('nr')) == 1 else mo.group('nr').lstrip('0')) if mo.group('nr') else "0"
# Make use of %apply_patches
+
+ if re_autopatch.search(data):
+ return made_changes, data
+
patches = self.patches
if not patches:
return made_changes, data
@@ -494,7 +500,7 @@ class SpecFile(object):
return made_changes, data
if not (patch_nrs_header == patch_nrs_any == patch_nrs_valid):
- print >>sys.stderr, "NOTICE: Unable to automatically convert patches into %autopatch"
+ print >>sys.stderr, "NOTICE: Unable to automatically convert %s patches into %%autopatch (header/patch/valid: %s, %s, %s)" % (self.module, len(patch_nrs_header), len(patch_nrs_any), len(patch_nrs_valid))
return made_changes, data
patch_flags = set([mo.group('strip') for mo in re_patch_valid.finditer(mo2.group(0))])