Skip to content

Commit

Permalink
Raise PatchError when patch fails
Browse files Browse the repository at this point in the history
Change-Id: Ia46b6149320828bfe914587153de6f745d5faaa2
Closes-Bug: #1532187
  • Loading branch information
eonpatapon committed Jan 8, 2016
1 parent 3d4a7e0 commit ca5a6c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fetch_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

from lxml import objectify


class PatchError(Exception):
pass


def getFilename(pkg, url):
element = pkg.find("local-filename")
if element:
Expand Down Expand Up @@ -81,6 +86,8 @@ def ApplyPatches(pkg):
fp = open(str(patch), 'r')
proc = subprocess.Popen(cmd, stdin = fp)
proc.communicate()
if not proc.returncode == 0:
raise PatchError('Failed to apply patch %s' % str(patch))

#def VarSubst(cmdstr, filename):
# return re.sub(r'\${filename}', filename, cmdstr)
Expand Down

0 comments on commit ca5a6c1

Please sign in to comment.