[kde-doc-english] [kdesrc-build] /: Add --resume (and --stop-on-failure) command line options.

Michael Pyne mpyne at kde.org
Sun Mar 16 03:22:03 UTC 2014


Git commit 7222909901afcf1a2f1f395714e6ed0ac46020f6 by Michael Pyne.
Committed on 16/03/2014 at 03:15.
Pushed by mpyne into branch 'master'.

Add --resume (and --stop-on-failure) command line options.

Now you don't have to do --stop-on-failure=1.

--resume is documented in the man page and docbook, but basically lets
you resume the last build list quickly without source or metadata
updates, starting from the module that failed. If you want to skip the
failed module, look into --resume-after and --stop-before.

BUG:331941
FIXED-IN:1.16

M  +48   -0    doc/index.docbook
M  +43   -0    doc/man-kdesrc-build.1.docbook
M  +27   -2    modules/ksb/Application.pm

http://commits.kde.org/kdesrc-build/7222909901afcf1a2f1f395714e6ed0ac46020f6

diff --git a/doc/index.docbook b/doc/index.docbook
index ccdac0a..c356e60 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2971,6 +2971,33 @@ yourself, and want &kdesrc-build; to start again with the next
 module.</para></listitem>
 </varlistentry>
 
+<varlistentry id="cmdline-resume">
+<term><parameter>--resume</parameter></term>
+<listitem><para>
+
+This option can be used to run &kdesrc-build; after it has had a build failure.
+</para><para>
+
+It resumes the build from the module that failed, using the list of modules
+that were waiting to be built before, and disables source and metadata updates
+as well. The use case is when a simple mistake or missing dependency causes the
+build failure. Once you correct the error you can quickly get back into
+building the modules you were building before, without fiddling with
+<option><link linkend="cmdline-resume-from">--resume-from</link></option> and
+<option><link linkend="cmdline-stop-before">--stop-before</link></option>.
+
+</para><para>
+This is even handier with the <option><link
+linkend="cmdline-stop-on-failure">--stop-on-failure</link></option> command
+line argument, especially if you're initially setting up your development
+environment.
+
+</para><para>
+This option was added with &kdesrc-build; 1.16.
+
+</para></listitem>
+</varlistentry>
+
 <varlistentry id="cmdline-stop-before">
 <term><parameter>--stop-before</parameter></term>
 <listitem><para>
@@ -3001,6 +3028,19 @@ This command line option was added with &kdesrc-build; 1.16.
 </para></listitem>
 </varlistentry>
 
+<varlistentry id="cmdline-stop-on-failure">
+<term><parameter>--stop-on-failure</parameter></term>
+<listitem><para>
+This option causes the build to abort as soon as a failure occurs. Useful when
+you're setting up your initial development environment. Without this flag,
+&kdesrc-build; will try to press on with the rest of the modules in the build
+to avoid wasting time in case the problem is with a single module.
+</para><para>
+This option was added with &kdesrc-build; 1.16. See also the
+<link linkend="conf-stop-on-failure">stop-on-failure</link> option.
+</para></listitem>
+</varlistentry>
+
 <varlistentry id="cmdline-rc-file">
 <term><parameter>--rc-file</parameter></term>
 <listitem><para>
@@ -3780,6 +3820,14 @@ the issue and installed the module yourself):</para>
 </screen>
 </informalexample>
 
+<para>If the last &kdesrc-build; build ended with a build failure, you can also
+use the <link linkend="cmdline-resume">--resume</link> command line option,
+which resumes the last build starting at the module that failed. The source and
+metadata updates are skipped as well (but if you need these, it's generally
+better to use <link linkend="cmdline-resume-from">--resume-from</link>
+instead.</para>
+
+
 </sect3>
 
 <sect3 id="ignoring-modules">
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 7a6a642..ac39e92 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -339,6 +339,34 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
+<option>--resume</option>
+</term>
+
+<listitem>
+<para>
+    This option can be used to run <command>kdesrc-build</command> after it has
+    had a build failure.
+</para>
+
+<para>
+    It resumes the build from the module that failed, using the list of modules
+    that were waiting to be built before, and disables source and metadata
+    updates as well. The use case is when a simple mistake or missing
+    dependency causes the build failure. Once you correct the error you can
+    quickly get back into building the modules you were building before,
+    without fiddling with <option>--resume-from</option> and
+    <option>--stop-before</option>.
+</para>
+
+<para>
+    This is even handier with the <option>--stop-on-failure</option> option,
+    especially if you're initially setting up your development environment.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
 <option>--stop-before=<replaceable>foo</replaceable></option>
 </term>
 
@@ -378,6 +406,21 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
+<option>--stop-on-failure</option>
+</term>
+
+<listitem>
+<para>
+    This option causes the build to abort as soon as a failure occurs. Useful when you're setting
+    up your initial development environment. Without this flag, <command>kdesrc-build</command>
+    will try to press on with the rest of the modules in the build to avoid wasting time in case
+    the problem is with a single module.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
 <option>--ignore-modules</option>
 </term>
 
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 8cbd5f8..ab4f243 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -206,6 +206,11 @@ DONE
             $auxOptions{pretend} = 1;
             $foundOptions{'build-when-unchanged'} = 1;
         },
+        resume => sub {
+            $auxOptions{resume} = 1;
+            $phases->filterOutPhase('update'); # Implied --no-src
+            $foundOptions{'no-metadata'} = 1;  # Implied --no-metadata
+        },
         verbose => sub { $foundOptions{'debug-level'} = ksb::Debug::WHISPER },
         quiet => sub { $foundOptions{'debug-level'} = ksb::Debug::NOTE },
         'really-quiet' => sub { $foundOptions{'debug-level'} = ksb::Debug::WARNING },
@@ -267,6 +272,7 @@ DONE
         'print-modules', 'pretend|dry-run|p', 'refresh-build',
         'start-program|run=s{,}',
         'revision=i', 'resume-from=s', 'resume-after=s',
+        'resume', 'stop-on-failure',
         'stop-after=s', 'stop-before=s', 'set-module-option-value=s',
 
         # Special sub used (see above), but have to tell Getopt::Long to look
@@ -540,6 +546,18 @@ sub generateModuleList
     $pendingGlobalOptions->{async} = 0 if (scalar $ctx->phases()->phases() == 1);
 
     my $fh = $ctx->loadRcFile();
+    $ctx->loadPersistentOptions();
+
+    if (exists $pendingGlobalOptions->{'resume'}) {
+        my $moduleList = $ctx->getPersistentOption('global', 'resume-list');
+        if (!$moduleList) {
+            error ("b[--resume] specified, but unable to find resume point!");
+            error ("Perhaps try b[--resume-from] or b[--resume-after]?");
+            croak_runtime("Invalid --resume flag");
+        }
+
+        unshift @selectors, split(/,\s*/, $moduleList);
+    }
 
     # _readConfigurationOptions will add pending global opts to ctx while ensuring
     # returned modules/sets have any such options stripped out. It will also add
@@ -701,8 +719,6 @@ sub runAllModulePhases
     my $metadataModule = $ctx->getKDEProjectMetadataModule();
     my @modules = $self->modules();
 
-    $ctx->loadPersistentOptions();
-
     # If we have kde-build-metadata we must process it first, ASAP.
     if ($metadataModule) {
         $self->_downloadKDEProjectMetadata();
@@ -1561,6 +1577,8 @@ sub _handle_build
     # build.
     $ipc->waitForStreamStart();
 
+    $ctx->unsetPersistentOption('global', 'resume-list');
+
     my $outfile = pretending() ? undef
                                : $ctx->getLogDir() . '/build-status';
 
@@ -1658,6 +1676,13 @@ EOF
 
             info ("\tOverall time for r[$module] was g[$elapsed].");
             $ctx->markModulePhaseFailed('build', $module);
+
+            if ($result == 0) {
+                # No failures yet, mark this as resume point
+                my $moduleList = join(', ', map { "$_" } ($module, @modules));
+                $ctx->setPersistentOption('global', 'resume-list', $moduleList);
+            }
+
             $result = 1;
 
             # Increment failed count to track when to start bugging the


More information about the kde-doc-english mailing list