From 609847a7d35328c2117602f2a61b3e6a1222d363 Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 4 Mar 2010 14:23:01 +0000 Subject: [PATCH] slightly more evolved: run du twice,to get build size vs. fake size. Yep, I should be able to use this information later on. --- infrastructure/build/DPB/Job/Port.pm | 34 ++++++++++++++++++++++++---- infrastructure/build/dpb3 | 7 ++++-- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/infrastructure/build/DPB/Job/Port.pm b/infrastructure/build/DPB/Job/Port.pm index de125427b61..399aa720e7f 100644 --- a/infrastructure/build/DPB/Job/Port.pm +++ b/infrastructure/build/DPB/Job/Port.pm @@ -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 # @@ -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], diff --git a/infrastructure/build/dpb3 b/infrastructure/build/dpb3 index cc275029913..8273f8ff49a 100755 --- a/infrastructure/build/dpb3 +++ b/infrastructure/build/dpb3 @@ -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 # @@ -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);