slightly more evolved: run du twice,to get build size vs. fake size.
Yep, I should be able to use this information later on.
This commit is contained in:
parent
6ccdda1670
commit
609847a7d3
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Port.pm,v 1.7 2010/03/02 18:20:45 espie Exp $
|
||||
# $OpenBSD: Port.pm,v 1.8 2010/03/04 14:23:01 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -133,6 +133,25 @@ sub redirect
|
||||
my ($self, $log) = @_;
|
||||
}
|
||||
|
||||
sub finalize
|
||||
{
|
||||
my ($self, $core) = @_;
|
||||
my $fh = $self->{fh};
|
||||
if ($core->{status} == 0) {
|
||||
my $line = <$fh>;
|
||||
$line = <$fh>;
|
||||
if ($line =~ m/^\s*(\d+)\s+/) {
|
||||
my $sz = $1;
|
||||
my $job = $core->job;
|
||||
$core->job->{wrkdir} = $sz;
|
||||
}
|
||||
}
|
||||
close($fh);
|
||||
return 1;
|
||||
}
|
||||
package DPB::Task::Port::ShowFakeSize;
|
||||
our @ISA = qw(DPB::Task::Port::ShowSize);
|
||||
|
||||
sub finalize
|
||||
{
|
||||
my ($self, $core) = @_;
|
||||
@ -144,7 +163,7 @@ sub finalize
|
||||
my $sz = $1;
|
||||
my $job = $core->job;
|
||||
my $f2 = $job->{builder}->{logger}->open("size");
|
||||
print $f2 $job->{v}->fullpkgpath, " $sz\n";
|
||||
print $f2 $job->{v}->fullpkgpath, " $job->{wrkdir} $sz\n";
|
||||
}
|
||||
}
|
||||
close($fh);
|
||||
@ -198,6 +217,7 @@ my $repo = {
|
||||
prepare => 'DPB::Task::Port::NoTime',
|
||||
fetch => 'DPB::Task::Port::Fetch',
|
||||
'show-size' => 'DPB::Task::Port::ShowSize',
|
||||
'show-fake-size' => 'DPB::Task::Port::ShowFakeSize',
|
||||
};
|
||||
|
||||
sub create
|
||||
@ -212,18 +232,22 @@ 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);
|
||||
|
||||
sub new
|
||||
{
|
||||
my ($class, $log, $v, $builder, $special, $endcode) = @_;
|
||||
my @todo = @list;
|
||||
my @todo;
|
||||
if ($builder->{clean}) {
|
||||
unshift @todo, "clean";
|
||||
push @todo, "clean";
|
||||
}
|
||||
push(@todo, qw(prepare fetch patch configure build));
|
||||
if ($builder->{size}) {
|
||||
push @todo, 'show-size';
|
||||
}
|
||||
push(@todo, qw(fake package));
|
||||
if ($builder->{size}) {
|
||||
push @todo, 'show-fake-size';
|
||||
}
|
||||
push @todo, 'clean';
|
||||
bless {
|
||||
tasks => [map {DPB::Port::TaskFactory->create($_)} @todo],
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: dpb3,v 1.6 2010/03/04 13:56:09 espie Exp $
|
||||
# $OpenBSD: dpb3,v 1.7 2010/03/04 14:23:01 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -56,7 +56,10 @@ sub parse_size_file
|
||||
my $_;
|
||||
while (<$fh>) {
|
||||
chomp;
|
||||
my ($pkgpath, $sz) = split(/\s+/, $_);
|
||||
my ($pkgpath, $sz, $sz2) = split(/\s+/, $_);
|
||||
if (defined $sz2) {
|
||||
$sz += $sz2;
|
||||
}
|
||||
my $o = DPB::PkgPath->new_hidden($pkgpath);
|
||||
for my $c (@consumers) {
|
||||
$c->add_size_info($o, $sz);
|
||||
|
Loading…
Reference in New Issue
Block a user