Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/plugins/ubuntu.py
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-29 00:20:08 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-29 00:20:08 (GMT)
commit0e848594e4d46f517ab3a7a526fe52075e332c62 (patch)
treeba72f8fb5feb6a5adbe109f37ba3867929f3f203 /devbot/plugins/ubuntu.py
parent225fec76eac61dcd0bbbd090fadad56f7917fc68 (diff)
Initial support for debian wheezy
Diffstat (limited to 'devbot/plugins/ubuntu.py')
-rw-r--r--devbot/plugins/ubuntu.py80
1 files changed, 2 insertions, 78 deletions
diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py
index 6b80b4e..4db0dd1 100644
--- a/devbot/plugins/ubuntu.py
+++ b/devbot/plugins/ubuntu.py
@@ -1,86 +1,10 @@
-import os
import subprocess
-from devbot import command
from devbot import distro
from devbot.plugins import interfaces
+from devbot.plugins import debian
-class PackageManager(interfaces.PackageManager):
- def __init__(self, test=False, interactive=True):
- import apt
-
- self._test = test
- self._interactive = interactive
-
- self._cache = apt.cache.Cache()
-
- def install_packages(self, packages):
- args = ["apt-get"]
-
- if not self._interactive:
- args.append("-y")
-
- args.append("install")
- args.extend(packages)
-
- command.run_with_sudo(args, test=self._test)
-
- def remove_packages(self, packages):
- args = ["dpkg", "-P"]
- args.extend(packages)
-
- command.run_with_sudo(args, test=self._test)
-
- def update(self):
- command.run_with_sudo(["apt-get", "update"], test=self._test)
-
- args = ["apt-get"]
-
- if not self._interactive:
- args.append("-y")
-
- args.append("upgrade")
-
- command.run_with_sudo(args, test=self._test)
-
- def find_all(self):
- return [package.name for package in self._cache
- if package.installed is not None]
-
- def _find_deps(self, package, result):
- if self._cache.is_virtual_package(package):
- for providing in self._cache.get_providing_packages(package):
- self._find_deps(providing.name, result)
- return
-
- if package not in self._cache:
- print "Package %s not in cache" % package
- return
-
- installed = self._cache[package].installed
- if installed is None:
- print "Package %s not installed" % package
- return
-
- for dependency in installed.dependencies:
- for base_dependency in dependency.or_dependencies:
- dependency_name = base_dependency.name
- if dependency_name not in result:
- result.append(dependency_name)
- self._find_deps(dependency_name, result)
-
- def find_with_deps(self, package_names):
- result = []
-
- for package in package_names:
- if package is not None:
- self._find_deps(package, result)
- if package not in result:
- result.append(package)
-
- return result
-
-distro.register_package_manager("ubuntu", PackageManager)
+distro.register_package_manager("ubuntu", debian.PackageManager)
class DistroInfo(interfaces.DistroInfo):
def __init__(self):