if we're running -f, do the checksum part internally, since we already

checksummed stuff we fetched (will allow auto-refetch eventually).
This commit is contained in:
espie 2011-05-29 09:30:13 +00:00
parent 3239a328de
commit 84266ee8ac
3 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Engine.pm,v 1.21 2011/05/28 19:24:15 espie Exp $
# $OpenBSD: Engine.pm,v 1.22 2011/05/29 09:30:13 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -424,6 +424,7 @@ sub adjust_distfiles
}
if ($self->{tofetch}->is_done($f)) {
delete $v->{info}{distfiles}{$f};
$v->{info}{got}{$f} = $f;
next;
}
$has++;

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Port.pm,v 1.8 2011/05/22 08:21:39 espie Exp $
# $OpenBSD: Port.pm,v 1.9 2011/05/29 09:30:13 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -68,6 +68,9 @@ sub run
if ($job->{special}) {
push(@args, "WRKOBJDIR=/tmp/ports");
}
if ($builder->{fetch}) {
push(@args, "NO_CHECKSUM=Yes");
}
if (defined $shell) {
unshift(@args, $shell->make);
if ($self->{sudo}) {
@ -117,6 +120,22 @@ sub finalize
return 1;
}
package DPB::Task::Port::Checksum;
our @ISA = qw(DPB::Task::Port);
sub run
{
my ($self, $core) = @_;
my $job = $core->job;
$self->redirect($job->{log});
my $exit = 0;
for my $dist (values %{$job->{v}{info}{got}}) {
if (!$dist->checksum($dist->filename)) {
$exit = 1;
}
}
exit($exit);
}
package DPB::Task::Port::Depends;
our @ISA=qw(DPB::Task::Port::NoTime);
@ -271,6 +290,7 @@ sub finalize
package DPB::Port::TaskFactory;
my $repo = {
default => 'DPB::Task::Port',
checksum => 'DPB::Task::Port::Checksum',
clean => 'DPB::Task::Port::Clean',
prepare => 'DPB::Task::Port::NoTime',
fetch => 'DPB::Task::Port::Fetch',
@ -326,7 +346,13 @@ sub add_normal_tasks
if ($builder->{clean}) {
push @todo, "clean";
}
push(@todo, qw(depends prepare fetch patch configure build));
push(@todo, qw(depends prepare));
if ($builder->{fetch}) {
push(@todo, qw(checksum));
} else {
push(@todo, qw(fetch));
}
push(@todo, qw(patch configure build));
if ($builder->{size}) {
push @todo, 'show-size';
}

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: PortBuilder.pm,v 1.8 2011/05/22 08:21:39 espie Exp $
# $OpenBSD: PortBuilder.pm,v 1.9 2011/05/29 09:30:13 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -31,6 +31,7 @@ sub new
my $self = bless {
state => $state,
clean => $state->opt('c'),
fetch => $state->opt('f'),
size => $state->opt('s'),
rebuild => $state->opt('R'),
fullrepo => $state->fullrepo,