From: Michael Tremer Date: Fri, 18 Mar 2011 11:58:17 +0000 (+0100) Subject: Add an automatic install test to see if we could install the built packages. X-Git-Tag: 0.9.3~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9ec78caba3fa995d9b2ac67668b5e92f690eab2;p=pakfire.git Add an automatic install test to see if we could install the built packages. --- diff --git a/pakfire/__init__.py b/pakfire/__init__.py index 90cfdaac5..ccca46159 100644 --- a/pakfire/__init__.py +++ b/pakfire/__init__.py @@ -118,6 +118,7 @@ class Pakfire(object): b.prepare() b.extract() b.build() + b.install_test() # Copy-out all resultfiles for resultdir in resultdirs: diff --git a/pakfire/builder.py b/pakfire/builder.py index 8eee69711..1beeca011 100644 --- a/pakfire/builder.py +++ b/pakfire/builder.py @@ -182,15 +182,40 @@ class Builder(object): """ Install everything that is required in requires. """ + # If we got nothing to do, we quit immediately. + if not requires: + return + ds = depsolve.DependencySet(self.pakfire) for r in requires: - ds.add_requires(r) + if isinstance(r, packages.BinaryPackage): + ds.add_package(r) + else: + ds.add_requires(r) ds.resolve() ds.dump() ts = transaction.Transaction(self.pakfire, ds) ts.run() + def install_test(self): + pkgs = [] + + # Connect packages to the FS repository. + r = repository.FileSystemRepository(self.pakfire) + + for dir, subdirs, files in os.walk(self.chrootPath("result")): + for file in files: + file = os.path.join(dir, file) + + if not file.endswith(PACKAGE_EXTENSION): + continue + + p = packages.BinaryPackage(self.pakfire, r, file) + pkgs.append(p) + + self.install(pkgs) + @property def log(self): # XXX for now, return the root logger