Implement a feature request from mornfall. Now you can update/build only a part of a module just by specifying the path on the command line.

For example, to update and build only the khtml component of kdelibs, you would type at the prompt "kdecvs-build kdelibs/khtml".

This should work pretty good, but feel free to let me know if I've b0rken anything. =D

svn path=/trunk/kdenonbeta/kdecvs-build/; revision=346557
wilder
Michael Pyne 22 years ago
parent d2bf58e6ba
commit 530a011c9b
  1. 1
      HISTORY
  2. 17
      doc.html.in
  3. 113
      kdecvs-build

@ -1,5 +1,6 @@
Version history: 0.84
* Show failed updates in summary output.
* You can now update or build only part of a module directly from the command line.
Version history: 0.83
* Added option, --ignore-modules.

@ -66,6 +66,23 @@ those who either can't or don't feel like installing it.</p>
(DOT) net), and is one of several build scripts for this purpose.</p>
<p><b>?</b> v0.84<br/>
New features:
<ul>
<li><p>You can quickly update and/or build a specific subdirectory within a
module at the command line. This corresponds to the <a
href="#conf-checkout-only">checkout-only</a> configuration option.</p>
<p>For example, to checkout and build the <b>khtml</b> directory of
<b>kdelibs</b>, you would type <code>kdecvs-build kdelibs/khtml</code>. You
must still have the module configured within your .kdecvs-buildrc.</p>
<p>Also, this changes the way the <a
href="conf-checkout-only">checkout-only</a> option performs the build. Now
instead of downloading the different pieces and just building the module,
kdecvs-build will download the pieces and then build the pieces in their
subdirectory. I believe this should be equivalent, but if not, just let me
know.</p>
</li>
</ul>
Bugfixes:
<ul>
<li>If a package didn't update, note that fact in the summary output at the end.</li>

@ -383,27 +383,48 @@ sub log_command
# list. The first argument of the list given must be the module that we're
# making. The second argument is the "try number", used in creating the log
# file name.
#
# Returns 0 on success, non-zero on failure (shell script style)
sub safe_make (@)
{
my $module = shift;
my $trynumber = shift;
my $opts = get_option($module, 'make-options');
my $logdir = get_log_dir($module);
my $checkout_dirs = get_option($module, "checkout-only");
my @dirs = split(' ', $checkout_dirs);
# Add make-options to the given options
unshift (@_, split(/\s/, $opts));
unshift (@_, split(' ', $opts));
push (@dirs, "") if scalar @dirs == 0;
if (pretending)
print "\tCompiling, attempt $trynumber...\n";
for my $subdir (@dirs)
{
$opts = join(' ', @_);
print "\tWould have run make $opts > $logdir/build-$trynumber\n";
return 0;
}
next if $subdir eq 'admin';
chdir (get_build_dir($module) . "/$module");
my $logname = "build-$trynumber";
$logname = "build-$subdir-$trynumber" if $subdir ne "";
print "\tCompiling, attempt $trynumber...\n";
return log_command ($module, "build-$trynumber", ['make', @_] );
if (pretending)
{
$opts = join(' ', @_);
print "\tWould have switched directory to ", get_build_dir($module) . "/$module/$subdir\n";
print "\tWould have run make $opts > $logdir/$logname\n";
next;
}
print "\tBuilding subdirectory $subdir\n" if $subdir ne '';
chdir (get_build_dir($module) . "/$module/$subdir");
my $result = log_command ($module, $logname, ['make', @_] );
return $result if $result;
}
return 0;
}
# Subroutine to add a variable to the environment, but ONLY if it
@ -1152,6 +1173,9 @@ sub checkout_cvs_partial_dir
chdir ("$kdecvs");
$update_dir = "$module/$dir";
# If the directory is admin we need to checkout instead of updating if
# the directory didn't already exist.
if ($dir eq 'admin')
{
$update_dir = "$dir";
@ -1186,7 +1210,11 @@ sub checkout_cvs_partial_dir
sub checkout_cvs_partial
{
my $module = shift;
my @dirlist = split (/\s+/, get_option ($module, 'checkout-only'));
# This form of split splits on whitespace, but doesn't give empty leading or
# trailing fields.
my @dirlist = split (' ', get_option ($module, 'checkout-only'));
my @args;
my $kdecvs = get_kdecvs_dir();
my $cvsroot = get_option ('global', 'cvs-server');
@ -1195,9 +1223,13 @@ sub checkout_cvs_partial
chdir ($kdecvs);
# Check if the user explicitly asked for the given subdir on the command line.
# If so, don't automatically add /admin, as that would simply be annoying.
my $suppress_auto_admin = get_option($module, '#suppress-auto-admin');
# Check if the user specified the admin subdirectory. If not,
# add it.
push (@dirlist, 'admin') if scalar grep (/^admin$/, @dirlist) == 0;
push (@dirlist, 'admin') if not $suppress_auto_admin and scalar grep (/^admin$/, @dirlist) == 0;
# Check out the module base.
@args = ('cvs', "-d$cvsroot");
@ -2234,6 +2266,58 @@ sub handle_install
return $result;
}
# This subroutine goes and makes sure that any entries in the update and build
# lists that have a directory separator are faked into using the checkout-only
# feature. This doesn't really work for install mode though.
sub munge_lists
{
print "Munging update and build list\n" if debugging;
for my $list_ref ( ( \@update_list, \@build_list) ) {
my @temp;
my %seen;
while ($_ = shift @$list_ref) {
# Split at directory separators.
my ($modulename, @dirs) = split(/\//);
if (scalar @dirs > 0)
{
# The user has included a directory separator in the module name, so
# let's fake the cvs partial checkout
$_ = $modulename;
# Don't automatically add the /admin dir for this module now.
$package_opts{$_}{'#suppress-auto-admin'} = 1;
my $checkout_str = join ("/", @dirs);
print "Adding $checkout_str to checkout-only for $_\n" if debugging;
if (get_option($_, 'checkout-only') !~ /$checkout_str/)
{
$package_opts{$_}{'checkout-only'} .= " $checkout_str";
}
else
{
print "\tOption was already present.\n" if debugging;
}
}
else
{
print "Skipping $_ in munge process.\n" if debugging;
}
# Don't add the modulename to the list twice. Hashes are the easiest way in
# Perl to do this. I'd love an "in" operator for lists.
unshift @temp, $_ if not $seen{$_};
$seen{$_} = 1;
}
@$list_ref = @temp;
}
}
# Script starts.
# Use some exception handling to avoid ucky error messages
@ -2276,8 +2360,15 @@ eval
@update_list = get_update_list();
@build_list = get_build_list();
print "Update list is ", join (', ', @update_list), "\n" if debugging;
print "Build list is ", join (', ', @build_list), "\n" if debugging;
# Do some necessary adjusting. Right now this is used for supporting
# the command-line option shortcut to where you can enter e.g.
# kdelibs/khtml, and the script will only try to update that part of
# the module.
munge_lists();
# Make sure unsermake is checked out automatically if needed
adjust_update_list(\@update_list, \@build_list);

Loading…
Cancel
Save