summaryrefslogtreecommitdiffstats
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:50:24 +0100
commit2a0d7aded81330e644ac766249aca06b63c3905c (patch)
tree0080fd8534c04b6568ae0cc34e631523b7607771
parentd7ef15a063d44ac50c320d9caf393a54c6a630e6 (diff)
downloadpoky-2a0d7aded81330e644ac766249aca06b63c3905c.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] (From OE-Core rev: 16dbf505c4fdd9fe1820d950ab05c8ea99ad7505) Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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() {
139 path = os.getenv('PATH') 139 path = os.getenv('PATH')
140 os.putenv('PATH', d.getVar('PATH', True)) 140 os.putenv('PATH', d.getVar('PATH', True))
141 141
142 import shutil
143 process_tmpdir = os.path.join('/tmp', str(os.getpid()))
144 if os.path.exists(process_tmpdir):
145 shutil.rmtree(process_tmpdir)
146 os.makedirs(process_tmpdir)
147 os.environ['TMPDIR'] = process_tmpdir
148
142 for patch in src_patches(d): 149 for patch in src_patches(d):
143 _, _, local, _, _, parm = bb.decodeurl(patch) 150 _, _, local, _, _, parm = bb.decodeurl(patch)
144 151
@@ -161,11 +168,15 @@ python patch_do_patch() {
161 try: 168 try:
162 patchset.Import({"file":local, "strippath": parm['striplevel']}, True) 169 patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
163 except Exception as exc: 170 except Exception as exc:
171 shutil.rmtree(process_tmpdir)
164 bb.fatal(str(exc)) 172 bb.fatal(str(exc))
165 try: 173 try:
166 resolver.Resolve() 174 resolver.Resolve()
167 except bb.BBHandledException as e: 175 except bb.BBHandledException as e:
176 shutil.rmtree(process_tmpdir)
168 bb.fatal(str(e)) 177 bb.fatal(str(e))
178
179 shutil.rmtree(process_tmpdir)
169} 180}
170patch_do_patch[vardepsexclude] = "PATCHRESOLVE" 181patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
171 182