diff options
author | Corneliu Stoicescu <corneliux.stoicescu@intel.com> | 2014-03-06 18:35:55 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-07 14:55:27 +0000 |
commit | d002bcf7f80fd9652d3f310957c99bd1e6c8b3a1 (patch) | |
tree | aa7134112e714955122408fb636daef0442c12b4 /meta/lib | |
parent | 2a9a14bf400fe0c263c58aa85b02aba7311b1328 (diff) | |
download | openembedded-core-d002bcf7f80fd9652d3f310957c99bd1e6c8b3a1.tar.gz openembedded-core-d002bcf7f80fd9652d3f310957c99bd1e6c8b3a1.tar.bz2 openembedded-core-d002bcf7f80fd9652d3f310957c99bd1e6c8b3a1.zip |
oe-selftest: optimize code in _sstatetests_noauto.py module
1) Some of the checks made when creating new directories are unnecessary beacause
the test will fail anyway if os.mkdir() fails, with the appropriate error message.
Removing this code.
2) Moved the adding to tracked paths for deletion of temporary build directories
and sstate-cache directories to after they are created. This makes more sense
and prevents deletion of these directories if they allready exist and may contain
useful data.
Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/_sstatetests_noauto.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/meta/lib/oeqa/selftest/_sstatetests_noauto.py b/meta/lib/oeqa/selftest/_sstatetests_noauto.py index 5253334e12..97366d97ae 100644 --- a/meta/lib/oeqa/selftest/_sstatetests_noauto.py +++ b/meta/lib/oeqa/selftest/_sstatetests_noauto.py @@ -24,23 +24,15 @@ class RebuildFromSState(SStateBase): return found_targets def configure_builddir(self, builddir): - if os.path.exists(builddir): - raise AssertionError("Cannot create build directory at %s: Path allready exists!" % builddir) - try: - os.mkdir(builddir) - except: - raise AssertionError("Cannot create %s . Make sure %s exists!" % (dst, os.path.dirname(dst))) + os.mkdir(builddir) + self.track_for_cleanup(builddir) os.mkdir(os.path.join(builddir, 'conf')) shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'), os.path.join(builddir, 'conf/local.conf')) shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/bblayers.conf'), os.path.join(builddir, 'conf/bblayers.conf')) def hardlink_tree(self, src, dst): - if os.path.exists(dst): - raise AssertionError("Cannot create directory at %s: Path allready exists!" % dst) - try: - os.mkdir(dst) - except: - raise AssertionError("Cannot create %s . Make sure %s exists!" % (dst, os.path.dirname(dst))) + os.mkdir(dst) + self.track_for_cleanup(dst) for root, dirs, files in os.walk(src): if root == src: continue @@ -54,9 +46,6 @@ class RebuildFromSState(SStateBase): buildB = os.path.join(self.builddir, 'buildB') else: buildB = buildA - self.track_for_cleanup(buildA) - self.track_for_cleanup(buildB) - self.track_for_cleanup(os.path.join(self.builddir, 'sstate-cache-buildA')) if rebuild_dependencies: rebuild_targets = self.get_dep_targets(primary_targets) |