From: Michael Tremer Date: Sat, 13 Feb 2021 15:31:20 +0000 (+0000) Subject: builder: Extract packages into the build environment X-Git-Tag: 0.9.28~1285^2~731 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3cdc86c669bd6e076528a9434bc9ac2a441fa1d;p=pakfire.git builder: Extract packages into the build environment Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py index 37d09ea7a..438714588 100644 --- a/src/pakfire/builder.py +++ b/src/pakfire/builder.py @@ -331,18 +331,28 @@ class BuilderContext(object): archive = _pakfire.Archive(self.pakfire, package) requires = archive.get("dependencies.requires") - packages += requires.splitlines() + if requires: + packages += requires.splitlines() # Setup the environment including any build dependencies self._install(packages) - # XXX perform build + # Extract the source archive (if we have one) + if archive: + archive.extract("%s/build" % self.pakfire.path) + + def shell(self, packages=[], install=None): + archives = [] - def shell(self, install=None): if not util.cli_is_interactive(): self.log.warning("Cannot run shell on non-interactive console.") return + # Open all archives + for path in packages: + archive = _pakfire.Archive(self.pakfire, path) + archives.append(archive) + # Collect packages to install packages = [] @@ -353,9 +363,19 @@ class BuilderContext(object): if install: packages += install + # Install all build requirements for archives + for archive in archives: + requires = archive.get("dependencies.requires") + if requires: + packages += requires.splitlines() + # Install all required packages self._install(packages) + # Extract archives + for archive in archives: + archive.extract("%s/build" % self.pakfire.path) + # Enter the shell self.pakfire.execute(["/usr/bin/bash", "--login"], environ=self.environ, enable_network=True, interactive=True) diff --git a/src/pakfire/cli.py b/src/pakfire/cli.py index b0b82b7fb..c887e2ff3 100644 --- a/src/pakfire/cli.py +++ b/src/pakfire/cli.py @@ -469,7 +469,7 @@ class CliBuilder(Cli): # shell shell = subparsers.add_parser("shell", help=_("Go into a build shell")) - shell.add_argument("package", nargs="?", help=_("Give name of a package")) + shell.add_argument("package", nargs="*", help=_("Give name of a package")) shell.add_argument("--install", nargs="*", help=_("Packages that should be installed in the shell")) shell.set_defaults(func=self.handle_shell) @@ -497,7 +497,7 @@ class CliBuilder(Cli): def handle_shell(self, ns): with self.builder(ns) as b: - b.shell(install=ns.install) + b.shell(packages=ns.package, install=ns.install) def handle_dist(self, ns): # Get the packages from the command line options