]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire-builder: shell: Add --install argument
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jan 2021 14:19:47 +0000 (14:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jan 2021 14:19:47 +0000 (14:19 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/builder.py
src/pakfire/cli.py

index 1d66893050161f00b085f2011019dbcf741f7990..45d7065b053943ba8d368e3083250d8e6a1c7a66 100644 (file)
@@ -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)
 
index ba52fed4e7c937769b2fd1cde45490793faa416f..1bc5ab2e99028d94ced36ef41096bb52b12a30eb 100644 (file)
@@ -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