]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/utils/buildproject: create a more unique tmp dir
authorJoshua Lock <joshua.g.lock@intel.com>
Wed, 5 Apr 2017 12:10:53 +0000 (13:10 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 6 Apr 2017 09:13:34 +0000 (10:13 +0100)
Rather than hardcoding /tmp as the default tmpdir make a more unique tmpdir
with tempfile.mkdtemp() when the caller doesn't specify a tmpdir value.

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/buildproject.py

index fc8879cfb82a5aee3f627c0d382412ac7cad74ce..487f08be496b22c58e6973bf1b11b5340acc797d 100644 (file)
@@ -8,14 +8,17 @@ import os
 import re
 import subprocess
 import shutil
+import tempfile
 
 from abc import ABCMeta, abstractmethod
 
 class BuildProject(metaclass=ABCMeta):
-    def __init__(self, uri, foldername=None, tmpdir="/tmp/", dl_dir=None):
+    def __init__(self, uri, foldername=None, tmpdir=None, dl_dir=None):
         self.uri = uri
         self.archive = os.path.basename(uri)
-        self.localarchive = os.path.join(tmpdir,self.archive)
+        if not tmpdir:
+            tmpdir = tempfile.mkdtemp(prefix='buildproject')
+        self.localarchive = os.path.join(tmpdir, self.archive)
         self.dl_dir = dl_dir
         if foldername:
             self.fname = foldername