From 995341e9befd9612f61283cee8fd351a1d33403f Mon Sep 17 00:00:00 2001 From: rshipp Date: Sun, 1 Mar 2015 16:28:14 -0700 Subject: [PATCH 1/3] Allow local installs with the packages module. Courtesy of @Inkane. Adds the ability to use pacman -U to install local packages. --- src/modules/packages/main.py | 7 +++++-- src/modules/packages/packages.conf | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 028a0ea1a..b6c269782 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -30,7 +30,7 @@ class PackageManager: def __init__(self, backend): self.backend = backend - def install(self, pkgs): + def install(self, pkgs, from_local=False): """ Installs packages. :param pkgs: @@ -53,7 +53,8 @@ class PackageManager: elif self.backend == "apt": check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs) elif self.backend == "pacman": - check_chroot_call(["pacman", "-Sy", "--noconfirm"] + pkgs) + pacman_flags = "-Sy" if from_local else "-U" + check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs) def remove(self, pkgs): """ Removes packages. @@ -90,6 +91,8 @@ def run_operations(pkgman, entry): pkgman.install(entry[key]) elif key == "remove": pkgman.remove(entry[key]) + elif key == "local_install": + pkgman.install(entry[key], from_local=True) def run(): diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index 6cfe8b7a5..b612ef506 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -39,3 +39,5 @@ backend: packagekit # install: # - pkgs6 # - pkg7 +# - local_install: +# - /path/to/pkg8 From 880c19c19524c8ad2ec9a4ad5b3cccb5d09e017e Mon Sep 17 00:00:00 2001 From: rshipp Date: Sun, 1 Mar 2015 17:34:44 -0700 Subject: [PATCH 2/3] Fix incorrect if statement --- src/modules/packages/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index b6c269782..9c91b70ec 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -53,7 +53,7 @@ class PackageManager: elif self.backend == "apt": check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs) elif self.backend == "pacman": - pacman_flags = "-Sy" if from_local else "-U" + pacman_flags = "-U" if from_local else "-Sy" check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs) def remove(self, pkgs): From f3319e1ef4f3cc6233e5d1709de28af10c39e553 Mon Sep 17 00:00:00 2001 From: rshipp Date: Wed, 4 Mar 2015 08:19:26 -0700 Subject: [PATCH 3/3] Change local_install to localInstall --- src/modules/packages/main.py | 2 +- src/modules/packages/packages.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 9c91b70ec..1d5673abe 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -91,7 +91,7 @@ def run_operations(pkgman, entry): pkgman.install(entry[key]) elif key == "remove": pkgman.remove(entry[key]) - elif key == "local_install": + elif key == "localInstall": pkgman.install(entry[key], from_local=True) diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index b612ef506..d96267a88 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -39,5 +39,5 @@ backend: packagekit # install: # - pkgs6 # - pkg7 -# - local_install: +# - localInstall: # - /path/to/pkg8