rrs/tools: ensure recipe parsing code deletes temporary dir

load_recipes() was leaving files around in /tmp; on my Fedora system
this eventually resulted in /tmp running out of space which we do not
want.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-03-29 00:43:22 +13:00
parent 404e86a5a3
commit 70084bd48d
4 changed files with 10 additions and 4 deletions

View File

@ -121,7 +121,7 @@ def load_recipes(layerbranch, bitbakepath, fetchdir, settings, logger,
% (layerbranch, fn, str(e)))
continue
return (tinfoil, d, recipes)
return (tinfoil, d, recipes, tempdir)
# XXX: Copied from oe-core recipeutils to avoid import errors.
def get_recipe_pv_without_srcpv(pv, uri_type):

View File

@ -12,6 +12,7 @@ import os.path
import optparse
import logging
from datetime import datetime
import shutil
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
from common import common_setup, load_recipes, \
@ -108,7 +109,7 @@ if __name__=="__main__":
for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch
sys.path = origsyspath
(tinfoil, d, recipes) = load_recipes(layerbranch, bitbakepath,
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
fetchdir, settings, logger)
try:
if not recipes:
@ -144,6 +145,7 @@ if __name__=="__main__":
str(layerbranch), distro, alias))
finally:
tinfoil.shutdown()
shutil.rmtree(tempdir)
if options.dry_run:
raise DryRunRollbackException
except DryRunRollbackException:

View File

@ -12,6 +12,7 @@ import os.path
import optparse
import logging
from datetime import datetime
import shutil
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
from common import common_setup, load_recipes, \
@ -176,7 +177,7 @@ if __name__=="__main__":
file = str(os.path.join(layerdir, recipe.full_path()))
recipe_files.append(file)
(tinfoil, d, recipes) = load_recipes(layerbranch, bitbakepath,
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
fetchdir, settings, logger, recipe_files=recipe_files)
try:
@ -208,6 +209,7 @@ if __name__=="__main__":
finally:
tinfoil.shutdown()
shutil.rmtree(tempdir)
if options.dry_run:
raise DryRunRollbackException
except DryRunRollbackException:

View File

@ -16,6 +16,7 @@ import optparse
import logging
import re
from distutils.version import LooseVersion
import shutil
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
from common import common_setup, get_pv_type, load_recipes, \
@ -182,7 +183,7 @@ def generate_history(options, layerbranch_id, commit, logger):
utils.runcmd("git clean -dfx", bitbakepath, logger=logger)
sys.path.insert(0, os.path.join(bitbakepath, 'lib'))
(tinfoil, d, recipes) = load_recipes(layerbranch, bitbakepath,
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
fetchdir, settings, logger, recipe_files=fns,
nocheckout=True)
try:
@ -212,6 +213,7 @@ def generate_history(options, layerbranch_id, commit, logger):
finally:
if tinfoil and hasattr(tinfoil, 'shutdown') and (LooseVersion(bb.__version__) > LooseVersion("1.27")):
tinfoil.shutdown()
shutil.rmtree(tempdir)
if __name__=="__main__":