allow independent setup for the locks location. I strongly suggest

using a local fs.
This commit is contained in:
espie 2013-01-05 18:26:31 +00:00
parent 254001ed60
commit 209b83159b
2 changed files with 22 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: dpb,v 1.71 2013/01/05 15:13:48 espie Exp $
# $OpenBSD: dpb,v 1.72 2013/01/05 18:26:31 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -75,6 +75,7 @@ sub startdate
sub expand_path
{
my ($self, $path) = @_;
$path =~ s/\%L/$self->{logdir}/g;
$path =~ s/\%p/$self->{ports}/g;
$path =~ s/\%h/DPB::Core::Local->hostname/ge;
$path =~ s/\%a/$self->{arch}/g;
@ -147,6 +148,9 @@ sub handle_options
L => sub {
$state->{logdir} = shift;
},
l => sub {
$state->{lockdir} = shift;
},
r => sub {
$state->{random} = 1;
$state->heuristics->random;
@ -171,12 +175,13 @@ sub handle_options
},
};
$state->SUPER::handle_options('acemqrRsuUvh:xA:C:f:F:I:j:J:M:p:P:b:L:S:',
$state->SUPER::handle_options('acemqrRsuUvh:xA:C:f:F:I:j:J:M:p:P:b:l:L:S:',
"[-acemrRsuUvx] [-A arch] [-C plist] [-f N] [-F N] [-I plist] [-J p] [-j N]",
"[-p parallel] [-P plist] [-h hosts] [-L logdir] [-b log] [-M threshold]",
"[path ...]");
"[-p parallel] [-P plist] [-h hosts] [-L logdir] [-l lockdir] [-b log]",
"[-M threshold] [path ...]");
$state->{fullrepo} = join("/", $state->{repo}, $state->arch, "all");
$state->{logdir} //= $ENV{LOGDIR} // '%p/logs/%a';
$state->{lockdir} //= "%L/locks";
if (defined $state->{opt}{F}) {
if (defined $state->{opt}{j} || defined $state->{opt}{f}) {
$state->usage("Can't use -F with -f or -j");
@ -214,6 +219,7 @@ sub handle_options
}
$state->{logdir} = $state->expand_path($state->{logdir});
$state->{lockdir} = $state->expand_path($state->{lockdir});
if ($state->opt('h')) {
$state->{config} = $state->expand_path($state->opt('h'));
}
@ -563,7 +569,7 @@ $state->handle_build_files;
$state->{builder} = DPB::PortBuilder->new($state);
$state->{locker} = DPB::Locks->new($state, join("/", $state->logdir, "locks"));
$state->{locker} = DPB::Locks->new($state, $state->{lockdir});
$state->{affinity} = DPB::Affinity->new($state, join("/", $state->logdir, "affinity"));
$state->{engine} = DPB::Engine->new($state);
$reporter = DPB::Reporter->new($state, "main", "DPB::Core", $state->engine);

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: dpb.1,v 1.57 2013/01/05 13:34:28 espie Exp $
.\" $OpenBSD: dpb.1,v 1.58 2013/01/05 18:26:31 espie Exp $
.\"
.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org>
.\"
@ -35,6 +35,7 @@
.Op Fl J Ar p
.Op Fl j Ar n
.Op Fl L Ar logdir
.Op Fl l Ar lockdir
.Op Fl M Ar threshold
.Op Fl P Ar pathlist
.Op Fl S Ar sizefile
@ -115,6 +116,8 @@ fetch distfiles location (DISTDIR).
.It Cm %h
hostname running
.Nm .
.It Cm %L
logdir location.
.It Cm %p
portsdir location.
.It Cm %t
@ -387,6 +390,13 @@ Choose a log directory.
Defaults to
.Pa ${PORTSDIR}/logs/${ARCH}
.Pc .
.It Fl l Ar lockdir
Choose a lock directory.
.Po
Defaults to
.Pa ${PORTSDIR}/logs/${ARCH}/locks
.Pc .
Override to keep local, as locks don't really like NFS.
.It Fl M Ar threshold
Build ports besides the memory threshold within
.Pa /tmp .