aboutsummaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorConstantin Musca <constantinx.musca@intel.com>2012-09-12 14:58:18 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-14 09:49:53 +0100
commit16dbf505c4fdd9fe1820d950ab05c8ea99ad7505 (patch)
treee4629c79478a0893bdc933c7847931b580d13b85 /meta
parent5c3fec058a2d370fbb625901ca1822ce04927ac2 (diff)
downloadopenembedded-core-contrib-16dbf505c4fdd9fe1820d950ab05c8ea99ad7505.tar.gz
patch.bbclass: Use one TMPDIR per patching process
We must use one TMPDIR per process (/tmp/${PID}) so that the patching processes don't generate the same temp file name (the "patch" program uses the TMPDIR environment variable for deciding where to create the temp files). [YOCTO #3070] Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/patch.bbclass11
1 files changed, 11 insertions, 0 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index a724972821..d01043807b 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -139,6 +139,13 @@ python patch_do_patch() {
path = os.getenv('PATH')
os.putenv('PATH', d.getVar('PATH', True))
+ import shutil
+ process_tmpdir = os.path.join('/tmp', str(os.getpid()))
+ if os.path.exists(process_tmpdir):
+ shutil.rmtree(process_tmpdir)
+ os.makedirs(process_tmpdir)
+ os.environ['TMPDIR'] = process_tmpdir
+
for patch in src_patches(d):
_, _, local, _, _, parm = bb.decodeurl(patch)
@@ -161,11 +168,15 @@ python patch_do_patch() {
try:
patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
except Exception as exc:
+ shutil.rmtree(process_tmpdir)
bb.fatal(str(exc))
try:
resolver.Resolve()
except bb.BBHandledException as e:
+ shutil.rmtree(process_tmpdir)
bb.fatal(str(e))
+
+ shutil.rmtree(process_tmpdir)
}
patch_do_patch[vardepsexclude] = "PATCHRESOLVE"