Merge pull request #205 from rshipp/packages-local-install

Allow local installs with the packages module
This commit is contained in:
Teo Mrnjavac 2015-04-16 11:26:37 +02:00
commit 9058c14032
2 changed files with 7 additions and 2 deletions

View File

@ -30,7 +30,7 @@ class PackageManager:
def __init__(self, backend): def __init__(self, backend):
self.backend = backend self.backend = backend
def install(self, pkgs): def install(self, pkgs, from_local=False):
""" Installs packages. """ Installs packages.
:param pkgs: :param pkgs:
@ -53,7 +53,8 @@ class PackageManager:
elif self.backend == "apt": elif self.backend == "apt":
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs) check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
elif self.backend == "pacman": elif self.backend == "pacman":
check_chroot_call(["pacman", "-Sy", "--noconfirm"] + pkgs) pacman_flags = "-U" if from_local else "-Sy"
check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs)
def remove(self, pkgs): def remove(self, pkgs):
""" Removes packages. """ Removes packages.
@ -90,6 +91,8 @@ def run_operations(pkgman, entry):
pkgman.install(entry[key]) pkgman.install(entry[key])
elif key == "remove": elif key == "remove":
pkgman.remove(entry[key]) pkgman.remove(entry[key])
elif key == "localInstall":
pkgman.install(entry[key], from_local=True)
def run(): def run():

View File

@ -39,3 +39,5 @@ backend: packagekit
# install: # install:
# - pkgs6 # - pkgs6
# - pkg7 # - pkg7
# - localInstall:
# - /path/to/pkg8