As we discussed in the last meeting, we reset the ports tree and began from scratch, even though this change involves porting all the packages. Starting small and growing gradually, this approach will reduce build times and consequently lower energy consumption in a world affected by climate change. We will add new ports as users needs arise; ok h3artbl33d@

This commit is contained in:
purplerain 2024-05-26 03:08:12 +00:00
parent 83a0aaf92c
commit 9a3af55370
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
59377 changed files with 98673 additions and 4712155 deletions

View file

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Locks.pm,v 1.55 2023/05/06 05:20:31 espie Exp $
# $OpenBSD: Locks.pm,v 1.57 2023/10/16 12:42:17 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -24,8 +24,16 @@ sub new($class, $fh)
bless {fh => $fh}, $class;
}
my $field = {
map {($_, 1)}
(qw(dpb pid mem start end error status todo host tag parent locked path
wanted needed nojunk cleaned))};
sub write($self, $key, $value = undef)
{
if (!defined $field->{$key}) {
DPB::Util->die("Field $key does not exist");
}
if (defined $value) {
print {$self->{fh}} "$key=$value\n";
} else {
@ -40,9 +48,13 @@ sub close($self)
}
package DPB::LockInfo;
sub new($class, $filename, $logger)
sub new($class, $filename, $logger, $error = undef)
{
bless { filename => $filename, logger => $logger}, $class;
my $o = bless { filename => $filename, logger => $logger }, $class;
if (defined $error) {
$o->{error} = $error;
}
return $o;
}
sub fullpkgpath($self)
@ -122,7 +134,7 @@ sub parse_file($i, $locker, $fh)
} elsif (m/^(nojunk|cleaned)$/) {
$i->set_field($1, 1);
} else {
$i->set_bad("Parse error on $_");
$i->set_bad("Parse error on $_ at line $.");
}
}
$i->{host} //= DPB::Core::Local->hostname;
@ -130,7 +142,7 @@ sub parse_file($i, $locker, $fh)
package DPB::LockInfo::Bad;
our @ISA = qw(DPB::LockInfo);
sub is_bad($) { 1 }
sub is_bad($self) { $self->{parseerror} || $self->{error} || 1 }
package DPB::Locks;
our @ISA = (qw(DPB::UserProxy));
@ -172,7 +184,7 @@ sub get_info_from_file($self, $f)
if (defined $fh) {
return $self->get_info_from_fh($fh, $f);
} else {
return DPB::LockInfo::Bad->new($f, $self->{logger});
return DPB::LockInfo::Bad->new($f, $self->{logger}, $!);
}
}
@ -214,8 +226,9 @@ sub clean_old_locks($self, $state)
# first we get all live locks that pertain to us a a dpb host
$self->scan_lockdir(
sub($i) {
if ($i->is_bad) {
push @problems, $i->{filename};
my $e = $i->is_bad;
if ($e) {
push(@problems, "$i->{filename} ($e)");
return;
}
if (!$i->{same_host} || defined $i->{errored}) {
@ -256,8 +269,8 @@ sub clean_old_locks($self, $state)
# just in case there are weird locks in there
if (@problems) {
$state->say("Problematic lockfiles I can't parse:\n\t#1\n".
"Waiting for ten seconds",
join(' ', @problems));
"Waiting for ten seconds",
join(' ', @problems));
sleep 10;
goto START;
}