From a566bfe4398ff5baae38f4911aa07a9494a1e9cb Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Thu, 8 Oct 2015 18:30:38 +0200 Subject: keep libraries on two lines; avoid trying to fix packages with loads of patches (hangs); fix a bug in handling of patch flags --- mgagnome | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mgagnome') diff --git a/mgagnome b/mgagnome index d7d2b27..ec380a5 100755 --- a/mgagnome +++ b/mgagnome @@ -354,7 +354,8 @@ class SpecFile(object): ('remove unneeded setup option', None, re.compile(r'^(?P\%setup -q)(?: -n|n) (?:\%name|\%\{name\})-(?:\%version|\%\{version\})(?P\n)', re.MULTILINE + re.IGNORECASE)), ('https for download.gnome.org', r'\ghttps://\g', re.compile(r'^(?PSource[0-9]*[ \t]*:[^\n]+)http://(?Pdownload.gnome.org/[^\n]+\n)', re.MULTILINE + re.IGNORECASE)), ('download.gnome.org instead of ftp.gnome.org', r'\ghttps://download.gnome.org\g', re.compile(r'^(?PSource[0-9]*[ \t]*:[^\n]+)(?:ftp|http|https)://ftp.gnome.org/pub/GNOME(?P/[^\n]+\n)', re.MULTILINE + re.IGNORECASE)), - ('restrict what libraries are matched with major numbers', r'\g{,.*}', re.compile(r'^(?P%{_libdir}[^\n]+})\.?\*$', re.MULTILINE)), + ('restrict what libraries are matched with major numbers', r'\g{,.*}', re.compile(r'^(?P%{_libdir}[^\n]+})\*$', re.MULTILINE)), + ('keep library matching using two lines', r'\g\n\g.*', re.compile(r'^(?P%{_libdir}[^\n]+})$\n(?P=keeppre)\{,\.\*\}$', re.MULTILINE)), ('make use of autopatch', r'%autopatch -p1', re.compile(r'^%apply_patches$', re.MULTILINE)), ] re_convert_br = [ @@ -450,6 +451,10 @@ class SpecFile(object): if not patches: return made_changes, data + if len(patches) > 5: + print("NOTICE: More than 5 patches, skipping package", file=sys.stderr) + return made_changes, data + if self.uses_apply_patches: return made_changes, data @@ -472,7 +477,7 @@ class SpecFile(object): print("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)), file=sys.stderr) return made_changes, data - patch_flags = set([mo.group('strip') for mo in re_patch_valid.finditer(mo2.group(0))]) + patch_flags = set([0 if mo.group('strip') is None else mo.group('strip') for mo in re_patch_valid.finditer(mo2.group(0))]) if len(patch_flags) != 1: print("NOTICE: Unable to automatically convert patches into as different -p / strip levels used", file=sys.stderr) -- cgit v1.2.1