summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-05-15 12:26:55 +0000
committerdes <des@FreeBSD.org>2003-05-15 12:26:55 +0000
commit931e2394a5b4023f1bdc4001805a0129ccbb25f9 (patch)
tree6e9c0ed45615650a162b65c9427ccfb09dfc393c /tools
parent58ea86a82ec6aa281d73e1a8fc7d478a6d3fb6ae (diff)
downloadFreeBSD-src-931e2394a5b4023f1bdc4001805a0129ccbb25f9.zip
FreeBSD-src-931e2394a5b4023f1bdc4001805a0129ccbb25f9.tar.gz
Add a 'release' command which builds a release. It currently sets
NOCDROM, NODOC and NOPORTS to save time and space, but I may remove those at a later date so we can use the results to populate a snapshot server. Document the --machine option. Make $arch and $machine default to the correct values for the current system. This shouldn't make any difference unless you run the tinderbox on a pc98 machine, since for all other platforms, $arch and $machine are the same. Only set kernel-related variables if actually building a kernel or a release. Be paranoid and cd to the correct directory in each stage so we're sure we invoke make(1) in the right place. To support building LINT on -STABLE, don't try to 'make LINT' unless NOTES exists, but build LINT if the config file exists even if there is no NOTES.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/tinderbox/tinderbox.pl72
1 files changed, 58 insertions, 14 deletions
diff --git a/tools/tools/tinderbox/tinderbox.pl b/tools/tools/tinderbox/tinderbox.pl
index d6f5f20..f623a8f 100644
--- a/tools/tools/tinderbox/tinderbox.pl
+++ b/tools/tools/tinderbox/tinderbox.pl
@@ -29,6 +29,7 @@
# $FreeBSD$
#
+use 5.006_001;
use strict;
use Fcntl qw(:DEFAULT :flock);
use POSIX;
@@ -55,7 +56,8 @@ my %userenv;
my %cmds = (
'world' => 0,
'generic' => 0,
- 'lint' => 0
+ 'lint' => 0,
+ 'release' => 0,
);
sub message(@) {
@@ -240,11 +242,12 @@ Options:
-v, --verbose Verbose mode
Parameters:
- -a, --arch=ARCH Target architecture
+ -a, --arch=ARCH Target architecture (e.g. i386)
-b, --branch=BRANCH CVS branch to check out
-d, --date=DATE Date of sources to check out
-j, --jobs=NUM Maximum number of paralell jobs
- -l, --logfile=FILE Path to log file
+ -l, --logfile=FILE Path to log file (e.g. pc98)
+ -m, --machine=MACHINE Target machine
-r, --repository=DIR Location of CVS repository
-s, --sandbox=DIR Location of sandbox
@@ -252,6 +255,7 @@ Commands:
world Build the world
generic Build the GENERIC kernel
lint Build the LINT kernel
+ release Build a full release (run as root!)
Report bugs to <des\@freebsd.org>.
");
@@ -264,8 +268,10 @@ MAIN:{
tzset();
# Set defaults
- $arch = `/usr/bin/uname -m`;
+ $arch = `/usr/bin/uname -p`;
chomp($arch);
+ $machine = `/usr/bin/uname -m`;
+ chomp($machine);
$branch = "CURRENT";
$jobs = 0;
$repository = "/home/ncvs";
@@ -390,7 +396,6 @@ MAIN:{
}
# Prepare environment for make(1);
- cd("$sandbox/src");
%ENV = (
'TZ' => "GMT",
'PATH' => "/usr/bin:/usr/sbin:/bin:/sbin",
@@ -403,9 +408,33 @@ MAIN:{
'CFLAGS' => "-O -pipe",
'NO_CPU_CFLAGS' => "YES",
- 'COPTFLAGS' => "-O -pipe",
- 'NO_CPU_COPTFLAGS' => "YES",
);
+
+ # Kernel-specific variables
+ if ($cmds{'generic'} || $cmds{'lint'} || $cmds{'release'}) {
+ $ENV{'COPTFLAGS'} = "-O -pipe";
+ $ENV{'NO_CPU_COPTFLAGS'} = "YES";
+ }
+
+ # Release-specific variables
+ if ($cmds{'release'}) {
+ $ENV{'BUILDNAME'} = "${branch}_TINDERBOX";
+ $ENV{'CHROOTDIR'} = "$sandbox/root";
+ $ENV{'CVSROOT'} = $repository;
+ $ENV{'RELEASETAG'} = $branch
+ if $branch ne 'CURRENT';
+ $ENV{'CVSCMDARGS'} = "-D$date"
+ if defined($date);
+ $ENV{'WORLD_FLAGS'} = $ENV{'KERNEL_FLAGS'} =
+ ($jobs > 1) ? "-j$jobs" : "-B";
+
+ # Save time and space
+ $ENV{'NOCDROM'} = "YES";
+ $ENV{'NODOC'} = "YES";
+ $ENV{'NOPORTS'} = "YES";
+ }
+
+ # User-supplied variables
foreach my $key (keys(%userenv)) {
if (exists($ENV{$key})) {
warning("will not allow override of $key");
@@ -422,6 +451,7 @@ MAIN:{
# Build the world
if ($cmds{'world'}) {
logstage("building world");
+ cd("$sandbox/src");
make('buildworld')
or error("failed to build world");
}
@@ -429,25 +459,39 @@ MAIN:{
# Build GENERIC if requested
if ($cmds{'generic'}) {
logstage("building generic kernel");
+ cd("$sandbox/src");
spawn('/usr/bin/make', 'buildkernel', 'KERNCONF=GENERIC')
or error("failed to build generic kernel");
}
# Build LINT if requested
- if ($cmds{'lint'} && ! -f "$sandbox/src/sys/$machine/conf/NOTES") {
- logstage("no NOTES, skipping lint kernel");
- $cmds{'lint'} = 0;
+ if ($cmds{'lint'}) {
+ if (-f "$sandbox/src/sys/$machine/conf/NOTES") {
+ logstage("generating LINT kernel config");
+ cd("$sandbox/src/sys/$machine/conf");
+ make('LINT')
+ or error("failed to generate LINT kernel config");
+ }
+ if (! -f "$sandbox/src/sys/$machine/conf/LINT") {
+ logstage("no LINT kernel config, skipping LINT kernel");
+ $cmds{'lint'} = 0;
+ }
}
if ($cmds{'lint'}) {
- logstage("building lint kernel");
- cd("$sandbox/src/sys/$machine/conf");
- make('LINT')
- or error("failed to generate lint config");
+ logstage("building LINT kernel");
cd("$sandbox/src");
spawn('/usr/bin/make', 'buildkernel', 'KERNCONF=LINT')
or error("failed to build lint kernel");
}
+ # Build a release if requested
+ if ($cmds{'release'}) {
+ logstage("building a release");
+ cd("$sandbox/src");
+ make('release')
+ or error("failed to build release");
+ }
+
# Exiting releases the lock file
logstage("tinderbox run completed");
exit(0);
OpenPOWER on IntegriCloud