add computation of workdir size on -s (assumes a patch to bsd.port.mk
that's not yet there)
This commit is contained in:
parent
9c36a01236
commit
6fdf400298
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Port.pm,v 1.6 2010/03/02 02:33:15 espie Exp $
|
||||
# $OpenBSD: Port.pm,v 1.7 2010/03/02 18:20:45 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -81,21 +81,21 @@ sub run
|
||||
my ($self, $core) = @_;
|
||||
my $job = $core->job;
|
||||
my $t = $self->{phase};
|
||||
my $ports = $job->{builder}->{ports};
|
||||
my $builder = $job->{builder};
|
||||
my $ports = $builder->{ports};
|
||||
my $fullpkgpath = $job->{v}->fullpkgpath;
|
||||
my $make = $job->{builder}->{make};
|
||||
my $sudo = OpenBSD::Paths->sudo;
|
||||
my $shell = $core->{shell};
|
||||
$self->redirect($job->{log});
|
||||
my @args = ($t, "TRUST_PACKAGES=Yes",
|
||||
"REPORT_PROBLEM='exit 1'");
|
||||
"REPORT_PROBLEM='exit 1'", "BULK=No");
|
||||
if ($job->{special}) {
|
||||
push(@args, "WRKOBJDIR=/tmp/ports");
|
||||
}
|
||||
if (defined $shell) {
|
||||
unshift(@args, $shell->make);
|
||||
if ($self->{sudo}) {
|
||||
unshift(@args, $sudo);
|
||||
unshift(@args, $sudo, "-E");
|
||||
}
|
||||
$shell->run("cd $ports && SUBDIR=".
|
||||
$fullpkgpath." ".join(' ', @args));
|
||||
@ -104,9 +104,9 @@ sub run
|
||||
die "Wrong ports tree $ports";
|
||||
$ENV{SUBDIR} = $fullpkgpath;
|
||||
if ($self->{sudo}) {
|
||||
exec {$sudo}("sudo", $make, @args);
|
||||
exec {$sudo}("sudo", "-E", $builder->{make}, @args);
|
||||
} else {
|
||||
exec {$make} ("make", @args);
|
||||
exec {$builder->{make}} ("make", @args);
|
||||
}
|
||||
}
|
||||
exit(1);
|
||||
@ -124,6 +124,7 @@ our @ISA = qw(DPB::Task::Port);
|
||||
sub fork
|
||||
{
|
||||
my ($self, $core) = @_;
|
||||
$self->{sudo} = 1;
|
||||
open($self->{fh}, "-|");
|
||||
}
|
||||
|
||||
@ -211,7 +212,7 @@ package DPB::Job::Port;
|
||||
our @ISA = qw(DPB::Job::Normal);
|
||||
|
||||
use Time::HiRes qw(time);
|
||||
my @list = qw(prepare fetch patch configure build fake package clean);
|
||||
my @list = qw(prepare fetch patch configure build fake package);
|
||||
|
||||
sub new
|
||||
{
|
||||
@ -220,6 +221,10 @@ sub new
|
||||
if ($builder->{clean}) {
|
||||
unshift @todo, "clean";
|
||||
}
|
||||
if ($builder->{size}) {
|
||||
push @todo, 'show-size';
|
||||
}
|
||||
push @todo, 'clean';
|
||||
bless {
|
||||
tasks => [map {DPB::Port::TaskFactory->create($_)} @todo],
|
||||
log => $log, v => $v,
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: dpb3,v 1.4 2010/03/01 18:11:11 espie Exp $
|
||||
# $OpenBSD: dpb3,v 1.5 2010/03/02 18:20:45 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -45,7 +45,7 @@ use OpenBSD::Paths;
|
||||
my $make = $ENV{MAKE} || OpenBSD::Paths->make;
|
||||
|
||||
our ($opt_t, $opt_e, $opt_T, $opt_c, $opt_h, $opt_A, $opt_j, $opt_a,
|
||||
$opt_r,
|
||||
$opt_r, $opt_s,
|
||||
$opt_L, $opt_m, $opt_f, $opt_x);
|
||||
my @subdirlist;
|
||||
|
||||
@ -72,10 +72,10 @@ sub parse_build_file
|
||||
|
||||
my $parsed = 0;
|
||||
my $heuristics = DPB::Heuristics->new;
|
||||
set_usage("dpb3 [-acertx] [-A arch] [-j N] [-P plist] [-h hosts] [-L lockdir] [-b log] ",
|
||||
set_usage("dpb3 [-acerstx] [-A arch] [-j N] [-P plist] [-h hosts] [-L lockdir] [-b log] ",
|
||||
"[-T timeout] [-m threshold] [path ...]");
|
||||
try {
|
||||
getopts('acerh:txA:f:j:m:P:b:L:T:', {
|
||||
getopts('acersh:txA:f:j:m:P:b:L:T:', {
|
||||
P => sub {
|
||||
my $file = shift;
|
||||
open my $fh, '<', $file or die "Can't open $file\n";
|
||||
@ -125,8 +125,8 @@ for my $arg (@ARGV) {
|
||||
$pkgpath->add_to_subdirlist(\@subdirlist);
|
||||
}
|
||||
|
||||
my ($ports, $repo, $localarch, $distdir) = DPB::Vars->get($make, "PORTSDIR",
|
||||
"PACKAGE_REPOSITORY", "MACHINE_ARCH", "DISTDIR");
|
||||
my ($ports, $repo, $localarch, $distdir) = DPB::Vars->get($make,
|
||||
"PORTSDIR", "PACKAGE_REPOSITORY", "MACHINE_ARCH", "DISTDIR");
|
||||
|
||||
my $arch = $opt_A // $localarch;
|
||||
$opt_A //= '';
|
||||
@ -161,7 +161,7 @@ for (1 .. $opt_j) {
|
||||
}
|
||||
|
||||
my $builder = ($opt_t ? "DPB::PortBuilder::Test" : "DPB::PortBuilder")->new(
|
||||
$opt_c, $fullrepo, $logger, $ports, $make, $heuristics);
|
||||
$opt_c, $opt_s, $fullrepo, $logger, $ports, $make, $heuristics);
|
||||
|
||||
my $locker = DPB::Locks->new($lockdir);
|
||||
my $engine = DPB::Engine->new($builder, $heuristics, $logger, $locker);
|
||||
|
Loading…
Reference in New Issue
Block a user