summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-01-23 23:04:26 +0000
committerdes <des@FreeBSD.org>2004-01-23 23:04:26 +0000
commitb5a653e3457e11ab3a5c26216f706bd67e8df91b (patch)
treee487b19112f805283bed314fe782e50910fcd95f /tools
parent041f2e6f18f49f234ce143d20449ccb11f1be487 (diff)
downloadFreeBSD-src-b5a653e3457e11ab3a5c26216f706bd67e8df91b.zip
FreeBSD-src-b5a653e3457e11ab3a5c26216f706bd67e8df91b.tar.gz
Add support for using cvsup instead of cvs to update the source tree.
Fix the "clean" command: don't try to rmdir symlinks, and run chflags before trying to delete the chroot tree. Tweak some error and info messages.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/tinderbox/tinderbox.pl104
1 files changed, 70 insertions, 34 deletions
diff --git a/tools/tools/tinderbox/tinderbox.pl b/tools/tools/tinderbox/tinderbox.pl
index 5db0707..a82c473 100644
--- a/tools/tools/tinderbox/tinderbox.pl
+++ b/tools/tools/tinderbox/tinderbox.pl
@@ -41,6 +41,7 @@ my $COPYRIGHT = "Copyright (c) 2003 Dag-Erling Smørgrav. " .
my $arch; # Target architecture
my $branch; # CVS branch to checkou
+my $cvsup; # Name of CVSup server
my $date; # Date of sources to check out
my $jobs; # Number of paralell jobs
my $hostname; # Name of the host running the tinderbox
@@ -133,28 +134,32 @@ sub remove_dir($);
sub remove_dir($) {
my $dir = shift;
- if (!-d $dir) {
- print("$dir\n")
+ if (-l $dir || !-d $dir) {
+ print("rm $dir\n")
if ($verbose);
- return (unlink($dir) || $! == ENOENT);
+ if (!unlink($dir) && $! != ENOENT) {
+ return warning("$dir: $!");
+ }
+ return 1;
}
local *DIR;
opendir(DIR, $dir)
or return warning("$dir: $!");
- foreach my $ent (readdir(DIR)) {
+ my @entries = readdir(DIR);
+ closedir(DIR)
+ or return warning("$dir: $!");
+ foreach my $ent (@entries) {
next if ($ent eq '.' || $ent eq '..');
$ent =~ m/(.*)/;
- if (!remove_dir("$dir/$1")) {
- closedir(DIR);
- return undef;
- }
+ remove_dir("$dir/$1")
+ or return undef;
}
- closedir(DIR)
- or return warning("$dir: $!");
- print("$dir\n")
+ print("rmdir $dir\n")
if ($verbose);
- return rmdir($dir);
+ rmdir($dir)
+ or return warning("$dir: $!");
+ return 1;
}
sub make_dir($);
@@ -293,6 +298,7 @@ MAIN:{
GetOptions(
"a|arch=s" => \$arch,
"b|branch=s" => \$branch,
+ "c|cvsup=s" => \$cvsup,
"d|date=s" => \$date,
"j|jobs=i" => \$jobs,
"l|logfile=s" => \$logfile,
@@ -353,6 +359,7 @@ MAIN:{
error("invalid sandbox directory");
}
$sandbox = "$1/$branch/$arch/$machine";
+ $ENV{'HOME'} = $sandbox;
make_dir($sandbox)
or error("$sandbox: $!");
my $lockfile = open_locked("$sandbox/lock", O_RDWR|O_CREAT);
@@ -388,33 +395,62 @@ MAIN:{
or error("unable to remove old source directory");
remove_dir("$sandbox/obj")
or error("unable to remove old object directory");
-# This will fail due to schg files - must clear flags before removing
-# remove_dir("$sandbox/root")
-# or error("unable to remove old chroot directory");
+ spawn('/bin/chflags', '-R', '0', "$sandbox/root");
+ remove_dir("$sandbox/root")
+ or error("unable to remove old chroot directory");
}
# Check out new source tree
if ($cmds{'update'}) {
- logstage("checking out the source tree");
- cd("$sandbox");
- my @cvsargs = (
- "-f",
- "-R",
- $verbose ? "-q" : "-Q",
- "-d$repository",
- );
- if (-d "$sandbox/src") {
- push(@cvsargs, "update", "-Pd");
+ if (defined($cvsup)) {
+ logstage("cvsupping the source tree");
+ local *SUPFILE;
+ open(SUPFILE, ">", "$sandbox/supfile")
+ or error("$sandbox/supfile: $!");
+ print(SUPFILE "*default host=$cvsup\n");
+ print(SUPFILE "*default base=$sandbox\n");
+ print(SUPFILE "*default prefix=$sandbox\n");
+ print(SUPFILE "*default delete use-rel-suffix\n");
+ print(SUPFILE "src-all release=cvs");
+ if ($branch eq 'CURRENT') {
+ print(SUPFILE " tag=.");
+ } else {
+ print(SUPFILE " tag=$branch");
+ }
+ print(SUPFILE " date=$date")
+ if defined($date);
+ print(SUPFILE "\n");
+ close(SUPFILE);
+ my @cvsupargs = (
+ "-1",
+ "-g",
+ "-L", ($verbose ? 2 : 1),
+ "$sandbox/supfile"
+ );
+ spawn('/usr/local/bin/cvsup', @cvsupargs)
+ or error("unable to cvsup the source tree");
} else {
- push(@cvsargs, "checkout", "-P");
- };
- push(@cvsargs, ($branch eq 'CURRENT') ? "-A" : "-r$branch")
- if defined($branch);
- push(@cvsargs, "-D$date")
- if defined($date);
- push(@cvsargs, "src");
- spawn('/usr/bin/cvs', @cvsargs)
- or error("unable to check out the source tree");
+ logstage("checking out the source tree");
+ cd("$sandbox");
+ my @cvsargs = (
+ "-f",
+ "-R",
+ $verbose ? "-q" : "-Q",
+ "-d$repository",
+ );
+ if (-d "$sandbox/src") {
+ push(@cvsargs, "update", "-Pd");
+ } else {
+ push(@cvsargs, "checkout", "-P");
+ };
+ push(@cvsargs, ($branch eq 'CURRENT') ? "-A" : "-r$branch")
+ if defined($branch);
+ push(@cvsargs, "-D$date")
+ if defined($date);
+ push(@cvsargs, "src");
+ spawn('/usr/bin/cvs', @cvsargs)
+ or error("unable to check out the source tree");
+ }
}
# Patch sources
OpenPOWER on IntegriCloud