From eda4c740fa49a60ca558276e2914d364ddeabe03 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Sat, 4 Oct 2008 20:55:42 -1000 Subject: [PATCH] Put all temp files in to the same subdirectory. Use the system default temp directory (can override with TMPDIR env var), but make a lorax subdirectory in that directory for all of the lorax trees. --- src/pylorax/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 4e245c28..889d6601 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -37,6 +37,7 @@ import instroot conf = {} conf['confdir'] = '/etc/lorax' +conf['tmpdir'] = tempfile.gettempdir() def show_version(prog): """show_version(prog) @@ -89,10 +90,10 @@ def initializeDirs(output): if not os.path.isdir(output): os.makedirs(output, mode=0755) - tmpdir = tempfile.gettempdir() - buildinstdir = tempfile.mkdtemp('XXXXXX', 'buildinstall.tree.', tmpdir) - treedir = tempfile.mkdtemp('XXXXXX', 'treedir.', tmpdir) - cachedir = tempfile.mkdtemp('XXXXXX', 'yumcache.', tmpdir) + conf['tmpdir'] = tempfile.mkdtemp('XXXXXX', 'lorax.tmp.', conf['tmpdir']) + buildinstdir = tempfile.mkdtemp('XXXXXX', 'buildinstall.tree.', conf['tmpdir']) + treedir = tempfile.mkdtemp('XXXXXX', 'treedir.', conf['tmpdir']) + cachedir = tempfile.mkdtemp('XXXXXX', 'yumcache.', conf['tmpdir']) return buildinstdir, treedir, cachedir