diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/patch.bbclass | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index d01043807b..ed12802491 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass | |||
@@ -139,11 +139,11 @@ 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 | 142 | # We must use one TMPDIR per process so that the "patch" processes |
143 | process_tmpdir = os.path.join('/tmp', str(os.getpid())) | 143 | # don't generate the same temp file name. |
144 | if os.path.exists(process_tmpdir): | 144 | |
145 | shutil.rmtree(process_tmpdir) | 145 | import tempfile |
146 | os.makedirs(process_tmpdir) | 146 | process_tmpdir = tempfile.mkdtemp() |
147 | os.environ['TMPDIR'] = process_tmpdir | 147 | os.environ['TMPDIR'] = process_tmpdir |
148 | 148 | ||
149 | for patch in src_patches(d): | 149 | for patch in src_patches(d): |
@@ -168,15 +168,15 @@ python patch_do_patch() { | |||
168 | try: | 168 | try: |
169 | patchset.Import({"file":local, "strippath": parm['striplevel']}, True) | 169 | patchset.Import({"file":local, "strippath": parm['striplevel']}, True) |
170 | except Exception as exc: | 170 | except Exception as exc: |
171 | shutil.rmtree(process_tmpdir) | 171 | bb.utils.remove(process_tmpdir, True) |
172 | bb.fatal(str(exc)) | 172 | bb.fatal(str(exc)) |
173 | try: | 173 | try: |
174 | resolver.Resolve() | 174 | resolver.Resolve() |
175 | except bb.BBHandledException as e: | 175 | except bb.BBHandledException as e: |
176 | shutil.rmtree(process_tmpdir) | 176 | bb.utils.remove(process_tmpdir, True) |
177 | bb.fatal(str(e)) | 177 | bb.fatal(str(e)) |
178 | 178 | ||
179 | shutil.rmtree(process_tmpdir) | 179 | bb.utils.remove(process_tmpdir, True) |
180 | } | 180 | } |
181 | patch_do_patch[vardepsexclude] = "PATCHRESOLVE" | 181 | patch_do_patch[vardepsexclude] = "PATCHRESOLVE" |
182 | 182 | ||