finish distfiles history handling: people who don't fetch/build the whole

tree may want to weed distfiles too, so allow for a full scan of the tree
without building/fetching anything, just to update history:

dpb -DHISTORY_ONLY

(just requires making sure the right engines are created, and a very shortened
loop at end waiting for history to be updated).
This commit is contained in:
espie 2012-01-30 15:11:04 +00:00
parent 623eb8b2c5
commit 7f2b8805ae
3 changed files with 29 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: dpb,v 1.40 2012/01/09 17:56:28 espie Exp $
# $OpenBSD: dpb,v 1.41 2012/01/30 15:11:04 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -144,6 +144,19 @@ sub handle_options
if ($state->opt('f') !~ m/^\d+$/) {
$state->usage("-f takes a numerical argument");
}
if ($state->opt('f')) {
$state->{want_fetchinfo} = 1;
}
if (!$state->{subst}->empty('HISTORY_ONLY')) {
$state->{want_fetchinfo} = 1;
$state->{opt}{f} = 0;
$state->{opt}{j} = 1;
$state->{opt}{e} = 1;
$state->{all} = 1;
$state->{scan_only} = 1;
# XXX not really random, but no need to use dependencies
$state->{random} = 1;
}
$state->{logger} = DPB::Logger->new($state->logdir, $state->opt('c'));
$state->heuristics->set_logger($state->logger);
$state->{display_timeout} =
@ -488,11 +501,19 @@ if (!$state->opt('e') && !$occupied) {
$core->mark_ready;
}
# and let's wait for all jobs now.
$state->engine->check_buildable(1);
DPB::Core->start_clock($state->{display_timeout});
main_loop();
if ($state->{scan_only}) {
# very shortened loop
$reporter->report;
if (DPB::Core->running) {
DPB::Core->reap_wait;
}
} else {
# and let's wait for all jobs now.
DPB::Core->start_clock($state->{display_timeout});
main_loop();
}
$reporter->reset;
DPB::Core->cleanup;

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Engine.pm,v 1.45 2012/01/23 10:35:38 espie Exp $
# $OpenBSD: Engine.pm,v 1.46 2012/01/30 15:11:04 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -319,7 +319,7 @@ sub new
ignored => []}, $class;
$o->{buildable} = ($state->{fetch_only} ? "DPB::SubEngine::NoBuild"
: "DPB::SubEngine::Build")->new($o, $state->builder);
if ($state->opt('f')) {
if ($state->{want_fetchinfo}) {
$o->{tofetch} = DPB::SubEngine::Fetch->new($o);
}
$o->{log} = DPB::Util->make_hot($state->logger->open("engine"));

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Grabber.pm,v 1.23 2012/01/18 15:26:49 espie Exp $
# $OpenBSD: Grabber.pm,v 1.24 2012/01/30 15:11:04 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -34,7 +34,7 @@ sub new
errors => 0,
endcode => $endcode
}, $class;
if ($state->opt('f')) {
if ($state->{want_fetchinfo}) {
require DPB::Fetch;
$o->{dpb} = "fetch";
$o->{fetch} = DPB::Fetch->new($state->distdir, $state->logger,