From c1613f76159e98ebd449ef557dbb9705bbf55b97 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Sat, 24 Nov 2012 22:51:41 +0000 Subject: Create build and source dir on demand Otherwise they are created in the snapshot --- diff --git a/devbot/build.py b/devbot/build.py index ca0bc07..de9e59a 100644 --- a/devbot/build.py +++ b/devbot/build.py @@ -66,7 +66,7 @@ def pull_source(module): command.run(["git", "remote", "set-url", "origin", module.repo]) command.run(["git", "remote", "update", "origin"], retry=10) else: - os.chdir(config.source_dir) + os.chdir(config.get_source_dir()) command.run(["git", "clone", "--progress", module.repo, module.name], retry=10) @@ -160,7 +160,7 @@ def build(): def clean(): rmtree(config.install_dir) rmtree(config.prefix_dir) - rmtree(config.build_dir) + rmtree(config.get_build_dir()) for module in config.load_modules(): if not module.out_of_source: diff --git a/devbot/config.py b/devbot/config.py index a5926fe..8a734d5 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -9,8 +9,6 @@ logs_dir = None commands_dir = None install_dir = None prefix_dir = None -source_dir = None -build_dir = None lib_dir = None devbot_dir = None share_dir = None @@ -21,6 +19,9 @@ module_files = None package_files = None prefs_path = None +_source_dir = None +_build_dir = None + class Module: def __init__(self, info): self.name = info["name"] @@ -35,10 +36,10 @@ class Module: self.out_of_source = info.get("out-of-source", True) def get_source_dir(self): - return os.path.join(source_dir, self.name) + return os.path.join(get_source_dir(), self.name) def get_build_dir(self): - return os.path.join(build_dir, self.name) + return os.path.join(get_build_dir(), self.name) def _ensure_dir(dir): if not os.path.exists(dir): @@ -109,16 +110,22 @@ def set_install_dir(dir, relocatable=False): system_lib_dir = "/usr/lib" def set_source_dir(dir): - global source_dir - - source_dir = dir - _ensure_dir(source_dir) + global _source_dir + _source_dir = dir def set_build_dir(dir): - global build_dir - - build_dir = dir - _ensure_dir(build_dir) + global _build_dir + _build_dir = dir + +def get_source_dir(): + global _source_dir + _ensure_dir(_source_dir) + return _source_dir + +def get_build_dir(): + global _build_dir + _ensure_dir(_build_dir) + return _build_dir def set_commands_dir(dir): global commands_dir -- cgit v0.9.1