From d8197a21172ce4b1a9591f3a7ff8c346743a9027 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Wed, 21 Sep 2016 20:38:24 +0200 Subject: various new features --- mgagnome | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mgagnome b/mgagnome index fdc9534..0a685c8 100755 --- a/mgagnome +++ b/mgagnome @@ -303,7 +303,7 @@ def clean_pkgconfig_prov(prov): class SpecFile(object): 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 [0-9.]+)(?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_update_patch = re.compile(r'^(?P
Patch0*?)(?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)?)') @@ -360,6 +360,18 @@ class SpecFile(object): ('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)), + # Use new Python macros + ('use new Python macros', r'%py2_build', re.compile(r'^%{__python} setup.py build$', re.MULTILINE)), + ('use new Python macros', r'%py3_build', re.compile(r'^%{__python3} setup.py build$', re.MULTILINE)), + + ('use new Python macros', r'%py2_install', re.compile(r'^%{__python} setup.py install$', re.MULTILINE)), + ('use new Python macros', r'%py3_install', re.compile(r'^%{__python3} setup.py install$', re.MULTILINE)), + + ('use new Python macros', r'%{python2_sitelib}', re.compile(r'^%{python_sitelib}', re.MULTILINE)), + ('use new Python macros', r'%{python2_sitearch}', re.compile(r'^%{python_sitearch}', re.MULTILINE)), + + ('use new Python macros', r'%{python2_version}', re.compile(r'%{pyver}', re.MULTILINE)), + ('use new Python macros', r'%{python3_version}', re.compile(r'%{py3ver}', re.MULTILINE)), ] re_convert_br = [ ('remove py_requires', ('python',), re.compile(r'^\%(?:py_requires|\{py_requires\})[ \t]*\n', re.MULTILINE)), @@ -540,7 +552,7 @@ class SpecFile(object): @property def uses_apply_patches(self): - return subprocess.call(['grep', '-Eq', '^%(apply_patches|autopatch)', '--', self.path]) == 0 + return subprocess.call(['grep', '-Eq', '^%(apply_patches|autopatch|autosetup)', '--', self.path]) == 0 def _revert_changes(self): """Revert uncommited changes made to spec file""" @@ -608,7 +620,7 @@ class SpecFile(object): cmd_before_parsed = shlex.split(cmd_before[0]) if cmd_before[0] else [] if not check_only and uses_apply_patches and patches and cmd_parsed: - if os.path.basename(cmd_parsed[0]) == 'patch': + if os.path.basename(cmd_parsed[0]) in ('patch', 'cat'): if os.path.exists(cmd_parsed[-1]): failed_patch = os.path.basename(cmd_parsed[-1]) elif cmd_parsed[-1].startswith('-') and os.path.exists(cmd_before_parsed[-1]): @@ -1286,6 +1298,8 @@ def cmd_check_latest(options, parser): safe_max_version = get_safe_max_version(spec_version, module=module) versions = Upstream.versions(module) + if package_version != spec_version and spec_version != 'N/A' and package_version != 'N/A': + upgrade.add('~') if versions: latest_version = get_latest_version(versions) safe_version = get_latest_version(versions, safe_max_version) -- cgit v1.2.1