diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 00:22:01 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 00:22:01 (GMT) |
commit | 9c6636a761d2bc627e744e6b0efc45cc7672c485 (patch) | |
tree | 9140286204564cc901ef645caeac3155e0fd2b19 /devbot/system.py | |
parent | 15980e294fcb70ce8e04efb198b26f66c4241ecb (diff) |
On run check the system only if something changed
Diffstat (limited to 'devbot/system.py')
-rw-r--r-- | devbot/system.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/devbot/system.py b/devbot/system.py index 2a8d189..57e223c 100644 --- a/devbot/system.py +++ b/devbot/system.py @@ -6,8 +6,9 @@ import sys from devbot import config from devbot import distro from devbot import command +from devbot import state +from devbot import utils -devnull = open("/dev/null", "w") xvfb_display = ":100" libdirs = ["lib", @@ -17,7 +18,7 @@ libdirs = ["lib", def check_binary(check): return subprocess.call(["which", check], - stdout=devnull, + stdout=utils.devnull, stderr=subprocess.STDOUT) def check_pkgconfig(check): @@ -25,7 +26,8 @@ def check_pkgconfig(check): def check_python(check): return subprocess.call(["python", "-c", check], - stdout=devnull, stderr=subprocess.STDOUT) == 1 + stdout=utils.devnull, + stderr=subprocess.STDOUT) == 1 def check_gtkmodule(check): # Not sure we can do better than this, the gtkmodule stuff is private @@ -109,7 +111,7 @@ def run_checks(package_manager, checks, packages): def start_xvfb(): xvfb_proc = subprocess.Popen(args=["Xvfb", xvfb_display], - stdout=devnull, + stdout=utils.devnull, stderr=subprocess.STDOUT) orig_display = os.environ.get("DISPLAY", None) os.environ["DISPLAY"] = xvfb_display @@ -163,7 +165,12 @@ def remove_packages(package_manager, packages): if to_remove: package_manager.remove_packages(to_remove) -def check(remove=False, update=False, test=False, interactive=True): +def check(remove=False, update=False, test=False, interactive=True, + skip_if_unchanged=False): + if skip_if_unchanged: + if config.get_commit_id() == state.get_last_system_check(): + return + print "Checking the system" package_manager = \ @@ -188,4 +195,6 @@ def check(remove=False, update=False, test=False, interactive=True): package_manager.update() if remove: - remove_packages(package_manager, packages) + remove_packages(package_manager, packages) + + state.touch_last_system_check() |