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: Config.pm,v 1.98 2023/09/29 09:12:15 naddy Exp $
# $OpenBSD: Config.pm,v 1.101 2024/01/02 15:39:30 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -23,6 +23,7 @@ use v5.36;
package DPB::Config;
use DPB::User;
use DPB::PortInfo;
use File::Spec;
sub setup_users($class, $state)
{
@ -174,11 +175,12 @@ sub parse_command_line($class, $state)
# reparse things properly now that we can chroot
my $backup;
($state->{ports}, $state->{portspath}, $state->{repo}, $state->{localarch},
$state->{distdir}, $state->{localbase}, $backup, $state->{fetch_cmd}) =
$state->{distdir}, $state->{localbase}, $backup,
$state->{fetch_cmd}, $state->{portslockdir}) =
DPB::Vars->get(DPB::Host::Localhost->getshell($state),
$state,
"PORTSDIR", "PORTSDIR_PATH", "PACKAGE_REPOSITORY",
"MACHINE_ARCH", "DISTDIR", "LOCALBASE", "SITE_BACKUP", "FETCH_CMD");
"MACHINE_ARCH", "DISTDIR", "LOCALBASE", "SITE_BACKUP", "FETCH_CMD", "LOCKDIR");
if (!defined $state->{portspath}) {
$state->usage("Can't obtain vital information from the ports tree");
@ -203,6 +205,7 @@ sub parse_command_line($class, $state)
$state->{logdir} = $state->{flogdir} // $ENV{LOGDIR} // '%p/logs/%a';
$state->{lockdir} //= $state->{flockdir} // "%L/locks";
$state->{logdir} = $state->expand_path($state->{logdir});
$state->{size_log} = "%f/build-stats/%a-size";
@ -307,6 +310,10 @@ sub parse_command_line($class, $state)
$state->{record} = $state->expand_path($state->{record});
$state->{size_log} = $state->expand_path($state->{size_log});
$state->{lockdir} = $state->expand_path($state->{lockdir});
if (File::Spec->canonpath($state->{portslockdir}) eq
File::Spec->canonpath($state->{lockdir})) {
$state->fatal("Configuration error: ports and dpb shouldn't use the same lockdir");
}
for my $cat (qw(build_files paths ipaths cpaths xpaths)) {
next unless defined $state->{$cat};
for my $f (@{$state->{$cat}}) {
@ -470,13 +477,39 @@ sub parse_hosts_file($class, $filename, $state, $rdefault, $override)
}
}
sub read_exceptions_file($class, $state, $filename, $default = 'build')
# this is where the actual callbacks happen
my $properties = {};
sub apply_properties($class, $state, $path, @properties)
{
my $v = DPB::PkgPath->new($path);
for my $d (@{$state->{portspath}}) {
if (-d join('/', $d , $v->pkgpath)) {
for my $p (@properties) {
if ($p =~ m/(.*)\:(.*)/) {
&{$properties->{$1}}($v, $2);
} else {
&{$properties->{$p}}($v);
}
}
return;
}
}
push(@{$state->{bad_paths}}, $path);
}
sub handle_exception_data($class, $state, $param, $default = 'build')
{
my $fh = $state->logger->open('<', $param);
if (defined $fh) {
$class->read_exceptions_fh($state, $fh, $param, $default);
} else {
$class->apply_properties($state, $param, $default);
}
}
sub read_exceptions_fh($class, $state, $fh, $filename, $default = 'build')
{
my $properties = {};
open my $fh, '<', $filename or
$state->fatal("Can't read exceptions file #1: #2",
$filename, $!);
$state->{adjuncts} = {};
my @defaults = $default;
while(<$fh>) {
chomp;
@ -504,10 +537,8 @@ sub read_exceptions_file($class, $state, $filename, $default = 'build')
$state->fatal("No path in file #1 at #2: #3",
$filename, $., $_);
}
for my $p (@properties) {
for my $v (@paths) {
&{$properties->{$p}}($v);
}
for my $v (@paths) {
$class->apply_properties($state, $v, @properties);
}
}
}