From be02ac4b993cb05338d79f0e9c6219b8f565c409 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Mon, 21 Jun 2004 18:52:58 +0000 Subject: [PATCH] * Two bug fixes, two new features. svn path=/trunk/kdenonbeta/kdecvs-build/; revision=322576 --- HISTORY | 4 +++ doc.html.in | 62 ++++++++++++++------------------ kdecvs-build | 99 +++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 101 insertions(+), 64 deletions(-) diff --git a/HISTORY b/HISTORY index f0184d8..643684c 100644 --- a/HISTORY +++ b/HISTORY @@ -8,6 +8,10 @@ Version history: 0.74 'simple' options like --help, --version, and --author are done. So now options which require an argument set a flag, and the processing is done later. + * Add feature for Amilcar, failed packages will display the path to the + appropriate log file. + * Another feature, automatically refresh build system if a Makefile.am is + added. Version history: 0.73 * Added support for timing a build to the program. Each make attempt is diff --git a/doc.html.in b/doc.html.in index 8dd0f96..41d13a0 100644 --- a/doc.html.in +++ b/doc.html.in @@ -65,7 +65,30 @@ those who either can't or don't feel like installing it.

It is authored by Michael Pyne (mpyne (AT) grammarian (DOT) homelinux (DOT) net), and is one of several build scripts for this purpose.

-

2004-Jun-17: v$VERSION
+

2004-Jun-21: v0.74
+New features: +

+ +Bugfixes: + +

+ +

2004-Jun-17: v0.73
New features:

+

2004-Jun-13: v0.72 -- This Should Work Edition™
Bugfixes: @@ -170,42 +194,8 @@ the script, and now keeps me from doing stupid stuff like forgetting to upgrade the version number in the script, forgetting to commit my changes to my CVS repository, and forgetting to actually install the script to test. - -

2004-Jun-12: v0.71
-This release is dedicated to the heavy testing given the script by berkus and -mornfall. Thanks guys!

-Bugfixes: - - -New features: - -

I recommend that you set up a separate user account if you decide to run KDE from CVS. I didn't at first, and I won't repeat that mistake for KDE 3.3 ;-). I would also recommend that you add this script to your crontab so that you @@ -841,7 +831,7 @@ href="#options">.kdecvs-buildrc options.

CVSup is a registered trademark of John D. Polstra.
-Last modified: Thu Jun 17 22:50:35 2004
+Last modified: Mon Jun 21 14:52:14 2004
diff --git a/kdecvs-build b/kdecvs-build index 711492c..cdb16b0 100755 --- a/kdecvs-build +++ b/kdecvs-build @@ -70,7 +70,7 @@ my %global_opts = ( my %package_opts; # Holds module-specific options. my @update_list; # List of modules to update/checkout. my @build_list; # List of modules to build. -my @install_list; # List of modules to install. +my $install_flag; # True if we're in install mode. my $BUILD_ID; # Used by logging subsystem to create a unique log dir. my $LOG_DATE; # Used by logging subsystem to create logs in same dir. @@ -329,6 +329,10 @@ sub log_command { # Parent waitpid $pid, 0; + + # If the module fails building, set an internal flag in the module + # options with the name of the log file containing the error message. + $package_opts{$module}{'#error-log-file'} = "$logdir/$filename.log" if $?; return $?; } else @@ -377,6 +381,7 @@ sub safe_make (@) if (pretending) { + return 1; $opts = join(' ', @_); print "\tWould have run make $opts > $logdir/build-$trynumber\n"; return 0; @@ -522,6 +527,45 @@ sub initialize_environment $ENV{'CVS_RSH'} = 'ssh' if $cvsserver =~ /^:ext:/; } +# Subroutine to get a list of modules to install, either from the command line +# if it's not empty, or based on the list of modules successfully built. +sub get_install_list +{ + my @install_list; + + if ($#ARGV > -1) + { + @install_list = @ARGV; + @ARGV = (); + } + else + { + # Get list of built items from $kdecvs/successfully-built + my $logdir = get_subdir_path('global', 'log-dir'); + + if (not open BUILTLIST, "<$logdir/latest/build-status") + { + print "Can't determine what modules have built. You must\n"; + print "specify explicitly on the command line.\n"; + exit (1); # Don't finish, not lock has been taken. + } + + while () + { + chomp; + if (/Succeeded/) + { + s/^([^:]+):.*/$1/; + push @install_list, $_; + } + } + + close BUILTLIST; + } + + return @install_list; +} + # Subroutine to process the command line arguments. Any arguments so # processed will be removed from @ARGV. # The arguments are generally documented in doc.html now. @@ -604,28 +648,7 @@ DONE }; /^--install$/ && do { - if ($#ARGV > -1) - { - @install_list = @ARGV; - @ARGV = (); - } - else - { - # Get list of built items from $kdecvs/successfully-built - my $kdecvs = get_kdecvs_dir(); - - if (not open BUILTLIST, "<$kdecvs/successfully-built") - { - print "Can't determine what modules have built. You must\n"; - print "specify explicitly on the command line.\n"; - exit (1); - } - - @install_list = ; - chomp (@install_list); - close BUILTLIST; - } - + $install_flag = 1; last SWITCH; }; @@ -656,7 +679,6 @@ DONE /^--no-build$/ && do { $global_opts{'#manual-build'} = 1; - @build_list = (); last SWITCH; }; @@ -1201,7 +1223,7 @@ sub handle_updates { print "Unable to make directory $kdecvs!\n$!\n"; @build_list = (); # Clear out the build list, since we can't build. - @install_list = (); # Can't install either. + $install_flag = 0; # Can't install either. return 1; } } @@ -1409,6 +1431,7 @@ sub run_cvs my $arg_ref = shift; my %hash_count; my $result; + my $force_refresh = 0; my $logdir = get_log_dir($module); # Do cvs update. @@ -1432,6 +1455,9 @@ sub run_cvs $hash_count{'removed'}++ if /^R /; $hash_count{'modified'}++ if /^M /; $hash_count{'conflicted'}++ if /^C /; + + # Check if we need to force a refresh. + $force_refresh = 1 if /^A / and /Makefile\.am/; } close CVS_LOG; @@ -1458,6 +1484,13 @@ sub run_cvs print "\t$value $ending.\n"; } + if ($force_refresh) + { + print "A new Makefile.am was added, the build system will be recreated.\n"; + %package_opts{$module}{'refresh-build'} = 1; + %package_opts{$module}{'#cancel-clean'} = 1; + } + return $result; } @@ -1923,8 +1956,18 @@ sub handle_build if (scalar @fail_list > 0) { + my $homedir = $ENV{'HOME'}; + my $logfile; + print "\n<<< PACKAGES FAILED BUILDING >>>\n"; - print join ("\n", @fail_list), "\n"; + for (@fail_list) + { + $logfile = $package_opts{$_}{'#error-log-file'}; + $logfile = "No log file" unless $logfile; + $logfile =~ s|$homedir|~|; + + print "$_ - $logfile\n"; + } } return ((scalar @fail_list) > 0) ? 1 : 0; @@ -2054,7 +2097,7 @@ eval # Make sure unsermake is checked out automatically if needed adjust_update_list(\@update_list, \@build_list); - if ($#install_list == -1) + if (not $install_flag) { # No packages to install, we're in build mode $result = handle_updates (\@update_list); @@ -2071,7 +2114,7 @@ eval join (', ', @ARGV), "\n"; } - $result = handle_install (@install_list); + $result = handle_install (get_install_list()); } $time = localtime;