reorg a bit to always pass logger to init_cores, and always print out
directory signatures
This commit is contained in:
parent
4661a5b3fc
commit
b4623aff1d
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Core.pm,v 1.12 2010/05/04 09:45:41 espie Exp $
|
||||
# $OpenBSD: Core.pm,v 1.13 2010/06/07 15:27:52 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -171,14 +171,10 @@ sub reap_kid
|
||||
return $kid;
|
||||
}
|
||||
|
||||
my $inited = 0;
|
||||
sub reap
|
||||
{
|
||||
my ($class, $all) = @_;
|
||||
my $reaped = 0;
|
||||
if (!$inited) {
|
||||
DPB::Core::Factory->init_cores;
|
||||
}
|
||||
$class->handle_events;
|
||||
$reaped++ while $class->reap_kid(waitpid(-1, WNOHANG)) > 0;
|
||||
return $reaped;
|
||||
@ -358,6 +354,7 @@ sub new
|
||||
sub finalize
|
||||
{
|
||||
my ($self, $core) = @_;
|
||||
$self->{signature}->print_out($core, $self->{logger});
|
||||
if ($self->{signature}->matches($core, $self->{logger})) {
|
||||
for my $i (1 .. $core->prop->{jobs}) {
|
||||
ref($core)->new($core->hostname, $core->prop)->mark_ready;
|
||||
@ -384,9 +381,13 @@ sub new
|
||||
}
|
||||
}
|
||||
|
||||
my $inited = 0;
|
||||
|
||||
sub init_cores
|
||||
{
|
||||
my ($self, $logger, $startup) = @_;
|
||||
return if $inited;
|
||||
|
||||
for my $core (values %$init) {
|
||||
my $job = DPB::Job::Init->new($logger);
|
||||
if (!defined $core->prop->{jobs}) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Logger.pm,v 1.3 2010/05/04 09:45:41 espie Exp $
|
||||
# $OpenBSD: Logger.pm,v 1.4 2010/06/07 15:27:52 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -36,12 +36,24 @@ sub logfile
|
||||
return $log;
|
||||
}
|
||||
|
||||
sub _open
|
||||
{
|
||||
my ($self, $mode, $name) = @_;
|
||||
my $log = $self->logfile($name);
|
||||
open my $fh, $mode, $log or die "Can't write to $log: $!\n";
|
||||
return $fh;
|
||||
}
|
||||
|
||||
sub open
|
||||
{
|
||||
my ($self, $name) = @_;
|
||||
my $log = $self->logfile($name);
|
||||
open my $fh, ">>", $log or die "Can't write to $log: $!\n";
|
||||
return $fh;
|
||||
return $self->_open('>>', $name);
|
||||
}
|
||||
|
||||
sub create
|
||||
{
|
||||
my ($self, $name) = @_;
|
||||
return $self->_open('>', $name);
|
||||
}
|
||||
|
||||
sub log_pkgpath
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Signature.pm,v 1.8 2010/05/06 15:50:13 espie Exp $
|
||||
# $OpenBSD: Signature.pm,v 1.9 2010/06/07 15:27:52 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -57,6 +57,21 @@ sub compare1
|
||||
return $r;
|
||||
}
|
||||
|
||||
sub print_out
|
||||
{
|
||||
my ($self, $dir, $fh) = @_;
|
||||
for my $k (sort keys %$self) {
|
||||
next if $k eq 'la';
|
||||
next if !defined $self->{$k};
|
||||
print $fh "\t", $self->{$k}->to_string, "\n";
|
||||
}
|
||||
if (defined $self->{la}) {
|
||||
for my $v (sort keys %{$self->{la}}) {
|
||||
print $fh "\t$dir/$v.la\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub compare
|
||||
{
|
||||
my ($s1, $s2, $h1, $h2) = @_;
|
||||
@ -144,10 +159,21 @@ sub matches
|
||||
my $log = $logger->open('signature');
|
||||
print $log "$r\n";
|
||||
return 0;
|
||||
clsoe $log;
|
||||
close $log;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_out
|
||||
{
|
||||
my ($self, $core, $logger) = @_;
|
||||
my $log = $logger->create($core->hostname.".sig");
|
||||
for my $dir (OpenBSD::Paths->library_dirs) {
|
||||
print $log "$dir: \n";
|
||||
$self->{$dir}->print_out("$dir/lib", $log);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: dpb3,v 1.16 2010/05/22 08:42:21 espie Exp $
|
||||
# $OpenBSD: dpb3,v 1.17 2010/06/07 15:27:52 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -181,6 +181,7 @@ if (@build_files > 0) {
|
||||
$heuristics->finished_parsing;
|
||||
}
|
||||
|
||||
DPB::Core::Factory->init_cores($logger);
|
||||
my $builder = DPB::PortBuilder->new(
|
||||
$opt_c, $opt_s, $opt_u, $opt_U, $fullrepo, $logger, $ports, $make,
|
||||
$heuristics);
|
||||
|
Loading…
Reference in New Issue
Block a user