Make sure the absolute patch file is passed to the patch command.

According the patch(1) manpage:
The --directory option change to the directory dir immediately, before
doing anything else.

Thus if file is not relative to dir and making file absolute ensure that
patch will find it.
pull/18777/head
Sébastien Gross 10 years ago committed by Matt Clay
parent 4e24d2cdf7
commit 5f6121856f

@ -145,6 +145,9 @@ def main():
module.fail_json(msg="patch command not found") module.fail_json(msg="patch command not found")
patch_func = lambda opts: module.run_command("%s %s" % (patch_bin, ' '.join(opts))) patch_func = lambda opts: module.run_command("%s %s" % (patch_bin, ' '.join(opts)))
# patch need an absolute file name
p.src = os.path.abspath(p.src)
changed = False changed = False
if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, strip=p.strip): if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, strip=p.strip):
try: try:

Loading…
Cancel
Save