提交 5e2d44bf 编写于 作者: L Lucas Meneghel Rodrigues 提交者: Cleber Rosa

avocado.utils.software_manager: Add local file install support to AptBackend

It turns out that apt doesn't really handle local installs
graciously as dnf/yum, but thankfully there is a program
named gdebi, shipped in Debian and Ubuntu, that would let
us do that. Use it when available (we can make gdebi a
dependency for the avocado debian package to ensure it'll
always be there).
Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
上级 9e82ba46
...@@ -663,6 +663,13 @@ class AptBackend(DpkgBackend): ...@@ -663,6 +663,13 @@ class AptBackend(DpkgBackend):
self.pm_version = ver self.pm_version = ver
log.debug('apt-get version: %s' % self.pm_version) log.debug('apt-get version: %s' % self.pm_version)
# gdebi-core is necessary for local installation with dependency
# handling
if not self.check_installed('gdebi-core'):
if not self.install('gdebi-core'):
log.info("SoftwareManager (AptBackend) can't install packages "
"from local .deb files with dependency resolution: "
"Package 'gdebi-core' could not be installed")
def install(self, name): def install(self, name):
""" """
...@@ -670,8 +677,11 @@ class AptBackend(DpkgBackend): ...@@ -670,8 +677,11 @@ class AptBackend(DpkgBackend):
:param name: Package name. :param name: Package name.
""" """
command = 'install' if os.path.isfile(name):
i_cmd = self.base_command + ' ' + command + ' ' + name i_cmd = utils_path.find_command('gdebi') + ' -n -q ' + name
else:
command = 'install'
i_cmd = self.base_command + ' ' + command + ' ' + name
try: try:
process.system(i_cmd) process.system(i_cmd)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册