chrootcfg: update module for changed packages global storage

This commit is contained in:
udeved 2017-02-03 17:13:27 +01:00
parent 56b21bbb20
commit e6c4efbb11

View File

@ -149,7 +149,7 @@ class PacmanController:
return None
def install(self, local=False):
def install(self, pkglist, local=False):
cachedir = join(self.root, "var/cache/pacman/pkg")
dbdir = join(self.root, "var/lib/pacman")
args = ["pacman", "--noconfirm"]
@ -159,23 +159,38 @@ class PacmanController:
args.extend(["-Sy"])
args.extend(["--cachedir", cachedir, "--root", self.root, "--dbpath", dbdir])
cmd = args + self.operations["install"]
cmd = args + pkglist
self.parse_output(cmd)
def remove(self):
def remove(self, pkglist):
args = ["chroot", self.root, "pacman", "-Rs", "--noconfirm"]
cmd = args + self.operations["remove"]
cmd = args + pkglist
check_target_env_call(cmd)
def run(self, rank=False):
for op in self.operations.keys():
if op == "install":
self.install()
elif op == "localInstall":
self.install(local=True)
elif op == "remove":
self.tracker.total(len(self.operations["remove"]))
self.remove()
pkgs = []
for key in self.operations.keys():
if key == "install":
for pkg in self.operations[key]:
pkgs.extend([pkg["package"]])
self.install(pkgs)
elif key == "localInstall":
for pkg in self.operations[key]:
pkgs.extend([pkg["package"]])
self.install(pkgs,local=True)
elif key == "remove":
for pkg in self.operations[key]:
pkgs.extend([pkg["package"]])
self.tracker.total(len(pkgs))
self.remove(pkgs)
elif key == "try_install":
for pkg in self.operations[key]:
pkgs.extend([pkg["package"]])
self.install(pkgs)
elif key == "try_remove":
for pkg in self.operations[key]:
pkgs.extend([pkg["package"]])
self.remove(pkgs)
self.init_keyring()
self.populate_keyring()