make the handling of default sets automatic: grab everything from locatedb

if around. If a snapshot, fully parse the SHA256* file, and derive the set
names and the signify version from it.
This commit is contained in:
espie 2021-10-06 13:56:50 +00:00
parent b08dad4da5
commit 26a769f78e
2 changed files with 36 additions and 20 deletions

View File

@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: proot,v 1.71 2021/10/04 13:42:21 espie Exp $
# $OpenBSD: proot,v 1.72 2021/10/06 13:56:50 espie Exp $
#
# Copyright (c) 2016 Marc Espie <espie@openbsd.org>
#
@ -264,16 +264,6 @@ sub handle_options
write_mk => 1,
};
$state->{sets} = {
base => 1,
comp => 1,
game => 1,
man => 1,
etc => 1,
xetc => 1,
xbase => 1,
xfont => 1,
xserv => 1,
xshare => 1,
};
$state->{error} = 0;
@ -529,7 +519,8 @@ sub read_locates
my ($set, $path) = split(':', $_, 2);
$set =~ s/\d+//;
# next if $path =~ m/\.ph$/;
if ($state->{sets}{$set}) {
unless (exists $state->{sets}{$set} &&
$state->{sets}{$set} == 0) {
$state->{known}{$path} = 1;
}
$state->{progressmeter}->working(1000);
@ -777,14 +768,23 @@ sub find_snapshot_version
my ($state, $snapdir, $check) = @_;
open my $f, '<', "$snapdir/$check" or
$state->fatal("no $check");
my $v;
while (<$f>) {
if (m/openbsd\-(\d+)\-base/) {
return $1;
} elsif (m/base(\d+)\.tgz/) {
return $1;
if (m/^SHA256\s+\((.*\D)(\d+)\.tgz\)\s+\=/) {
$state->{sets}{$1} //= 1;
$v = $2;
}
}
$state->fatal("Unrecognized snapshot: no version in $check");
if (!defined $v) {
$state->fatal("Unrecognized snapshot: no version in $check");
}
if ($state->{sets}{base}) {
$state->{sets}{etc} //= 1;
}
if ($state->{sets}{xbase}) {
$state->{sets}{xetc} //= 1;
}
return $v;
}
sub get_snapshot

View File

@ -1,6 +1,6 @@
#! /usr/bin/perl
# $OpenBSD: register-plist,v 1.27 2020/06/28 10:58:25 espie Exp $
# $OpenBSD: register-plist,v 1.28 2021/10/06 13:56:50 espie Exp $
# Copyright (c) 2005,2012
# Marc Espie. All rights reserved.
# Redistribution and use in source and binary forms, with or without
@ -147,9 +147,25 @@ sub save_stuff
require File::Path;
require File::Copy;
require File::Basename;
require File::Compare;
use OpenBSD::MkTemp;
my $dest = "$state->{saveman}/$fname";
File::Path::mkpath(File::Basename::dirname($dest));
File::Copy::copy("$state->{fakedir}/$fname", $dest);
my $dir = File::Basename::dirname($dest);
File::Path::mkpath($dir);
if (my @l = OpenBSD::MkTemp::mkstemp("$dir/file.XXXXXXXXX")) {
my ($fh, $file) = @l;
chmod 0664, $fh;
File::Copy::copy("$state->{fakedir}/$fname", $file);
if (-e $dest) {
if (File::Compare::compare($file, $dest) != 0) {
print STDERR
"EXISTING $file DIFFERS from $dest\n";
}
unlink $file;
} else {
rename($file, $dest);
}
}
}
package OpenBSD::PackingElement::DigitalSignature;