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.
This commit is contained in:
Sébastien Gross 2015-03-20 17:19:15 +01:00 committed by Matt Clay
parent 4e24d2cdf7
commit 5f6121856f

View file

@ -145,6 +145,9 @@ def main():
module.fail_json(msg="patch command not found")
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
if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, strip=p.strip):
try: