Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-13 09:18:36 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-13 09:18:36 (GMT)
commit1e1cdf031fc9a4e605f0a2330ade060ed3533cfa (patch)
tree02107a20df3cb4f9bdd2e414f0c87d7c971c0b49
parent93cd79528320177da718f355eee2d2a6c45b496d (diff)
Clean from dn-build
So that we don't need to hardcode source paths
-rw-r--r--Makefile10
-rwxr-xr-xscripts/dn-build40
2 files changed, 30 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index bbe5b3b..f9c3beb 100644
--- a/Makefile
+++ b/Makefile
@@ -47,15 +47,7 @@ bug-report:
@$(SCRIPTS)/bug-report
clean:
- rm -rf build install
- rm -rf source/gstreamer
- rm -rf source/gst-plugins-base
- rm -rf source/gst-plugins-good
- rm -rf source/gst-plugins-espeak
- rm -rf source/gst-plugins-bad
- rm -rf source/gst-plugins-ugly
- rm -rf source/gst-ffmpeg
- rm -rf source/sugar-fructose
+ $(DNBUILD) clean
rm -f logs/*.log logs/all-logs.tar.bz2
rm -f scripts/list-outputs
rm -f scripts/find-free-display
diff --git a/scripts/dn-build b/scripts/dn-build
index d7f68c0..fb4bae8 100755
--- a/scripts/dn-build
+++ b/scripts/dn-build
@@ -5,6 +5,7 @@ import glob
import json
import os
import multiprocessing
+import shutil
import sys
import subprocess
@@ -143,6 +144,15 @@ def build(module):
state["built_modules"][module["name"]] = get_module_commit_id(module)
save_state()
+def load_modules():
+ modules = []
+
+ for module_file in module_files:
+ path = os.path.join(modules_dir, module_file)
+ modules.extend(json.load(open(path)))
+
+ return modules
+
def clear_built_modules(modules, index):
if index < len(modules) - 1:
for module in modules[index + 1:]:
@@ -150,11 +160,12 @@ def clear_built_modules(modules, index):
if name in state["built_modules"]:
del state["built_modules"][name]
+def rmtree(dir):
+ print "Deleting %s" % dir
+ shutil.rmtree(dir, ignore_errors=True)
+
def cmd_build():
- modules = []
- for module_file in module_files:
- path = os.path.join(modules_dir, module_file)
- modules.extend(json.load(open(path)))
+ modules = load_modules()
for i, module in enumerate(modules):
print "\n=== Building %s ===\n" % module["name"]
@@ -180,6 +191,14 @@ def cmd_shell():
def cmd_run():
os.execlp(sys.argv[2], *sys.argv[2:])
+def cmd_clean():
+ rmtree(install_dir)
+ rmtree(build_dir)
+
+ for module in load_modules():
+ if not module.get("out-of-source", True):
+ rmtree(get_module_source_dir(module))
+
def setup_environ():
add_path("LD_LIBRARY_PATH", lib_dir)
add_path("PATH", bin_dir)
@@ -252,13 +271,12 @@ def main():
setup_gconf()
setup_environ()
- if sys.argv[1] == "build":
- cmd_build()
- elif sys.argv[1] == "shell":
- cmd_shell()
- elif sys.argv[1] == "run":
- cmd_run()
+ commands = {"build": cmd_build,
+ "shell": cmd_shell,
+ "run": cmd_run,
+ "clean": cmd_clean}
- save_state()
+ if sys.argv[1]:
+ commands[sys.argv[1]]()
main()