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-28 13:49:15 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-28 13:49:15 (GMT)
commitd67e269de9e21ce4ad4cd1608cc8b0ff969c0642 (patch)
tree1248fbe24ac685f0d1eee39433d21a5bd505d30c /devbot
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')
-rw-r--r--devbot/distro.py3
-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
-rw-r--r--devbot/system.py40
6 files changed, 73 insertions, 54 deletions
diff --git a/devbot/distro.py b/devbot/distro.py
index 6bfc43c..a5857c8 100644
--- a/devbot/distro.py
+++ b/devbot/distro.py
@@ -36,7 +36,8 @@ def get_distro_info():
if _distro_info is None:
_distro_info = unknown_distro
-
+
+ if not _distro_info.supported:
print "*********************************************************\n" \
"You are running an unsupported distribution. You might be\n" \
"able to make sugar work by installing or building \n" \
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)
diff --git a/devbot/system.py b/devbot/system.py
index 9dd7a9e..0b9afd1 100644
--- a/devbot/system.py
+++ b/devbot/system.py
@@ -73,35 +73,45 @@ checkers = { "binary": check_binary,
"metacity-theme": check_metacity_theme,
"include": check_include }
+def _print_checks(checks):
+ for check in checks:
+ print "[%s] %s" % (check["checker"], check["check"])
+
def run_checks(package_manager, checks, packages):
- distro_name = distro.get_distro_info().name
+ distro_info = distro.get_distro_info()
failed_checks = []
+ packages_not_found = []
to_install = []
for check in checks:
checker = checkers[check["checker"]]
if checker(check["check"]):
- if distro_name in packages[check["name"]]:
- for package in packages[check["name"]][distro_name]:
+ if distro_info.name in packages[check["name"]]:
+ for package in packages[check["name"]][distro_info.name]:
# Might be none, if so skip on this distro_name
if package and package not in to_install:
to_install.append(package)
else:
- failed_checks.append(check)
+ packages_not_found.append(check)
- if to_install:
- package_manager.install_packages(to_install)
+ failed_checks.append(check)
- if failed_checks:
- print "\nFailed checks:"
- else:
- return True
+ if distro_info.supported:
+ if packages_not_found:
+ print "\Packages not found for"
+ _print_checks(_packages_not_found)
+ return False
+ elif failed_checks:
+ print "Failed checks\n"
+ _print_checks(failed_checks)
- for check in failed_checks:
- print "[%s] %s" % (check["checker"], check["check"])
+ print "\nYou might try to install the following packages\n"
+ print " ".join(to_install)
+
+ return False
- return False
+ return True
def remove_packages(package_manager, packages):
distro_name = distro.get_distro_info().name
@@ -134,8 +144,6 @@ def check(remove=False, update=False, test=False, interactive=True,
if config.get_commit_id() == state.get_last_system_check():
return
- print "Checking the system"
-
package_manager = \
distro.get_package_manager(test=test, interactive=interactive)
@@ -153,6 +161,8 @@ def check(remove=False, update=False, test=False, interactive=True,
xvfb.stop(xvfb_proc, orig_display)
+ print "All the required dependencies are installed."
+
if update:
package_manager.update()