From 1509ef64c6afe9001cd6bbdcb279743ce7ca7a37 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Mon, 21 Jul 2014 23:42:45 +0200 Subject: spec header can have spaces before the colon --- mgagnome | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mgagnome b/mgagnome index 889005a..8643e72 100755 --- a/mgagnome +++ b/mgagnome @@ -337,18 +337,18 @@ def clean_pkgconfig_prov(prov): return prov class SpecFile(object): - re_update_version = re.compile(r'^(?P
Version:\s*)(?P.+)(?P\s*)$', re.MULTILINE + re.IGNORECASE)
-    re_update_release = re.compile(r'^(?P
Release:\s*)(?P%mkrel \d+)(?P\s*)$', re.MULTILINE + re.IGNORECASE)
-    re_update_patch = re.compile(r'^(?P
Patch)(?P[0-9]*)(?P:\s*)(?P.+)(?P\s*)\n', re.MULTILINE + re.IGNORECASE)
+    re_update_version = re.compile(r'^(?P
Version[ \t]*:\s*)(?P.+)(?P\s*)$', re.MULTILINE + re.IGNORECASE)
+    re_update_release = re.compile(r'^(?P
Release[ \t]*:\s*)(?P%mkrel \d+)(?P\s*)$', re.MULTILINE + re.IGNORECASE)
+    re_update_patch = re.compile(r'^(?P
Patch)(?P[0-9]*)(?P[ \t]*:\s*)(?P.+)(?P\s*)\n', re.MULTILINE + re.IGNORECASE)
 
     re_br_part = re.compile(r'(?P
[^\s%{},<>=][^\s%{},<>=]*)\b(?P\s*(?:(?P=|>=|<=|=<|=>|>|<)\s*(?P[^\s%{},]+|\%\{[^\s{%}]+\}|\%[^\s%{},]+)\b)?)') #re_update_br = re.compile(r'^(?P
BuildRequires:\s*)(?P
[^\s%{},]+?)(?P\s*(?:(?:[<>]=?|=)\s+[^\s%{},]+?)?\s*\n)', re.MULTILINE + re.IGNORECASE) - re_update_br = re.compile(r'^(?P
BuildRequires:\s*)(?P
[^\s%{},]+?)(?P\s*(?:(?:[<>]=?|=)\s+(?:[^\s%{},]+|\%\{[^\s{%}]+\}|\%[^\s%{},]+))?\s*\n)', re.MULTILINE + re.IGNORECASE) + re_update_br = re.compile(r'^(?P
BuildRequires[ \t]*:\s*)(?P
[^\s%{},]+?)(?P\s*(?:(?:[<>]=?|=)\s+(?:[^\s%{},]+|\%\{[^\s{%}]+\}|\%[^\s%{},]+))?\s*\n)', re.MULTILINE + re.IGNORECASE) # re_update_br_unsplit = re.compile(r'^(?P
BuildRequires:\s*)(?P[^\n,]+,[^\n]*)(?P\s*\n)', re.MULTILINE + re.IGNORECASE)
 
-    re_update_br_fix_operator = re.compile('^(?P
BuildRequires:\s*[^\n]*)(?P=<|=>)(?P[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
-    re_update_br_unsplit = re.compile(r'^(?P
BuildRequires:\s*)(?P(?:%s,?(?:[ \t\f\v]+|$)){2,})(?P\n)' % (re_br_part.pattern,), re.MULTILINE + re.IGNORECASE)
+    re_update_br_fix_operator = re.compile('^(?P
BuildRequires[ \t]*:\s*[^\n]*)(?P=<|=>)(?P[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
+    re_update_br_unsplit = re.compile(r'^(?P
BuildRequires[ \t]*:\s*)(?P(?:%s,?(?:[ \t\f\v]+|$)){2,})(?P\n)' % (re_br_part.pattern,), re.MULTILINE + re.IGNORECASE)
 
     def __init__(self, path, module=None):
         self.path = path
@@ -389,7 +389,7 @@ class SpecFile(object):
             ('remove defattr', re.compile(r'(?P^\%files(?:[ \t]+[^\n]*)?\n(?:^\%doc [^\n]+\n)?)^\%defattr\s*\(- *, *root *, *root *(?:, *-)?\)\s*\n', re.MULTILINE + re.IGNORECASE)),
             ('remove cleaning buildroot in install', re.compile(r'(?P^\%install(?:[ \t]+[^\n]*)?\n)' + re_rm_buildroot + r'\n?', re.MULTILINE + re.IGNORECASE)),
             ('remove clean section', re.compile(r'^\%clean[ \t]*\n(?:' + re_rm_buildroot + r')?\s*(?P(?:^#[^%\n]+\n)*^(?:\%files|\%post|\%pre|\%trigger|\%install|\%package|\%check|\%_font_pkg|$(?!.|\n)))', re.MULTILINE + re.IGNORECASE)),
-            ('remove buildroot definition', re.compile(r'^BuildRoot:[^\n]+\n', re.MULTILINE + re.IGNORECASE)),
+            ('remove buildroot definition', re.compile(r'^BuildRoot[ \t]*:[^\n]+\n', re.MULTILINE + re.IGNORECASE)),
             ('remove unneeded setup option', re.compile(r'^(?P\%setup -q )-n (?:\%name|\%\{name\})-(?:\%version|\%\{version\})(?P\n)', re.MULTILINE + re.IGNORECASE)),
         ]
         re_convert_br = [
@@ -467,7 +467,7 @@ class SpecFile(object):
     def _clean_spec_patches(self, f, made_changes, data):
         re_autopatch = re.compile(r'^[ \t]*\%autopatch(?:[ \t]+-p(?P[0-9]+))?$', re.MULTILINE)
 
-        re_patch_header = re.compile('^\Patch(?P[0-9]*):[ \t]*(?P[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
+        re_patch_header = re.compile('^\Patch(?P[0-9]*)[ \t]*:[ \t]*(?P[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
         re_patch_any = re.compile(r'^[ \t]*\%patch(?P[0-9]*)', re.MULTILINE)
         re_patch_valid = re.compile(r'^[ \t+]*\%patch(?P[0-9]*)(?:[ \t]+-p(?P[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)
-- 
cgit v1.2.1