Add a feature to kdesvn-build contributed by Tom Albers, --resume-after.

It's just like --resume-from, except that if you've already verified that your fix
allows the module to build and install there's no reason to run kdesvn-build through
the same process again. Using --resume-after tells kdesvn-build to pick up with the
module after the one you've supplied (which would normally be the module that failed).

CCMAIL:toma@kde.org

svn path=/trunk/KDE/kdesdk/doc/scripts/kdesvn-build/; revision=1089384
wilder
Michael Pyne 16 years ago
parent bb7793cbbf
commit 4506f18570
  1. 37
      doc/index.docbook
  2. 87
      kdesvn-build

@ -46,6 +46,7 @@
<!ENTITY cmd-nice '<link linkend="cmdline-nice">--nice</link>'>
<!ENTITY cmd-ignore-modules '<link linkend="cmdline-ignore-modules">--ignore-modules</link>'>
<!ENTITY cmd-resume-from '<link linkend="cmdline-resume-from">--resume-from</link>'>
<!ENTITY cmd-resume-after '<link linkend="cmdline-resume-after">--resume-after</link>'>
<!ENTITY cmd-reconfigure '<link linkend="cmdline-reconfigure">--reconfigure</link>'>
<!ENTITY cmd-refresh-build '<link linkend="cmdline-refresh-build">--refresh-build</link>'>
]>
@ -1847,7 +1848,26 @@ This option is used to resume the build starting from the given module, which
should be the next option on the command line. This option implies <link
linkend="cmdline-no-src"><parameter>--no-src</parameter></link>. You should not
specify other module names on the command line.
</para></listitem>
</para>
<para>See also: <xref linkend="cmdline-resume-after"/> and <xref
linkend="resuming-failed"/>. You would prefer to use this command line option
if you have fixed the build error and want &kdesvn-build; to complete the
build.</para></listitem>
</varlistentry>
<varlistentry id="cmdline-resume-after">
<term><parameter>--resume-after</parameter></term>
<listitem><para>
This option is used to resume the build starting after the given module, which
should be the next option on the command line. This option implies <link
linkend="cmdline-no-src"><parameter>--no-src</parameter></link>. You should not
specify other module names on the command line.
</para>
<para>See also: <xref linkend="cmdline-resume-from"/> and <xref
linkend="resuming-failed"/>. You would prefer to use this command line option
if you have fixed the build error and have also built and installed the module
yourself, and want &kdesvn-build; to start again with the next
module.</para></listitem>
</varlistentry>
<varlistentry id="cmdline-rc-file">
@ -2541,10 +2561,10 @@ end global
<para>You can tell &kdesvn-build; to start building from a different module
than it normally would. This can be useful when a set of modules failed, or
if you canceled a build run in the middle. You can control this using the
&cmd-resume-from; option.</para>
&cmd-resume-from; option and the &cmd-resume-after; option.</para>
<note><para>Using &cmd-resume-from; will skip the source code update.</para>
</note>
<note><para>Using either of the resume options will skip the source code
update.</para> </note>
<informalexample>
<para>Resuming the build starting from kdebase:</para>
@ -2554,6 +2574,15 @@ if you canceled a build run in the middle. You can control this using the
</screen>
</informalexample>
<informalexample>
<para>Resuming the build starting after kdebase (in case you manually fixed
the issue and installed the module yourself):</para>
<screen>
<prompt>%</prompt> <userinput><command>kdesvn-build</command> <option>--resume-after=<replaceable>kdebase</replaceable></option></userinput>
</screen>
</informalexample>
</sect3>
<sect3 id="ignoring-modules">

@ -1114,6 +1114,34 @@ sub get_option
return ${$globalOpts}{$option};
}
# Returns a Perl object worth "die"ing for. (i.e. can be given to the die
# function and handled appropriately later with an eval). The returned
# reference will be an instance of BuildException. The actual exception type is
# passed in as the first parameter (as a string), and can be retrieved from the
# object later using the 'exception_type' key, and the message is returned as
# 'message'
#
# First parameter: Exception type
# Second parameter: Message to show to user
# Return: Reference to the exception object suitable for giving to "die"
sub make_exception
{
my $exception_type = shift;
my $message = shift;
$exception_type = 'Exception' unless defined $exception_type;
my $obj = eval {
package BuildException;
my $new_obj = {'exception_type' => $exception_type,
'message' => $message };
bless($new_obj);
return $new_obj;
};
return $obj;
}
# Returns a string describing the scm platform of the given module.
#
# First parameter: Module to get scm type of.
@ -3612,6 +3640,8 @@ Options:
--resume-from=<pkg> Starts building from the given package, without
performing the source update.
--resume-after=<pkg> Starts building after the given package, without
performing the source update.
--revision (or -r)=<rev> Forces update to revision <rev> from Subversion.
--refresh-build Start the build from scratch.
@ -3865,6 +3895,19 @@ DONE
last SWITCH;
};
/^--resume-after=?/ && do {
$_ = extract_option_value($_, @ARGV);
if (not $_)
{
print "You must pass a module to resume after to the --resume-after option!\n";
exit 7;
}
set_option('global', '#resume-after', $_);
set_option('global', '#no-svn', 1);
last SWITCH;
};
/^--/ && do {
# First let's see if they're trying to override a global option.
my ($option) = /^--([-\w\d\/]+)/;
@ -4066,10 +4109,29 @@ sub get_update_list
# in the module's options. The command-line arguments should have been
# parsed first.
#
# This subroutine will handle the --resume-from options.
# This subroutine will handle the --resume-from and --resume-after options.
sub get_build_list
{
my $resume_point = get_option('global', '#resume-from');
my $resume_point_after = get_option('global', '#resume-after');
# Set resume_point.
if ($resume_point_after)
{
if ($resume_point)
{
# Whoops, can't enable both
error <<EOF;
You specified both r[b[--resume-from] and r[b[--resume-after] but you can only
use one.
EOF
die make_exception('Runtime',
"Both --resume-after and --resume-from specified.");
}
$resume_point = $resume_point_after;
}
# l10n module has different names for KDE 3 and KDE 4.
my $l10n = 'l10n-kde4';
@ -4086,7 +4148,10 @@ sub get_build_list
{
if ($resume_point)
{
warning "I'm confused, you enabled y[--no-build] and y[--resume-from].";
my $option = '--resume-from';
$option = '--resume-after' if get_option('global', '#resume-after');
warning "I'm confused, you enabled y[--no-build] and y[$option].";
warning "Skipping the build process.";
}
@ -4102,6 +4167,12 @@ sub get_build_list
shift @build_list;
}
# One further for the --resume-after case.
if ($resume_point_after)
{
shift @build_list;
}
if (not @build_list)
{
warning "Can't resume from y[$resume_point], it wasn't going to be built!";
@ -6716,9 +6787,15 @@ eval
if ($@)
{
# We encountered an error.
print "Encountered an error in the execution of the script.\n";
print "The error reported was $@\n";
print "Please submit a bug against kdesvn-build on http://bugs.kde.org/\n";
if ($@->isa('BuildException')) {
print "\tCaught exception: ", $@->{'message'}, "\n";
print "\n\tAborting.\n";
}
else {
print "Encountered an error in the execution of the script.\n";
print "The error reported was $@\n";
print "Please submit a bug against kdesvn-build on http://bugs.kde.org/\n";
}
$result = 99;
}

Loading…
Cancel
Save