From: Michael Tremer Date: Wed, 13 Jan 2021 14:19:47 +0000 (+0000) Subject: pakfire-builder: shell: Add --install argument X-Git-Tag: 0.9.28~1285^2~873 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0ae5ac2c4eeee7125ebda031dfdd324c79da595;p=pakfire.git pakfire-builder: shell: Add --install argument Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py index 1d6689305..45d7065b0 100644 --- a/src/pakfire/builder.py +++ b/src/pakfire/builder.py @@ -506,13 +506,22 @@ class BuilderContext(object): # XXX perform build - def shell(self, install=[]): + def shell(self, install=None): if not util.cli_is_interactive(): self.log.warning("Cannot run shell on non-interactive console.") return + # Collect packages to install + packages = [] + # Install our standard shell packages - self._install(SHELL_PACKAGES + install) + packages += SHELL_PACKAGES + + # Install any packages the user requested + if install: + packages += install + + self._install(packages) command = "/usr/sbin/chroot %s %s %s" % (self.chrootPath(), SHELL_SCRIPT) diff --git a/src/pakfire/cli.py b/src/pakfire/cli.py index ba52fed4e..1bc5ab2e9 100644 --- a/src/pakfire/cli.py +++ b/src/pakfire/cli.py @@ -470,6 +470,8 @@ 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("--install", nargs="*", + help=_("Packages that should be installed in the shell")) shell.set_defaults(func=self.handle_shell) shell.add_argument("-m", "--mode", nargs="?", default="development", @@ -495,7 +497,7 @@ class CliBuilder(Cli): def handle_shell(self, ns): with self.builder(ns) as b: - b.shell() + b.shell(install=ns.install) def handle_dist(self, ns): # Get the packages from the command line options