Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/plugins
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-28 13:49:15 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-28 13:49:15 (GMT)
commitd67e269de9e21ce4ad4cd1608cc8b0ff969c0642 (patch)
tree1248fbe24ac685f0d1eee39433d21a5bd505d30c /devbot/plugins
parent19682716ac2d00cfb378bb83db9195bd3ac62135 (diff)
Improve feedback for non supported distributions
If we are on a distribution which is known, but the version or the architecture is not supported, suggest a list of packages to install.
Diffstat (limited to 'devbot/plugins')
-rw-r--r--devbot/plugins/fedora.py36
-rw-r--r--devbot/plugins/interfaces.py3
-rw-r--r--devbot/plugins/ubuntu.py44
-rw-r--r--devbot/plugins/unknown.py1
4 files changed, 46 insertions, 38 deletions
diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py
index e7ee7f0..0f48669 100644
--- a/devbot/plugins/fedora.py
+++ b/devbot/plugins/fedora.py
@@ -83,30 +83,26 @@ distro.register_package_manager("fedora", PackageManager)
class DistroInfo(interfaces.DistroInfo):
def __init__(self):
- self.use_lib64 = os.uname()[4] == "x86_64"
-
arch = subprocess.check_output(["uname", "-i"]).strip()
self.name = "fedora"
- self.version = None
- self.system_version = None
- self.valid = False
-
- if arch in ["i386", "i686", "x86_64"]:
- fedora_release = self._get_fedora_release()
- if fedora_release == "Fedora release 17 (Beefy Miracle)":
- self.version = "17"
- self.system_version = "3.4"
- self.valid = True
- elif fedora_release == "Fedora release 18 (Spherical Cow)":
- self.version = "18"
- self.system_version = "3.6"
- self.valid = True
-
- def _get_fedora_release(self):
+ self.version = "unknown"
+ self.system_version = "3.6"
+ self.use_lib64 = (arch == "x86_64")
+ self.valid = True
+ self.supported = (arch in ["i386", "i686", "x86_64"])
+
try:
- return open("/etc/fedora-release").read().strip()
+ release = open("/etc/fedora-release").read().strip()
except IOError:
- return None
+ self.valid = False
+ if release == "Fedora release 17 (Beefy Miracle)":
+ self.version = "17"
+ self.system_version = "3.4"
+ elif release == "Fedora release 18 (Spherical Cow)":
+ self.version = "18"
+ else:
+ self.supported = False
+
distro.register_distro_info(DistroInfo)
diff --git a/devbot/plugins/interfaces.py b/devbot/plugins/interfaces.py
index c9d9c46..0c9c0b6 100644
--- a/devbot/plugins/interfaces.py
+++ b/devbot/plugins/interfaces.py
@@ -55,3 +55,6 @@ class DistroInfo:
self.use_lib64 = False
"""If set to True install libraries in the lib64 directory."""
+
+ self.supported = False
+ """If set to Trye the distribution is supported."""
diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py
index 4b624e1..4f1fb91 100644
--- a/devbot/plugins/ubuntu.py
+++ b/devbot/plugins/ubuntu.py
@@ -84,28 +84,36 @@ distro.register_package_manager("ubuntu", PackageManager)
class DistroInfo(interfaces.DistroInfo):
def __init__(self):
- self.name = None
- self.version = None
- self.system_version = None
- self.valid = False
- self.use_lib64 = False
-
arch = subprocess.check_output(["uname", "-i"]).strip()
- if arch in ["i386", "i686", "x86_64"]:
- try:
- if self._get_distributor() == "Ubuntu" and \
- self._get_release() == "12.10":
- self.name = "ubuntu"
- self.version = "12.10"
- self.system_version = "3.6"
- self.valid = True
- except OSError:
- pass
+
+ self.name = "ubuntu"
+ self.version = "unknown"
+ self.system_version = "3.4"
+ self.valid = True
+ self.supported = (arch in ["i386", "i686", "x86_64"])
+ self.use_lib64 = False
+
+ if self._get_distributor() != "Ubuntu":
+ self.valid = False
+
+ self.version = self._get_release()
+
+ if self.version != "12.10":
+ self.supported = False
+
+ if self.version and self.version > "12.10":
+ self.system_version = "3.6"
def _get_distributor(self):
- return subprocess.check_output(["lsb_release", "-si"]).strip()
+ try:
+ return subprocess.check_output(["lsb_release", "-si"]).strip()
+ except OSError:
+ None
def _get_release(self):
- return subprocess.check_output(["lsb_release", "-sr"]).strip()
+ try:
+ return subprocess.check_output(["lsb_release", "-sr"]).strip()
+ except OSError:
+ return None
distro.register_distro_info(DistroInfo)
diff --git a/devbot/plugins/unknown.py b/devbot/plugins/unknown.py
index ea42112..826f643 100644
--- a/devbot/plugins/unknown.py
+++ b/devbot/plugins/unknown.py
@@ -33,5 +33,6 @@ class DistroInfo(interfaces.DistroInfo):
self.version = "unknown"
self.system_version = "3.4"
self.valid = True
+ self.supported = False
distro.register_distro_info(DistroInfo)