Commit e5882e9d authored by Seblu's avatar Seblu

Install in a row

Packages install must be done in a row in order to support packages
dependencies
parent 2de2538c
...@@ -162,15 +162,6 @@ class Package(Url): ...@@ -162,15 +162,6 @@ class Package(Url):
if sign and self.sigurl.exists: if sign and self.sigurl.exists:
self.sigurl.download(self.sigfilename) self.sigurl.download(self.sigfilename)
def install(self, sign=True):
"""Download and install a package"""
with TemporaryDirectory() as tmpdir:
cwd = getcwd()
chdir(tmpdir)
self.get(sign)
pacman(["-U", self.filename])
chdir(cwd)
class Archive(object): class Archive(object):
"""Abstract access to the package Archive""" """Abstract access to the package Archive"""
...@@ -269,6 +260,7 @@ def pacman(args, asroot=True): ...@@ -269,6 +260,7 @@ def pacman(args, asroot=True):
cmd = ["su", "root", "-c=%s" % " ".join(cmd) ] cmd = ["su", "root", "-c=%s" % " ".join(cmd) ]
else: else:
error("Unable to execute as root: %s" % " ".join(cmd)) error("Unable to execute as root: %s" % " ".join(cmd))
debug("calling: %s" % cmd)
call(cmd, close_fds=True) call(cmd, close_fds=True)
def list_packages(packages, long=False): def list_packages(packages, long=False):
...@@ -315,9 +307,15 @@ def get_packages(packages): ...@@ -315,9 +307,15 @@ def get_packages(packages):
pkg.get() pkg.get()
def install_packages(packages): def install_packages(packages):
"""install packages""" """install packages in one shot to allow deps to work"""
for pkg in select_packages(packages): packages = list(select_packages(packages))
pkg.install() with TemporaryDirectory() as tmpdir:
cwd = getcwd()
chdir(tmpdir)
for pkg in packages:
pkg.get()
pacman(["-U"] + [ pkg.filename for pkg in packages ])
chdir(cwd)
def parse_argv(): def parse_argv():
'''Parse command line arguments''' '''Parse command line arguments'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment