update.py: avoid writing bitbake.lock/cache to current directory

Create a temporary directory for these files.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-06 17:48:40 +00:00
parent 445b17d3cf
commit df76a64d95
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,8 @@ import subprocess
from datetime import datetime
import fnmatch
import re
import tempfile
import shutil
from distutils.version import LooseVersion
def logger_create():
@ -268,6 +270,12 @@ def main():
out = runcmd("git clean -f -x", core_repodir)
os.environ['BBPATH'] = str("%s:%s" % (os.path.realpath('.'), core_layerdir))
# Change into a temporary directory so we don't write the cache and other files to the current dir
if not os.path.exists(settings.TEMP_BASE_DIR):
os.makedirs(settings.TEMP_BASE_DIR)
tempdir = tempfile.mkdtemp(dir=settings.TEMP_BASE_DIR)
os.chdir(tempdir)
sys.path.extend([bitbakepath + '/lib'])
import bb.tinfoil
import bb.cooker
@ -478,6 +486,7 @@ def main():
finally:
transaction.leave_transaction_management()
shutil.rmtree(tempdir)
sys.exit(0)

View File

@ -176,6 +176,9 @@ LOGIN_REDIRECT_URL = '/layerindex'
# Full path to directory where layers should be fetched into by the update script
LAYER_FETCH_DIR = ""
# Base temporary directory in which to create a directory in which to run BitBake
TEMP_BASE_DIR = "/tmp"
# Fetch URL of the BitBake repository for the update script
BITBAKE_REPO_URL = "git://git.openembedded.org/bitbake"