diff options
Diffstat (limited to 'meta/classes/patch.bbclass')
| -rw-r--r-- | meta/classes/patch.bbclass | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index a724972821..3d22ad8381 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass @@ -44,7 +44,7 @@ def src_patches(d, all = False ): if patchdir: patchparm['patchdir'] = patchdir - localurl = bb.encodeurl(('file', '', local, '', '', patchparm)) + localurl = bb.fetch.encodeurl(('file', '', local, '', '', patchparm)) patches.append(localurl) if all: @@ -136,11 +136,17 @@ python patch_do_patch() { s = d.getVar('S', True) - path = os.getenv('PATH') os.putenv('PATH', d.getVar('PATH', True)) + # We must use one TMPDIR per process so that the "patch" processes + # don't generate the same temp file name. + + import tempfile + process_tmpdir = tempfile.mkdtemp() + os.environ['TMPDIR'] = process_tmpdir + for patch in src_patches(d): - _, _, local, _, _, parm = bb.decodeurl(patch) + _, _, local, _, _, parm = bb.fetch.decodeurl(patch) if "patchdir" in parm: patchdir = parm["patchdir"] @@ -161,11 +167,16 @@ python patch_do_patch() { try: patchset.Import({"file":local, "strippath": parm['striplevel']}, True) except Exception as exc: + bb.utils.remove(process_tmpdir, True) bb.fatal(str(exc)) try: resolver.Resolve() except bb.BBHandledException as e: + bb.utils.remove(process_tmpdir, True) bb.fatal(str(e)) + + bb.utils.remove(process_tmpdir, True) + del os.environ['TMPDIR'] } patch_do_patch[vardepsexclude] = "PATCHRESOLVE" |
