]> git.ipfire.org Git - pakfire.git/commitdiff
Add --after-shell switch to build command.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Oct 2011 10:43:34 +0000 (12:43 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Oct 2011 10:43:34 +0000 (12:43 +0200)
One can pass --after-shell to the build command which
will open a shell after the build was done.

po/pakfire.pot
python/pakfire/base.py
python/pakfire/cli.py

index db7cffcde3f3081f1722a2dd0980cb8c2594c98d..ac7da34629a92d76bfbad15378bda7ab5810ded0 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-16 11:23+0200\n"
+"POT-Creation-Date: 2011-10-16 12:09+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -77,11 +77,11 @@ msgstr ""
 msgid "There are no packages to install."
 msgstr ""
 
-#: ../python/pakfire/base.py:458
+#: ../python/pakfire/base.py:465
 msgid "Build command has failed."
 msgstr ""
 
-#: ../python/pakfire/base.py:538
+#: ../python/pakfire/base.py:545
 msgid "Everything is fine."
 msgstr ""
 
@@ -262,7 +262,7 @@ msgstr ""
 msgid "You cannot run pakfire-builder in a pakfire chroot."
 msgstr ""
 
-#: ../python/pakfire/cli.py:330 ../python/pakfire/cli.py:585
+#: ../python/pakfire/cli.py:330 ../python/pakfire/cli.py:587
 msgid "Pakfire builder command line interface."
 msgstr ""
 
@@ -270,81 +270,85 @@ msgstr ""
 msgid "Update the package indexes."
 msgstr ""
 
-#: ../python/pakfire/cli.py:391 ../python/pakfire/cli.py:605
+#: ../python/pakfire/cli.py:391 ../python/pakfire/cli.py:607
 msgid "Build one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:393 ../python/pakfire/cli.py:607
+#: ../python/pakfire/cli.py:393 ../python/pakfire/cli.py:609
 msgid "Give name of at least one package to build."
 msgstr ""
 
-#: ../python/pakfire/cli.py:397 ../python/pakfire/cli.py:611
+#: ../python/pakfire/cli.py:397 ../python/pakfire/cli.py:613
 msgid "Build the package for the given architecture."
 msgstr ""
 
-#: ../python/pakfire/cli.py:399 ../python/pakfire/cli.py:425
-#: ../python/pakfire/cli.py:613
+#: ../python/pakfire/cli.py:399 ../python/pakfire/cli.py:427
+#: ../python/pakfire/cli.py:615
 msgid "Path were the output files should be copied to."
 msgstr ""
 
-#: ../python/pakfire/cli.py:401 ../python/pakfire/cli.py:414
-#: ../python/pakfire/cli.py:615
+#: ../python/pakfire/cli.py:401 ../python/pakfire/cli.py:416
+#: ../python/pakfire/cli.py:617
 msgid "Mode to run in. Is either 'release' or 'development' (default)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:406
-msgid "Go into a shell."
+#: ../python/pakfire/cli.py:403
+msgid "Run a shell after a successful build."
 msgstr ""
 
 #: ../python/pakfire/cli.py:408
+msgid "Go into a shell."
+msgstr ""
+
+#: ../python/pakfire/cli.py:410
 msgid "Give name of a package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:412
+#: ../python/pakfire/cli.py:414
 msgid "Emulated architecture in the shell."
 msgstr ""
 
-#: ../python/pakfire/cli.py:419
+#: ../python/pakfire/cli.py:421
 msgid "Generate a source package."
 msgstr ""
 
-#: ../python/pakfire/cli.py:421
+#: ../python/pakfire/cli.py:423
 msgid "Give name(s) of a package(s)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:498
+#: ../python/pakfire/cli.py:500
 msgid "Pakfire server command line interface."
 msgstr ""
 
-#: ../python/pakfire/cli.py:535
+#: ../python/pakfire/cli.py:537
 msgid "Request a build job from the server."
 msgstr ""
 
-#: ../python/pakfire/cli.py:541
+#: ../python/pakfire/cli.py:543
 msgid "Send a keepalive to the server."
 msgstr ""
 
-#: ../python/pakfire/cli.py:548
+#: ../python/pakfire/cli.py:550
 msgid "Update all repositories."
 msgstr ""
 
-#: ../python/pakfire/cli.py:554
+#: ../python/pakfire/cli.py:556
 msgid "Repository management commands."
 msgstr ""
 
-#: ../python/pakfire/cli.py:562
+#: ../python/pakfire/cli.py:564
 msgid "Create a new repository index."
 msgstr ""
 
-#: ../python/pakfire/cli.py:563
+#: ../python/pakfire/cli.py:565
 msgid "Path to the packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:564
+#: ../python/pakfire/cli.py:566
 msgid "Path to input packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:617
+#: ../python/pakfire/cli.py:619
 msgid "Do not verify build dependencies."
 msgstr ""
 
index 455a5d47fab60ca8edfb66e8b41711752a81592c..6079b15c5249852b5bb91cd7a1742741e1fe31a0 100644 (file)
@@ -415,7 +415,7 @@ class Pakfire(object):
                return sorted(pkgs)
 
        @staticmethod
-       def build(pkg, resultdirs=None, shell=False, install_test=True, **kwargs):
+       def build(pkg, resultdirs=None, shell=False, install_test=True, after_shell=False, **kwargs):
                if not resultdirs:
                        resultdirs = []
 
@@ -430,22 +430,29 @@ class Pakfire(object):
                        # the filesystems and extracting files.
                        b.start()
 
-                       # Build the package.
-                       b.build(install_test=install_test)
+                       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
 
-                       # Copy-out all resultfiles
+                               # Run a shell to debug the issue.
+                               b.shell()
+
+                       # If the user requests a shell after a successful build,
+                       # we run it here.
+                       if after_shell:
+                               b.shell()
+
+                       # Copy-out all resultfiles if the build was successful.
                        for resultdir in resultdirs:
                                if not resultdir:
                                        continue
 
                                b.copy_result(resultdir)
-
-               except BuildError:
-                       if shell:
-                               b.shell()
-                       else:
-                               raise
-
                finally:
                        b.stop()
 
index 4466570c8afc8a3930a0859943d5d0496ea8a3fc..b5e72ad23a2cb861c581d96c45c2daad9fc1dd4f 100644 (file)
@@ -399,6 +399,8 @@ class CliBuilder(Cli):
                        help=_("Path were the output files should be copied to."))
                sub_build.add_argument("-m", "--mode", nargs="?", default="development",
                        help=_("Mode to run in. Is either 'release' or 'development' (default)."))
+               sub_build.add_argument("--after-shell", action="store_true",
+                       help=_("Run a shell after a successful build."))
 
        def parse_command_shell(self):
                # Implement the "shell" command.
@@ -445,7 +447,7 @@ class CliBuilder(Cli):
 
                pakfire.build(pkg, builder_mode=self.args.mode,
                        distro_config=distro_config, resultdirs=[self.args.resultdir,],
-                       shell=True, **self.pakfire_args)
+                       shell=True, after_shell=self.args.after_shell, **self.pakfire_args)
 
        def handle_shell(self):
                pkg = None