diff options
author | des <des@FreeBSD.org> | 2003-05-16 07:52:38 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-05-16 07:52:38 +0000 |
commit | 16db6492801ee7a156b4a751600be99d8597dad2 (patch) | |
tree | fb1af68e5511fd4ab406491ea9f4db4951d2726b /tools | |
parent | 760e456c35438e4597bf29a953e847e1551a8a35 (diff) | |
download | FreeBSD-src-16db6492801ee7a156b4a751600be99d8597dad2.zip FreeBSD-src-16db6492801ee7a156b4a751600be99d8597dad2.tar.gz |
Add support for local patches (which are also passed on to make release)
--verbose was a little too verbose, especially while cleaning the sandbox.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/tinderbox/tinderbox.pl | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/tools/tools/tinderbox/tinderbox.pl b/tools/tools/tinderbox/tinderbox.pl index 819ccd0..76e3dab 100644 --- a/tools/tools/tinderbox/tinderbox.pl +++ b/tools/tools/tinderbox/tinderbox.pl @@ -41,14 +41,13 @@ my $COPYRIGHT = "Copyright (c) 2003 Dag-Erling Smørgrav. " . my $arch; # Target architecture my $branch; # CVS branch to checkou -my $clean; # Clean before building my $date; # Date of sources to check out my $jobs; # Number of paralell jobs my $logfile; # Path to log file my $machine; # Target machine +my $patch; # Patch to apply before building my $repository; # Location of CVS repository my $sandbox; # Location of sandbox -my $update; # Update sources before building my $verbose; # Verbose mode my %userenv; @@ -133,7 +132,7 @@ sub remove_dir($) { my $dir = shift; if (!-d $dir) { - message("removing $dir") + print("$dir\n") if ($verbose); return (unlink($dir) || $! == ENOENT); } @@ -151,7 +150,7 @@ sub remove_dir($) { } closedir(DIR) or return warning("$dir: $!"); - message("rmdir $dir") + print("$dir\n") if ($verbose); return rmdir($dir); } @@ -248,6 +247,7 @@ Parameters: -j, --jobs=NUM Maximum number of paralell jobs -l, --logfile=FILE Path to log file (e.g. pc98) -m, --machine=MACHINE Target machine + -p, --patch=PATCH Patch to apply before building -r, --repository=DIR Location of CVS repository -s, --sandbox=DIR Location of sandbox @@ -288,6 +288,7 @@ MAIN:{ "j|jobs=i" => \$jobs, "l|logfile=s" => \$logfile, "m|machine=s" => \$machine, + "p|patch=s" => \$patch, "r|repository=s" => \$repository, "s|sandbox=s" => \$sandbox, "v|verbose+" => \$verbose, @@ -329,7 +330,7 @@ MAIN:{ } # Take control of our sandbox - if ($sandbox !~ m|^(/[\w/-]+)$|) { + if ($sandbox !~ m|^(/[\w./-]+)$|) { error("invalid sandbox directory"); } $sandbox = "$1/$branch/$arch/$machine"; @@ -369,14 +370,12 @@ MAIN:{ or error("unable to remove old object directory"); remove_dir("$sandbox/root") or error("unable to remove old chroot directory"); - make_dir("$sandbox/obj") - or error("$sandbox/obj: $!"); } # Check out new source tree if ($cmds{'update'}) { - cd("$sandbox"); logstage("checking out the source tree"); + cd("$sandbox"); my @cvsargs = ( "-f", "-R", @@ -397,6 +396,24 @@ MAIN:{ or error("unable to check out the source tree"); } + # Patch sources + if (defined($patch)) { + $patch = "$sandbox/$patch" + unless ($patch =~ m|^/|); + if ($patch !~ m|^(/[\w./-]+)$|) { + error("invalid patchfile path"); + } + $patch = $1; + if (-f $patch) { + logstage("patching the sources"); + cd("$sandbox/src"); + spawn('/usr/bin/patch', "-f", "-s", "-i$patch") + or error("failed to apply patch to source tree"); + } else { + warning("patch not found"); + } + } + # Prepare environment for make(1); %ENV = ( 'TZ' => "GMT", @@ -429,6 +446,10 @@ MAIN:{ if defined($date); $ENV{'WORLD_FLAGS'} = $ENV{'KERNEL_FLAGS'} = ($jobs > 1) ? "-j$jobs" : "-B"; + if ($patch) { + $ENV{'LOCAL_PATCHES'} = $patch; + $ENV{'PATCH_FLAGS'} = "-fs"; + } # Save time and space $ENV{'NOCDROM'} = "YES"; @@ -475,7 +496,7 @@ MAIN:{ or error("failed to generate LINT kernel config"); } if (! -f "$sandbox/src/sys/$machine/conf/LINT") { - logstage("no LINT kernel config, skipping LINT kernel"); + warning("no LINT kernel config, skipping LINT kernel"); $cmds{'lint'} = 0; } } |