sync ports with The Matrix

This commit is contained in:
purplerain 2023-09-08 05:21:37 +00:00
parent ec769495ab
commit f5034afcba
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
3108 changed files with 91999 additions and 80269 deletions

View file

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Fetch.pm,v 1.29 2023/06/11 16:53:17 espie Exp $
# $OpenBSD: Fetch.pm,v 1.31 2023/09/07 12:34:57 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -98,9 +98,12 @@ sub new($class, $job)
my $o;
if (@{$job->{sites}}) {
$o = bless { site => $job->{sites}[0]}, $class;
$job->{normal_site} = 1;
} elsif (@{$job->{bak}}) {
$o = bless { site => $job->{bak}[0]}, $class->backup_class;
$job->{normal_site} = 0;
}
$job->{first} = $job->{prefirst};
if (defined $o) {
my $sz = (stat $job->{file}->tempfilename)[7];
if (defined $sz) {
@ -197,20 +200,31 @@ sub new_fetch_task($self)
sub next_site($self)
{
$self->{prefirst} = 0;
shift @{$self->{sites}} || shift @{$self->{bak}};
}
sub bad_file($job, $task, $core)
{
my $fh = $job->{file}->logger->append("fetch/bad");
print $fh $task->{site}.$job->{file}{short}, "\n";
print $fh $job->{file}->fullpkgpath, ": ",
$task->{site}.$job->{file}{short};
if ($job->{first}) {
print $fh " FIRST";
}
if ($job->new_fetch_task) {
$core->{status} = 0;
return 1;
} else {
$core->{status} = 1;
return 0;
}
if (!$job->{normal_site}) {
print $fh " BACKUP";
}
if ($job->{only_backup}) {
print $fh " ONLYBACKUP";
}
print $fh "\n";
return !$core->{status};
}
sub new_checksum_task($self, $fetcher, $status)
@ -226,12 +240,16 @@ sub new($class, $file, $e, $fetcher, $logger)
sites => [@{$file->{site}// []}],
bak => [@{$fetcher->{state}{backup_sites}}],
file => $file,
prefirst => 1,
tasks => [],
endcode => $e,
fetcher => $fetcher,
logger => $logger,
log => $file->logger->make_distlogs($file),
}, $class;
if (@{$job->{sites}} == 0) {
$job->{only_backup} = 1;
}
$job->{logfh} = $job->{logger}->open('>>', $job->{log});
print {$job->{logfh}} ">>> From ", $file->fullpkgpath, "\n";
$job->{fetcher}->make_path(File::Basename::dirname($file->filename));