diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-03 22:23:18 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-03 22:23:18 (GMT) |
commit | 38720618e2382cae228b8b839203b26ab344a26c (patch) | |
tree | bf0c8a130466c5088376ee7a5b061e6049159bfc | |
parent | f5169db238558ab5ac70dc98e82fb8e7581cc4c0 (diff) |
Check system before setting up the environ
-rwxr-xr-x | commands/check-system | 16 | ||||
-rw-r--r-- | commands/common.py | 23 | ||||
-rwxr-xr-x | commands/pull | 4 | ||||
-rw-r--r-- | devbot/main.py | 10 | ||||
-rw-r--r-- | devbot/system.py | 2 |
5 files changed, 26 insertions, 29 deletions
diff --git a/commands/check-system b/commands/check-system index f610bcb..f471f58 100755 --- a/commands/check-system +++ b/commands/check-system @@ -1,15 +1,10 @@ #!/usr/bin/python -u import argparse -import sys import os import common -from devbot import system - -common.setup() - parser = argparse.ArgumentParser(description='Check the system') parser.add_argument("--update", action="store_true", help="first of all update the system") @@ -21,8 +16,9 @@ args = parser.parse_args() interactive = "SUGAR_BUILDBOT" not in os.environ -if not system.check(update=args.update, - remove=args.remove, - test=args.test, - interactive=interactive): - sys.exit(1) +check_args = {"update": args.update, + "remove": args.remove, + "test": args.test, + "interactive": interactive} + +common.setup(check_args=check_args) diff --git a/commands/common.py b/commands/common.py index 4091545..62b53b5 100644 --- a/commands/common.py +++ b/commands/common.py @@ -8,13 +8,16 @@ sys.path.append(base_dir) from devbot import main -def setup(log_name=None): - main.setup({"config_dir": os.path.join(base_dir, "config"), - "install_dir": os.path.join(base_dir, "install"), - "source_dir": os.path.join(base_dir, "source"), - "build_dir": os.path.join(base_dir, "build"), - "state_dir": os.path.join(base_dir, "state"), - "prefs_path": os.path.join(base_dir, "prefs"), - "logs_dir": os.path.join(base_dir, "logs"), - "relocatable": "SUGAR_BUILDBOT" in os.environ, - "log_name": log_name}) +def setup(log_name=None, check_args={}): + config_args = {"config_dir": os.path.join(base_dir, "config"), + "install_dir": os.path.join(base_dir, "install"), + "source_dir": os.path.join(base_dir, "source"), + "build_dir": os.path.join(base_dir, "build"), + "state_dir": os.path.join(base_dir, "state"), + "prefs_path": os.path.join(base_dir, "prefs"), + "logs_dir": os.path.join(base_dir, "logs"), + "relocatable": "SUGAR_BUILDBOT" in os.environ, + "log_name": log_name} + + if not main.setup(config_args, check_args): + sys.exit(1) diff --git a/commands/pull b/commands/pull index 7314278..4e3ca8f 100755 --- a/commands/pull +++ b/commands/pull @@ -6,7 +6,6 @@ import sys import common from devbot import build -from devbot import system parser = argparse.ArgumentParser() parser.add_argument("module", nargs="?", help="name of the module to pull") @@ -18,8 +17,5 @@ if args.module: if not build.pull_one(args.module): sys.exit(1) else: - if not system.check(lazy=True): - sys.exit(1) - if not build.pull(): sys.exit(1) diff --git a/devbot/main.py b/devbot/main.py index 1584e6a..eaa31a3 100644 --- a/devbot/main.py +++ b/devbot/main.py @@ -17,9 +17,6 @@ def run_build(full=False): state.full_build_touch() - if not system.check(lazy=True): - return False - if not build.pull(lazy=True): return False @@ -35,10 +32,15 @@ def load_plugins(): imp.load_module(name, f, filename, desc) -def setup(config_args): +def setup(config_args, check_args): load_plugins() config.setup(**config_args) + if not system.check(**check_args): + return False + environ.setup_variables() environ.setup_gconf() + + return True diff --git a/devbot/system.py b/devbot/system.py index cefca1c..dc2ac42 100644 --- a/devbot/system.py +++ b/devbot/system.py @@ -11,7 +11,7 @@ _checkers = {} def check(remove=False, update=False, test=False, interactive=True, - lazy=False): + lazy=True): if lazy: if state.system_check_is_unchanged(): return True |