summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2016-09-21 20:38:24 +0200
committerOlav Vitters <olav@vitters.nl>2016-09-21 20:38:24 +0200
commitd8197a21172ce4b1a9591f3a7ff8c346743a9027 (patch)
treec0874105c97099e60880da73a8f8b57bd19c161b
parentd55dfc1682678d966e2303223ef5198d24f1bc9d (diff)
downloadmgagnome-d8197a21172ce4b1a9591f3a7ff8c346743a9027.tar
mgagnome-d8197a21172ce4b1a9591f3a7ff8c346743a9027.tar.gz
mgagnome-d8197a21172ce4b1a9591f3a7ff8c346743a9027.tar.bz2
mgagnome-d8197a21172ce4b1a9591f3a7ff8c346743a9027.tar.xz
mgagnome-d8197a21172ce4b1a9591f3a7ff8c346743a9027.zip
various new features
-rwxr-xr-xmgagnome20
1 files 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<pre>Version[ \t]*:\s*)(?P<version>.+)(?P<post>\s*)$', re.MULTILINE + re.IGNORECASE)
re_update_release = re.compile(r'^(?P<pre>Release[ \t]*:\s*)(?P<release>%mkrel [0-9.]+)(?P<post>\s*)$', re.MULTILINE + re.IGNORECASE)
- re_update_patch = re.compile(r'^(?P<pre>Patch)(?P<nr>[0-9]*)(?P<pre2>[ \t]*:\s*)(?P<patch>.+)(?P<post>\s*)\n', re.MULTILINE + re.IGNORECASE)
+ re_update_patch = re.compile(r'^(?P<pre>Patch0*?)(?P<nr>[0-9]*)(?P<pre2>[ \t]*:\s*)(?P<patch>.+)(?P<post>\s*)\n', re.MULTILINE + re.IGNORECASE)
re_br_part = re.compile(r'(?P<br>[^\s%{},<>=][^\s%{},<>=]*)\b(?P<post>\s*(?:(?P<operator>=|>=|<=|=<|=>|>|<)\s*(?P<version>[^\s%{},]+|\%\{[^\s{%}]+\}|\%[^\s%{},]+)\b)?)')
@@ -360,6 +360,18 @@ class SpecFile(object):
('restrict what libraries are matched with major numbers', r'\g<keeppre>{,.*}', re.compile(r'^(?P<keeppre>%{_libdir}[^\n]+})\*$', re.MULTILINE)),
('keep library matching using two lines', r'\g<keeppre>\n\g<keeppre>.*', re.compile(r'^(?P<keeppre>%{_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)