def shell(pkg, **kwargs):
return Pakfire.shell(pkg, **kwargs)
-def dist(pkg, **kwargs):
- return Pakfire.dist(pkg, **kwargs)
+def dist(pkgs, **kwargs):
+ return Pakfire.dist(pkgs, **kwargs)
def provides(patterns, **pakfire_args):
# Create pakfire instance.
b.destroy()
@staticmethod
- def dist(pkg, resultdirs=None, **pakfire_args):
- b = builder.Builder(pkg, **pakfire_args)
+ def dist(pkgs, resultdirs=None, **pakfire_args):
+ # Create a builder with empty package.
+ b = builder.Builder(None, **pakfire_args)
p = b.pakfire
if not resultdirs:
try:
b.prepare()
- b.extract(build_deps=False)
- # Run the actual dist.
- b.dist()
+ for pkg in pkgs:
+ b.pkg = pkg
- # Copy-out all resultfiles
- for resultdir in resultdirs:
- if not resultdir:
- continue
+ b.extract(build_deps=False)
- b.copy_result(resultdir)
+ # Run the actual dist.
+ b.dist()
+
+ # Copy-out all resultfiles
+ for resultdir in resultdirs:
+ if not resultdir:
+ continue
+
+ b.copy_result(resultdir)
+
+ # Cleanup the stuff that the package left.
+ b.cleanup()
finally:
b.destroy()
# The version of the kernel this machine is running.
kernel_version = os.uname()[2]
- def __init__(self, pkg, distro_config=None, build_id=None, **pakfire_args):
+ def __init__(self, pkg=None, distro_config=None, build_id=None, **pakfire_args):
pakfire_args.update({
"builder" : True,
})
self.path = self.pakfire.path
# Open the package.
- if pkg:
- self.pkg = packages.open(self.pakfire, None, pkg)
-
- # Log the package information.
- if not isinstance(self.pkg, packages.Makefile):
- dump = self.pkg.dump(long=True)
- self.log.info(dump)
- else:
- # No package was given.
- self.pkg = None
+ self.pkg = pkg
# XXX need to make this configureable
self.settings = {
self.build_id = build_id
+ def get_pkg(self):
+ return getattr(self, "_pkg", None)
+
+ def set_pkg(self, pkg):
+ if pkg is None:
+ self.__pkg = None
+ return
+
+ self._pkg = packages.open(self.pakfire, None, pkg)
+
+ # Log the package information.
+ if not isinstance(self._pkg, packages.Makefile):
+ dump = self._pkg.dump(long=True)
+ self.log.info(dump)
+
+ assert self.pkg
+
+ pkg = property(get_pkg, set_pkg)
+
@property
def arch(self):
"""