change things again to have command line options override host file.
and provide the possibility of a DEFAULT entry in the host file.
This commit is contained in:
parent
94c55bc7b4
commit
9b37bcd801
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: dpb,v 1.55 2012/10/10 11:44:11 rpe Exp $
|
||||
# $OpenBSD: dpb,v 1.56 2012/10/11 07:40:30 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -227,9 +227,6 @@ sub handle_options
|
||||
$state->heuristics->set_logger($state->logger);
|
||||
$state->{display_timeout} =
|
||||
$state->{subst}->value('DISPLAY_TIMEOUT') // 10;
|
||||
$state->{connection_timeout} =
|
||||
$state->{subst}->value('CONNECTION_TIMEOUT');
|
||||
$state->{stuck_timeout} = $state->{subst}->value('STUCK_TIMEOUT');
|
||||
$state->{build_once} = $state->{all};
|
||||
if ($state->defines("DONT_BUILD_ONCE")) {
|
||||
$state->{build_once} = 0;
|
||||
@ -241,27 +238,30 @@ sub start_cores
|
||||
{
|
||||
my $state = shift;
|
||||
|
||||
my $default_prop = {};
|
||||
my $override_prop = {};
|
||||
|
||||
if ($state->opt('j')) {
|
||||
$default_prop->{jobs} = $state->opt('j');
|
||||
$override_prop->{jobs} = $state->opt('j');
|
||||
}
|
||||
if ($state->opt('p')) {
|
||||
$default_prop->{parallel} = $state->opt('p');
|
||||
$override_prop->{parallel} = $state->opt('p');
|
||||
}
|
||||
if ($state->{stuck_timeout}) {
|
||||
$default_prop->{stuck} = $state->{stuck_timeout};
|
||||
if (my $t = $state->{subst}->value('STUCK_TIMEOUT')) {
|
||||
$override_prop->{stuck} = $t;
|
||||
}
|
||||
if (my $t = $state->{subst}->value('CONNECTION_TIMEOUT')) {
|
||||
$override_prop->{timeout} = $t;
|
||||
}
|
||||
if ($state->opt('J')) {
|
||||
$default_prop->{junk} = $state->opt('J');
|
||||
$override_prop->{junk} = $state->opt('J');
|
||||
}
|
||||
|
||||
if ($state->{config}) {
|
||||
DPB::Core->parse_hosts_file($state->{config}, $state, $default_prop);
|
||||
DPB::Core->parse_hosts_file($state->{config}, $state, $override_prop);
|
||||
}
|
||||
|
||||
if (!$state->{config}) {
|
||||
DPB::Core::Factory->new('localhost', $default_prop);
|
||||
DPB::Core::Factory->new('localhost', $override_prop);
|
||||
}
|
||||
DPB::Core::Factory->init_cores($state);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Core.pm,v 1.17 2012/10/08 14:16:36 espie Exp $
|
||||
# $OpenBSD: Core.pm,v 1.18 2012/10/11 07:40:30 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -696,12 +696,13 @@ sub has_sf
|
||||
|
||||
sub parse_hosts_file
|
||||
{
|
||||
my ($class, $filename, $state, $default) = @_;
|
||||
my ($class, $filename, $state, $override) = @_;
|
||||
open my $fh, '<', $filename or
|
||||
$state->fatal("Can't read host files #1: #2", $filename, $!);
|
||||
my $_;
|
||||
my $sf;
|
||||
my $cores = {};
|
||||
my $default = {};
|
||||
while (<$fh>) {
|
||||
chomp;
|
||||
s/\s*\#.*$//;
|
||||
@ -710,7 +711,7 @@ sub parse_hosts_file
|
||||
$state->{startup_script} = $1;
|
||||
next;
|
||||
}
|
||||
# copy default [properties
|
||||
# copy default properties
|
||||
my $prop = { %$default };
|
||||
my ($host, @properties) = split(/\s+/, $_);
|
||||
for my $_ (@properties) {
|
||||
@ -724,16 +725,17 @@ sub parse_hosts_file
|
||||
if (defined $prop->{mem}) {
|
||||
$prop->{memory} = $prop->{mem};
|
||||
}
|
||||
if ($host eq 'DEFAULT') {
|
||||
$default = { %$prop };
|
||||
next;
|
||||
}
|
||||
while (my ($k, $v) = each %$override) {
|
||||
$prop->{$k} = $v;
|
||||
}
|
||||
$sf //= $prop->{sf};
|
||||
if (defined $prop->{sf} && $prop->{sf} != $sf) {
|
||||
$has_sf = 1;
|
||||
}
|
||||
if (defined $state->{connection_timeout}) {
|
||||
$prop->{timeout} //= $state->{connection_timeout};
|
||||
}
|
||||
if (defined $state->{stuck_timeout}) {
|
||||
$prop->{stuck} //= $state->{stuck_timeout};
|
||||
}
|
||||
$state->heuristics->calibrate(DPB::Core::Factory->new($host,
|
||||
$prop));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: dpb.1,v 1.43 2012/10/09 20:35:57 espie Exp $
|
||||
.\" $OpenBSD: dpb.1,v 1.44 2012/10/11 07:40:30 espie Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
.\"
|
||||
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: October 9 2012 $
|
||||
.Dd $Mdocdate: October 11 2012 $
|
||||
.Dt DPB 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -197,7 +197,7 @@ Disable reading/saving of default build stats under
|
||||
.It Ar STUCK_TIMEOUT
|
||||
Timeout (in seconds * speed factor) after which tasks that don't show
|
||||
any progress will be killed.
|
||||
This can be set on a per-core basis as the
|
||||
This can be instead set on a per-core basis as the
|
||||
.Sq stuck
|
||||
property.
|
||||
Note that this will always be divided by the core's speed factor.
|
||||
@ -226,9 +226,23 @@ information.
|
||||
.It Fl h Ar hosts
|
||||
File with hosts to use for building.
|
||||
One host per line, plus properties, such as:
|
||||
.Bd -literal
|
||||
.Bd -literal -offset indent
|
||||
espie@aeryn jobs=4 arch=i386
|
||||
.Ed
|
||||
.Pp
|
||||
The special hostname
|
||||
.Ar DEFAULT
|
||||
can be used to preset defaults.
|
||||
It should be used at the start of the file.
|
||||
.Pp
|
||||
Use
|
||||
.Ar localhost
|
||||
to specify the local machine.
|
||||
.Nm
|
||||
will special-case it and not use
|
||||
.Xr ssh 1
|
||||
to connect.
|
||||
.Pp
|
||||
Properties are as follows:
|
||||
.Bl -tag -width memory=150
|
||||
.It arch=value
|
||||
@ -269,12 +283,14 @@ will get killed.
|
||||
.It timeout=s
|
||||
Defines a specific connection timeout for ssh to that host.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Ar hosts
|
||||
file can also define a start-up script, as
|
||||
.Bd -literal
|
||||
.Bd -literal -offset indent
|
||||
STARTUP=path
|
||||
.Ed
|
||||
.Pp
|
||||
which will be run at start-up on each machine.
|
||||
There are no fine-grained options to control
|
||||
.Xr ssh 1
|
||||
@ -286,9 +302,9 @@ List of
|
||||
to install, on the local box.
|
||||
This will also add them to the list of things to build.
|
||||
.It Fl J Ar p
|
||||
Default value for the
|
||||
Override value for the
|
||||
.Dq junk
|
||||
propery.
|
||||
property.
|
||||
Delete unneeded installed packages during the build.
|
||||
Each
|
||||
.Ar prepare
|
||||
@ -348,7 +364,7 @@ Read list of
|
||||
.Xr pkgpath 7
|
||||
from file.
|
||||
.It Fl p Ar parallel
|
||||
Default value for the
|
||||
Override value for the
|
||||
.Dq parallel
|
||||
property.
|
||||
.Pp
|
||||
@ -673,6 +689,10 @@ and finishes at
|
||||
.Sq package .
|
||||
.It Pa clean.log
|
||||
Paths that do not clean correctly, and required sudo to clean the directory.
|
||||
.It Pa concurrent.log
|
||||
Shows the actual concurrency achieved as a result of job starvation /
|
||||
parallel handling.
|
||||
Only gets a new line when the value changes: pid timestamp jobs
|
||||
.It Pa dependencies.log
|
||||
List of pkgpath frequencies, filled at end of LISTING if
|
||||
.Fl a .
|
||||
@ -696,7 +716,11 @@ pkgpath ignored, either directly, or indirectly because a dependency was
|
||||
ignored.
|
||||
End of the line states reason why ignored.
|
||||
.It B
|
||||
pkgpath built.
|
||||
pkgpath built / distfile found.
|
||||
.It E
|
||||
error in build or fetch.
|
||||
.It F
|
||||
distfile queued for download.
|
||||
.It I
|
||||
pkgpath can be installed.
|
||||
.It J
|
||||
@ -712,7 +736,7 @@ built package is no longer required for anything.
|
||||
.It Q
|
||||
pkgpath queued as buildable whenever a slot is free.
|
||||
.It T
|
||||
pkgpath to build.
|
||||
pkgpath to build / distfile to download.
|
||||
.It V
|
||||
pkgpath put back in the buildable queue, after job that was running in
|
||||
the same directory returned.
|
||||
|
Loading…
Reference in New Issue
Block a user