diff options
author | Olav Vitters <olav@vitters.nl> | 2014-07-23 17:17:54 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2014-07-23 17:17:54 +0200 |
commit | 05b4834842c712b5f4b4c55ec866f54eb08de287 (patch) | |
tree | 6a5acec811c48cf56f69bd902986472800e042bf | |
parent | 26458b003060faac1a41490eaf45fefd7d7ef804 (diff) | |
download | mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.gz mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.bz2 mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.tar.xz mgagnome-05b4834842c712b5f4b4c55ec866f54eb08de287.zip |
also handle %autopatch
-rwxr-xr-x | mgagnome | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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 |