t.run()
-class PakfireBuilder(Pakfire):
- def __init__(self, distro_name=None, *args, **kwargs):
- self.distro_name = distro_name
-
- kwargs.update({
- "path" : os.path.join(BUILD_ROOT, util.random_string()),
- })
-
- Pakfire.__init__(self, *args, **kwargs)
-
- # Let's see what is our host distribution.
- self.host_distro = distro.Distribution()
-
- def _load_config(self, files=None):
- c = config.ConfigBuilder(files=files)
-
- if self.distro_name is None:
- self.distro_name = c.get("builder", "distro", None)
-
- if self.distro_name:
- c.load_distro_config(self.distro_name)
-
- if not c.has_distro_conf():
- log.error(_("You have not set the distribution for which you want to build."))
- log.error(_("Please do so in builder.conf or on the CLI."))
- raise ConfigError(_("Distribution configuration is missing."))
-
- return c
-
- def build(self, pkg, resultdirs=None, shell=False, install_test=True, after_shell=False, **kwargs):
- # As the BuildEnviron is only able to handle source packages, we must package makefiles.
- if pkg.endswith(".%s" % MAKEFILE_EXTENSION):
- pkg = self.dist(pkg, resultdir=LOCAL_TMP_PATH)
-
- b = builder.BuildEnviron(self, pkg, **kwargs)
-
- try:
- # Start to prepare the build environment by mounting
- # the filesystems and extracting files.
- b.start()
-
- try:
- # Build the package.
- b.build(install_test=install_test)
-
- except BuildError:
- # Raise the error, if the user does not want to
- # have a shell.
- if not shell:
- raise
-
- # Run a shell to debug the issue.
- b.shell()
-
- # Copy-out all resultfiles if the build was successful.
- if not resultdirs:
- resultdirs = []
-
- # Always include local repository.
- resultdirs.append(self.repos.local_build.path)
-
- for resultdir in resultdirs:
- if not resultdir:
- continue
-
- b.copy_result(resultdir)
-
- # If the user requests a shell after a successful build,
- # we run it here.
- if after_shell:
- b.shell()
-
- finally:
- b.stop()
-
- def shell(self, pkg, **kwargs):
- # As the BuildEnviron is only able to handle source packages, we must package makefiles.
- if pkg and pkg.endswith(".%s" % MAKEFILE_EXTENSION):
- pkg = self.dist(pkg, resultdir=LOCAL_TMP_PATH)
-
- b = builder.BuildEnviron(self, pkg, **kwargs)
-
- try:
- b.start()
-
- try:
- b.build(prepare=True)
- except BuildError:
- pass
-
- b.shell()
- finally:
- b.stop()
-
-
class PakfireServer(Pakfire):
def repo_create(self, path, input_paths, name=None, key_id=None, type="binary"):
assert type in ("binary", "source",)