Clean this up a little.
This commit is contained in:
parent
f65a6b7fa6
commit
4dafefc081
@ -43,16 +43,14 @@ VERSION_TEMPL = "%s=%s"
|
|||||||
class AptPackager(pack.Packager):
|
class AptPackager(pack.Packager):
|
||||||
def __init__(self, distro):
|
def __init__(self, distro):
|
||||||
pack.Packager.__init__(self, distro)
|
pack.Packager.__init__(self, distro)
|
||||||
|
self.auto_remove = True
|
||||||
def _format_version(self, name, version):
|
|
||||||
return VERSION_TEMPL % (name, version)
|
|
||||||
|
|
||||||
def _format_pkg(self, name, version):
|
def _format_pkg(self, name, version):
|
||||||
if version and len(version):
|
if version:
|
||||||
cmd = self._format_version(name, version)
|
pkg_full_name = VERSION_TEMPL % (name, version)
|
||||||
else:
|
else:
|
||||||
cmd = name
|
pkg_full_name = name
|
||||||
return cmd
|
return pkg_full_name
|
||||||
|
|
||||||
def _execute_apt(self, cmd, **kargs):
|
def _execute_apt(self, cmd, **kargs):
|
||||||
return sh.execute(*cmd, run_as_root=True,
|
return sh.execute(*cmd, run_as_root=True,
|
||||||
@ -80,9 +78,10 @@ class AptPackager(pack.Packager):
|
|||||||
if cmds:
|
if cmds:
|
||||||
cmd = APT_GET + APT_DO_REMOVE + cmds
|
cmd = APT_GET + APT_DO_REMOVE + cmds
|
||||||
self._execute_apt(cmd)
|
self._execute_apt(cmd)
|
||||||
#clean them out
|
#clean them out (if we did anything)
|
||||||
cmd = APT_GET + APT_AUTOREMOVE
|
if which_removed and self.auto_remove:
|
||||||
self._execute_apt(cmd)
|
cmd = APT_GET + APT_AUTOREMOVE
|
||||||
|
self._execute_apt(cmd)
|
||||||
return which_removed
|
return which_removed
|
||||||
|
|
||||||
def install_batch(self, pkgs):
|
def install_batch(self, pkgs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user