Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-26 22:51:22 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-26 22:51:22 (GMT)
commit7733514f0860ed1529c9effe831aa683cdc7d3c4 (patch)
tree6f42cc9aca7ec73a08412beb108b424a66d5444b /devbot
parentf7a5dd469a381c1b2f358f41bcd105cf4651df56 (diff)
Cleanup clean
Diffstat (limited to 'devbot')
-rw-r--r--devbot/build.py11
-rw-r--r--devbot/clean.py7
-rw-r--r--devbot/config.py7
-rw-r--r--devbot/logs.py15
-rw-r--r--devbot/state.py21
5 files changed, 36 insertions, 25 deletions
diff --git a/devbot/build.py b/devbot/build.py
index 31f926d..a2f276a 100644
--- a/devbot/build.py
+++ b/devbot/build.py
@@ -58,7 +58,6 @@ def pull(lazy=False):
def build(full=False):
if full or state.full_build_is_required():
- state.clean_build_state()
clean()
environ.setup()
@@ -93,15 +92,20 @@ def distribute():
def clean():
- print "= Cleaning =\n"
+ print "\n= Clean =\n"
+ state.clean(build_only=True)
+
+ print "* Deleting install directory"
_empty_dir(config.install_dir)
+
+ print "* Deleting build directory"
_empty_dir(config.get_build_dir())
for module in config.load_modules():
if not module.out_of_source:
if module.get_git_module().clean():
- print "* Cleaning %s git repository" % module.name
+ print "* Deleting %s" % module.name
def _ccache_reset():
@@ -274,6 +278,5 @@ def _distribute_module(module, log=None):
def _empty_dir(dir_path):
- print "Emptying %s directory" % dir_path
shutil.rmtree(dir_path, ignore_errors=True)
os.mkdir(dir_path)
diff --git a/devbot/clean.py b/devbot/clean.py
new file mode 100644
index 0000000..2ea935b
--- /dev/null
+++ b/devbot/clean.py
@@ -0,0 +1,7 @@
+from devbot import build
+from devbot import logs
+
+
+def clean():
+ build.clean()
+ logs.clean()
diff --git a/devbot/config.py b/devbot/config.py
index 9637b4e..ae1509c 100644
--- a/devbot/config.py
+++ b/devbot/config.py
@@ -189,13 +189,6 @@ def load_modules():
return [Module(info) for info in filter(_filter_if, modules)]
-def clean():
- try:
- os.rmdir(logs_dir)
- except OSError:
- pass
-
-
def _filter_if(item):
if "if" not in item:
return True
diff --git a/devbot/logs.py b/devbot/logs.py
new file mode 100644
index 0000000..e85d21d
--- /dev/null
+++ b/devbot/logs.py
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+import os
+
+from devbot import config
+
+
+def clean():
+ print "* Deleting logs"
+
+ try:
+ for filename in os.listdir(config.logs_dir):
+ os.unlink(os.path.join(config.logs_dir, filename))
+ except OSError:
+ pass
diff --git a/devbot/state.py b/devbot/state.py
index 41d458b..4b9af18 100644
--- a/devbot/state.py
+++ b/devbot/state.py
@@ -101,22 +101,15 @@ def full_build_touch():
_save_state(_FULL_BUILD, full_build)
-def clean_build_state():
- try:
- for name in _BUILT_MODULES, _FULL_BUILD:
- os.unlink(_get_state_path(name))
- except OSError:
- pass
+def clean(build_only=False):
+ print "* Deleting state"
-
-def clean():
- _state = None
-
- print "Deleting state"
-
- clean_build_state()
+ names = [_BUILT_MODULES, _FULL_BUILD]
+ if not build_only:
+ names.append(_SYSTEM_CHECK)
try:
- os.unlink(_get_state_path(_SYSTEM_CHECK))
+ for name in names:
+ os.unlink(_get_state_path(name))
except OSError:
pass