summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2014-07-23 17:17:54 +0200
committerOlav Vitters <olav@vitters.nl>2014-07-23 17:17:54 +0200
commit05b4834842c712b5f4b4c55ec866f54eb08de287 (patch)
tree6a5acec811c48cf56f69bd902986472800e042bf
parent26458b003060faac1a41490eaf45fefd7d7ef804 (diff)
downloadmgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar
mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.gz
mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.bz2
mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.xz
mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.zip
also handle %autopatch
-rwxr-xr-xmgagnome16
1 files changed, 13 insertions, 3 deletions
diff --git a/mgagnome b/mgagnome
index 6c12f8f..8c65176 100755
--- a/mgagnome
+++ b/mgagnome
@@ -480,6 +480,7 @@ class SpecFile(object):
# Make use of %apply_patches
if re_autopatch.search(data):
+ # Ignore if using %autopatch
return made_changes, data
patches = self.patches
@@ -567,7 +568,7 @@ class SpecFile(object):
@property
def uses_apply_patches(self):
- return subprocess.call(['grep', '-q', '^%apply_patches', '--', self.path]) == 0
+ return subprocess.call(['grep', '-Eq', '^%(apply_patches|autopatch)', '--', self.path]) == 0
def _revert_changes(self):
"""Revert uncommited changes made to spec file"""
@@ -618,22 +619,31 @@ class SpecFile(object):
failed_patch = None
cmd = None
cmd_output = []
+ cmd_before = (None, None)
# Determine the last command that failed
if os.path.exists(logfile):
print logfile
with open(logfile, "r") as f:
for line in line_input(f):
if line.startswith('+ '):
+ cmd_before = (cmd, cmd_before)
cmd = line[2:]
cmd_output = []
else:
cmd_output.append(line)
cmd_parsed = shlex.split(cmd) if cmd else []
+ 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' and os.path.exists(cmd_parsed[-1]):
- failed_patch = os.path.basename(cmd_parsed[-1])
+ if os.path.basename(cmd_parsed[0]) == 'patch':
+ 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]):
+ # for %autopatch as well as %patch
+ #+ /usr/bin/cat /home/src/pkgs/gnome-getting-started-docs/SOURCES/gs-browse-web-firefox.page.patch
+ #+ /usr/bin/patch -p1 -s
+ failed_patch = os.path.basename(cmd_before_parsed[-1])
# Patch is merged if there is at least one 'ignored' line and no 'FAILED' line anywhere
has_ignored = False