Permalink
Browse files

Add an --only-steps option.

Requested by Stephen Frost, although not his patch.
Tidy up a lot of the verbose reporting along the way.
  • Loading branch information...
1 parent 8911fc7 commit f449cdc7f11c8ff06eea9176e81c48076bd93102 @adunstan adunstan committed Sep 24, 2012
Showing with 72 additions and 53 deletions.
  1. +3 −0 PGBuild/Modules/TestUpgrade.pm
  2. +3 −2 PGBuild/Options.pm
  3. +66 −51 run_build.pl
@@ -51,6 +51,9 @@ sub check
{
my $self = shift;
+
+ return unless main::step_wanted('pg_upgrade-check');
+
print main::time_str(), "checking pg_upgrade\n" if $verbose;
my @checklog;
View
@@ -22,7 +22,7 @@ BEGIN
@option_list =qw(
$forcerun $buildconf $keepall $help
$quiet $from_source $from_source_clean $testmode
- $test_mode $skip_steps $find_typedefs
+ $test_mode $skip_steps $only_steps $find_typedefs
$nosend $nostatus $verbose
);
}
@@ -41,7 +41,7 @@ our (
$forcerun, $buildconf, $keepall,
$help, $quiet, $from_source,
$from_source_clean, $testmode,$test_mode, $skip_steps,
- $find_typedefs,$nosend, $nostatus, $verbose,
+ $only_steps, $find_typedefs,$nosend, $nostatus, $verbose,
);
my (%standard_options);
@@ -60,6 +60,7 @@ my (%standard_options);
'help' => \$help,
'quiet' => \$quiet,
'skip-steps=s' => \$skip_steps,
+ 'only-steps=s' => \$only_steps,
);
$buildconf = "build-farm.conf"; # default value
View
@@ -89,6 +89,9 @@ BEGIN
die "only one of --from-source and --from-source-clean allowed"
if ($from_source && $from_source_clean);
+die "only one of --skip-steps and --only-steps allowed"
+ if ($skip_steps && $only_steps);
+
$verbose=1 if (defined($verbose) && $verbose==0);
$verbose ||= 0; # stop complaints about undefined var in numeric comparison
@@ -101,12 +104,17 @@ BEGIN
}
-my %skip_steps;
+use vars qw(%skip_steps %only_steps);
$skip_steps ||= "";
if ($skip_steps =~ /\S/)
{
%skip_steps = map {$_ => 1} split(/\s+/,$skip_steps);
}
+$only_steps ||= "";
+if ($only_steps =~ /\S/)
+{
+ %only_steps = map {$_ => 1} split(/\s+/,$only_steps);
+}
use vars qw($branch);
my $explicit_branch = shift;
@@ -610,40 +618,19 @@ END
# module configure has to wait until we have built and installed the base
# so see below
-print time_str(),"running make ...\n" if $verbose;
-
make();
-print time_str(),"running make check ...\n" if $verbose;
-
make_check();
-unless ($using_msvc)
-{
- print time_str(),"running make contrib ...\n" if $verbose;
-
- make_contrib();
-}
-
-if (check_optional_step('build_docs'))
-{
- print time_str(),"running make doc ...\n" if $verbose;
-
- make_doc();
-}
+# contrib is builtunder standard build step for msvc
+make_contrib() unless ($using_msvc);
-print time_str(),"running make install ...\n" if $verbose;
+make_doc() if (check_optional_step('build_docs'));
make_install();
# contrib is installed under standard install for msvc
-unless ($using_msvc)
-{
- print time_str(),"running make contrib install ...\n"
- if $verbose;
-
- make_contrib_install();
-}
+make_contrib_install() unless ($using_msvc);
process_module_hooks('configure');
@@ -655,7 +642,7 @@ END
foreach my $locale (@locales)
{
- last if $skip_steps{install};
+ last unless step_wanted('install');
print time_str(),"setting up db cluster ($locale)...\n" if $verbose;
@@ -665,13 +652,12 @@ END
start_db($locale);
- print time_str(),"running make installcheck ($locale)...\n" if $verbose;
-
make_install_check($locale);
process_module_hooks('installcheck', $locale);
- if (-d "$pgsql/src/test/isolation" && $locale eq 'C')
+ if (-d "$pgsql/src/test/isolation" && $locale eq 'C'
+ && step_wanted('isolation-check'))
{
# restart the db to clear the log file
@@ -688,7 +674,8 @@ END
# releases 8.0 and earlier don't support the standard method for testing
# PLs so only check them for later versions
- if ($branch eq 'HEAD' || $branch gt 'REL8_1')
+ if (($branch eq 'HEAD' || $branch gt 'REL8_1')
+ && step_wanted('pl-install-check'))
{
# restart the db to clear the log file
@@ -703,16 +690,20 @@ END
make_pl_install_check($locale);
}
- # restart the db to clear the log file
- print time_str(),"restarting db ($locale)...\n" if $verbose;
-
- stop_db($locale);
- start_db($locale);
+ if (step_wanted('contrib-install-check'))
+ {
- print time_str(),"running make contrib installcheck ($locale)...\n"
- if $verbose;
+ # restart the db to clear the log file
+ print time_str(),"restarting db ($locale)...\n" if $verbose;
+
+ stop_db($locale);
+ start_db($locale);
+
+ print time_str(),"running make contrib installcheck ($locale)...\n"
+ if $verbose;
- make_contrib_install_check($locale);
+ make_contrib_install_check($locale);
+ }
print time_str(),"stopping db ($locale)...\n" if $verbose;
@@ -723,7 +714,7 @@ END
}
# ecpg checks are not supported in 8.1 and earlier
-if ($branch eq 'HEAD' || $branch gt 'REL8_2')
+if (($branch eq 'HEAD' || $branch gt 'REL8_2') && step_wanted('ecpg-check'))
{
print time_str(),"running make ecpg check ...\n" if $verbose;
@@ -772,6 +763,7 @@ sub print_help
--quiet = suppress normal error message
--test = short for --nosend --nostatus --verbose --force
--skip-steps=list = skip certain steps
+ --only-steps=list = only do certain steps, not allowed with skip-steps
Default branch is HEAD. Usually only the --config option should be necessary.
@@ -785,6 +777,14 @@ sub time_str
return sprintf("[%.2d:%.2d:%.2d] ",$hour, $min, $sec);
}
+sub step_wanted
+{
+ my $step = shift;
+ return $only_steps{$step} if $only_steps;
+ return ! $skip_steps{$step} if $skip_steps;
+ return 1; # default is everything is wanted
+}
+
sub register_module_hooks
{
my $who = shift;
@@ -882,7 +882,9 @@ sub check_make
sub make
{
- return if $skip_steps{make};
+ return unless step_wanted('make');
+ print time_str(),"running make ...\n" if $verbose;
+
my (@makeout);
unless ($using_msvc)
{
@@ -906,7 +908,9 @@ sub make
sub make_doc
{
- return if $skip_steps{'make-doc'};
+ return unless step_wanted('make-doc');
+ print time_str(),"running make doc ...\n" if $verbose;
+
my (@makeout);
unless ($using_msvc)
{
@@ -927,7 +931,9 @@ sub make_doc
sub make_install
{
- return if $skip_steps{install};
+ return unless step_wanted('install');
+ print time_str(),"running make install ...\n" if $verbose;
+
my @makeout;
unless ($using_msvc)
{
@@ -989,7 +995,9 @@ sub make_contrib
{
# part of build under msvc
- return if $skip_steps{'make-contrib'};
+ return unless step_wanted('make-contrib');
+ print time_str(),"running make contrib ...\n" if $verbose;
+
my $make_cmd = $make;
$make_cmd = "$make -j $make_jobs"
if ($make_jobs > 1 && ($branch eq 'HEAD' || $branch ge 'REL9_1'));
@@ -1003,7 +1011,10 @@ sub make_contrib
sub make_contrib_install
{
- return if $skip_steps{'install'};
+ return unless step_wanted('install');
+ print time_str(),"running make contrib install ...\n"
+ if $verbose;
+
# part of install under msvc
my @makeout = `cd $pgsql/contrib && $make install 2>&1`;
@@ -1156,7 +1167,9 @@ sub get_stack_trace
sub make_install_check
{
my $locale = shift;
- return if $skip_steps{'install-check'};
+ return unless step_wanted('install-check');
+ print time_str(),"running make installcheck ($locale)...\n" if $verbose;
+
my @checklog;
unless ($using_msvc)
{
@@ -1199,7 +1212,7 @@ sub make_install_check
sub make_contrib_install_check
{
my $locale = shift;
- return if $skip_steps{'contrib-install-check'};
+ return unless step_wanted('contrib-install-check');
my @checklog;
unless ($using_msvc)
{
@@ -1242,7 +1255,7 @@ sub make_contrib_install_check
sub make_pl_install_check
{
my $locale = shift;
- return if $skip_steps{'pl-install-check'};
+ return unless step_wanted('pl-install-check');
my @checklog;
unless ($using_msvc)
{
@@ -1288,7 +1301,7 @@ sub make_pl_install_check
sub make_isolation_check
{
my $locale = shift;
- return if $skip_steps{'isolation-check'};
+ return unless step_wanted('isolation-check');
my @makeout;
unless ($using_msvc)
{
@@ -1337,7 +1350,9 @@ sub make_isolation_check
sub make_check
{
- return if $skip_steps{check};
+ return unless step_wanted('check');
+ print time_str(),"running make check ...\n" if $verbose;
+
my @makeout;
unless ($using_msvc)
{
@@ -1389,7 +1404,7 @@ sub make_check
sub make_ecpg_check
{
- return if $skip_steps{'ecpg-check'};
+ return unless step_wanted('ecpg-check');
my @makeout;
my $ecpg_dir = "$pgsql/src/interfaces/ecpg";
if ($using_msvc)

0 comments on commit f449cdc

Please sign in to comment.