diff options
-rw-r--r-- | meta/classes/patch.bbclass | 11 |
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 | } |
170 | patch_do_patch[vardepsexclude] = "PATCHRESOLVE" | 181 | patch_do_patch[vardepsexclude] = "PATCHRESOLVE" |
171 | 182 | ||