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-11-29 16:18:29 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-29 16:18:29 (GMT)
commit05b2c03cf3971303354b3a188fbbb0bbb8d554fc (patch)
tree48d3cd2f58036285e00fb9a1537206d514aa2eea /devbot
parent19843bd69f1ca9085e0126c6fe19a042f31cbe3f (diff)
Make json configs a bit smarter
To get rid of the duplication in deps
Diffstat (limited to 'devbot')
-rw-r--r--devbot/config.py11
-rw-r--r--devbot/plugins/debian.py1
-rw-r--r--devbot/plugins/fedora.py2
-rw-r--r--devbot/plugins/interfaces.py3
-rw-r--r--devbot/plugins/ubuntu.py1
-rw-r--r--devbot/plugins/unknown.py1
-rw-r--r--devbot/system.py15
7 files changed, 33 insertions, 1 deletions
diff --git a/devbot/config.py b/devbot/config.py
index a264ccb..259c4f2 100644
--- a/devbot/config.py
+++ b/devbot/config.py
@@ -223,6 +223,15 @@ def load_prerequisites():
path = os.path.join(config_dir, "deps", "prerequisites.json")
return json.load(open(path))
+def _filter_if(item):
+ if "if" not in item:
+ return True
+
+ distro_info = distro.get_distro_info()
+ globals = { "gstreamer_version": distro_info.gstreamer_version }
+
+ return eval(item["if"], globals)
+
def load_checks():
version = distro.get_distro_info().system_version
@@ -231,7 +240,7 @@ def load_checks():
path = os.path.join(config_dir, "deps", "%s.json" % file)
checks.extend(json.load(open(path)))
- return checks
+ return filter(_filter_if, checks)
def load_modules():
version = distro.get_distro_info().system_version
diff --git a/devbot/plugins/debian.py b/devbot/plugins/debian.py
index 8ba62b0..38d5be4 100644
--- a/devbot/plugins/debian.py
+++ b/devbot/plugins/debian.py
@@ -90,6 +90,7 @@ class DistroInfo(interfaces.DistroInfo):
self.name = "debian"
self.version = "unknown"
self.system_version = "3.4"
+ self.gstreamer_version = "0.10"
self.valid = True
self.supported = (arch in ["i686", "x86_64"])
self.use_lib64 = False
diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py
index 083c479..3cfdfef 100644
--- a/devbot/plugins/fedora.py
+++ b/devbot/plugins/fedora.py
@@ -88,6 +88,7 @@ class DistroInfo(interfaces.DistroInfo):
self.name = "fedora"
self.version = "unknown"
self.system_version = "3.6"
+ self.gstreamer_version = "1.0"
self.use_lib64 = (arch == "x86_64")
self.valid = True
self.supported = (arch in ["i386", "i686", "x86_64"])
@@ -101,6 +102,7 @@ class DistroInfo(interfaces.DistroInfo):
if release == "Fedora release 17 (Beefy Miracle)":
self.version = "17"
self.system_version = "3.4"
+ self.gstreamer_version = "0.10"
elif release == "Fedora release 18 (Spherical Cow)":
self.version = "18"
else:
diff --git a/devbot/plugins/interfaces.py b/devbot/plugins/interfaces.py
index 0c9c0b6..c6db014 100644
--- a/devbot/plugins/interfaces.py
+++ b/devbot/plugins/interfaces.py
@@ -48,6 +48,9 @@ class DistroInfo:
major version of GNOME installed on the system.
"""
+ self.gstreamer_version = None
+ """The version of gstreamer shipped with the distribution."""
+
self.valid = False
"""If set to True we are running on this distribution and the
attributes are all valid.
diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py
index 4db0dd1..556aaab 100644
--- a/devbot/plugins/ubuntu.py
+++ b/devbot/plugins/ubuntu.py
@@ -13,6 +13,7 @@ class DistroInfo(interfaces.DistroInfo):
self.name = "ubuntu"
self.version = "unknown"
self.system_version = "3.4"
+ self.gstreamer_version = "1.0"
self.valid = True
self.supported = (arch in ["i386", "i686", "x86_64"])
self.use_lib64 = False
diff --git a/devbot/plugins/unknown.py b/devbot/plugins/unknown.py
index 826f643..f843fd5 100644
--- a/devbot/plugins/unknown.py
+++ b/devbot/plugins/unknown.py
@@ -32,6 +32,7 @@ class DistroInfo(interfaces.DistroInfo):
self.name = "unknown"
self.version = "unknown"
self.system_version = "3.4"
+ self.gstreamer_version = "0.10"
self.valid = True
self.supported = False
diff --git a/devbot/system.py b/devbot/system.py
index 0bbfe8d..5757424 100644
--- a/devbot/system.py
+++ b/devbot/system.py
@@ -77,6 +77,17 @@ def _print_checks(checks):
for check in checks:
print "[%s] %s" % (check["checker"], check["check"])
+def _eval_check_if(check):
+ if "check_if" not in check:
+ return True
+
+ distro_info = distro.get_distro_info()
+ globals = { "distro": "%s-%s" % (distro_info.name, distro_info.version) }
+
+ print eval(check["check_if"], globals)
+
+ return eval(check["check_if"], globals) == "True"
+
def run_checks(package_manager, checks, packages):
distro_info = distro.get_distro_info()
@@ -85,6 +96,10 @@ def run_checks(package_manager, checks, packages):
to_install = []
for check in checks:
+ if not _eval_check_if(check):
+ print "uuuuu"
+ continue
+
checker = checkers[check["checker"]]
if checker(check["check"]):
if distro_info.name in packages[check["name"]]: