From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] oeqa.buildperf: use oe.path.remove()
Date: Thu, 11 Aug 2016 16:31:52 +0300 [thread overview]
Message-ID: <1470922312-28013-1-git-send-email-markus.lehtonen@linux.intel.com> (raw)
Drop the self-baked force_rm() method.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/lib/oeqa/buildperf/base.py | 15 ++++-----------
meta/lib/oeqa/buildperf/basic_tests.py | 5 +++--
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 527563b..2af4d25 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -21,6 +21,7 @@ import time
import traceback
from datetime import datetime, timedelta
+import oe.path
from oeqa.utils.commands import runCmd, get_bb_vars
from oeqa.utils.git import GitError, GitRepo
@@ -296,29 +297,21 @@ class BuildPerfTest(object):
shutil.move(self.bb_vars['BUILDSTATS_BASE'],
os.path.join(self.out_dir, 'buildstats-' + self.name))
- @staticmethod
- def force_rm(path):
- """Equivalent of 'rm -rf'"""
- if os.path.isfile(path) or os.path.islink(path):
- os.unlink(path)
- elif os.path.isdir(path):
- shutil.rmtree(path)
-
def rm_tmp(self):
"""Cleanup temporary/intermediate files and directories"""
log.debug("Removing temporary and cache files")
for name in ['bitbake.lock', 'conf/sanity_info',
self.bb_vars['TMPDIR']]:
- self.force_rm(name)
+ oe.path.remove(name, recurse=True)
def rm_sstate(self):
"""Remove sstate directory"""
log.debug("Removing sstate-cache")
- self.force_rm(self.bb_vars['SSTATE_DIR'])
+ oe.path.remove(self.bb_vars['SSTATE_DIR'], recurse=True)
def rm_cache(self):
"""Drop bitbake caches"""
- self.force_rm(self.bb_vars['PERSISTENT_DIR'])
+ oe.path.remove(self.bb_vars['PERSISTENT_DIR'], recurse=True)
@staticmethod
def sync():
diff --git a/meta/lib/oeqa/buildperf/basic_tests.py b/meta/lib/oeqa/buildperf/basic_tests.py
index ada5aba..81b2b5f 100644
--- a/meta/lib/oeqa/buildperf/basic_tests.py
+++ b/meta/lib/oeqa/buildperf/basic_tests.py
@@ -13,6 +13,7 @@
import os
import shutil
+import oe.path
from . import BuildPerfTest, perf_test_case
from oeqa.utils.commands import get_bb_vars
@@ -95,11 +96,11 @@ class Test3(BuildPerfTest):
def _run(self):
# Drop all caches and parse
self.rm_cache()
- self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache'))
+ oe.path.remove(os.path.join(self.bb_vars['TMPDIR'], 'cache'), True)
self.measure_cmd_resources(['bitbake', '-p'], 'parse_1',
'bitbake -p (no caches)')
# Drop tmp/cache
- self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache'))
+ oe.path.remove(os.path.join(self.bb_vars['TMPDIR'], 'cache'), True)
self.measure_cmd_resources(['bitbake', '-p'], 'parse_2',
'bitbake -p (no tmp/cache)')
# Parse with fully cached data
--
2.6.6
reply other threads:[~2016-08-11 13:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470922312-28013-1-git-send-email-markus.lehtonen@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox