From: Marc Espie Subject: Re: update-plist -x patch To: ports@openbsd.org, edd@openbsd.org Date: Thu, 2 Jul 2026 16:38:57 +0200 Second version, much better (actually works for the most part) - renamed -x to -t ('trim') because -x is already "used" by the progressmeter (rather useless for update-plist) - added manpage parts. - documented that -X uses glob, which makes the fake mtree work and will probably also be useful for some files in texlive texlive will need *at least* these to get something useful UPDATE_PLIST_ARGS += -t print/ps2eps UPDATE_PLIST_ARGS += -t print/psutils UPDATE_PLIST_ARGS += -t graphics/asymptote UPDATE_PLIST_ARGS += -t textproc/latexmk UPDATE_PLIST_ARGS += -t print/t1utils UPDATE_PLIST_ARGS += -t print/dvi2tty UPDATE_PLIST_ARGS += -t print/detex UPDATE_PLIST_ARGS += -t print/lcdf-typetools UPDATE_PLIST_ARGS += -i MODLUA_DEP_VERSION UPDATE_PLIST_ARGS += -i MODRUBY_LIBREV update-plist patch and manpage patch follow Index: bin/update-plist =================================================================== RCS file: /build/data/openbsd/cvs/ports/infrastructure/bin/update-plist,v diff -u -p -r1.216 update-plist --- bin/update-plist 18 Jan 2026 10:02:28 -0000 1.216 +++ bin/update-plist 2 Jul 2026 13:19:46 -0000 @@ -307,6 +307,10 @@ sub write_conflict_info($self, $fh) sub is_part_of_conflict_info($) { 0 } +sub exclude_files($, $, $) +{ +} + package OpenBSD::PackingElement::State; # that stuff NEVER gets copied over, but interpolated from existing objects @@ -648,6 +652,11 @@ sub show_unknown($self) } } +sub exclude_files($self, $state, $base) +{ + $state->{ignored}{$base.$self->fullname} = 1; +} + package OpenBSD::PackingElement::FileBase; sub bookmark($self, $plist) { @@ -859,13 +868,22 @@ sub handle_options($state) 'V' => sub($var) { push(@{$state->{no_version}}, $var); }, + 't' => sub($pkgpath) { + $state->exclude_pkgpath($pkgpath); + }, + 'h' => sub($h) { + $state->read_hints_file($h, 0); + }, + 'H' => sub($h) { + $state->read_hints_file($h, 1); + }, }; - $state->SUPER::handle_options('OrvI:c:qV:fFC:i:j:L:s:S:X:P:w:e:E:H:', - '[-FfmnOrvx] [-C dir] [-c comment] [-E ext] [-e ext] [-H hints]', - '[-i var] [-I ignored] [-j jobs] [-L logfile] [-P pkgdir]', - '[-S var] [-s var] [-V var] [-w suffix] [-X path]', - '-- pkg_create_args ...'); + $state->SUPER::handle_options('OrvI:c:qV:fFC:i:j:L:s:S:X:t:P:w:e:E:H:h:', + '[-FfmnOrvx] [-C dir] [-c comment] [-E ext] [-e ext]', + '[-H hints] [-h hints] [-i var] [-I ignored] [-j jobs]', + '[-L logfile] [-P pkgdir] [-S var] [-s var] [-V var]', + '[-w suffix] [-X path] [-t pkgpath] -- pkg_create_args ...'); $state->{pkgdir} = $state->opt('P'); $state->{scan_as_root} = $state->opt('r'); $state->{verbose} = $state->opt('v'); @@ -886,6 +904,19 @@ sub handle_options($state) } } +sub exclude_pkgpath($state, $pkgpath) +{ + my $plist = OpenBSD::Dependencies::CreateSolver->ask_tree($state, + $pkgpath, $ENV{'PORTSDIR'}, \&OpenBSD::PackingList::FilesOnly, + 'print-plist'); + if (!defined $plist) { + $state->fatal("Can't read plist for #1", $pkgpath); + } + # XXX this is delayed because we need to know WORKINST, and we + # only get this from subpackage options + $state->{excluded_plists}{$pkgpath} = $plist; +} + sub parse_hints_file($state, $fname) { open(my $f, '<', $fname) or @@ -1377,8 +1408,19 @@ sub try_pkglocate($self) } } +sub ignore_excluded_plists($self, $base) +{ + my $state = $self->{state}; + while (my ($pkgpath, $plist) = each %{$state->{excluded_plists}}) { + $state->say("Stripping files from #1", $pkgpath); + $plist->exclude_files($state, $base); + } + delete $state->{excluded_plists}; +} + my $self = UpdatePlist->new; my $base = OpenBSD::UpdatePlistFactory->parse_args($self); +$self->ignore_excluded_plists($base); $self->known_objects; $self->scan_fake_dir($base); $self->zap_debug_files; Index: lib/OpenBSD/FS2.pm =================================================================== RCS file: /build/data/openbsd/cvs/ports/infrastructure/lib/OpenBSD/FS2.pm,v diff -u -p -r1.43 FS2.pm --- lib/OpenBSD/FS2.pm 4 Dec 2025 17:56:14 -0000 1.43 +++ lib/OpenBSD/FS2.pm 2 Jul 2026 13:06:58 -0000 @@ -345,18 +345,11 @@ sub recognize($class, $filename, $fs, $) return 0 unless $filename =~ m/\.info$/ or $filename =~ m/info\/[^\/]+$/; $filename = $fs->resolve_link($filename); open my $fh, '<', $filename or return 0; - my $tag = <$fh>; - return 0 unless defined $tag; - my $tag2 = <$fh>; - $tag .= $tag2 if defined $tag2; - close $fh; - my $prog = qr{(?:g?[Mm]akeinfo|texi2any)}; - if ($tag =~ /^This\sis\s.*,\sproduced\sby\s$prog(?:\sversion\s|\-)?.*[\d\s]from/s || - $tag =~ /^Dies\sist\s.*,\shergestellt\svon\s$prog(?:\sVersion\s|\-)?.*[\d\s]aus/s) { - return 1; - } else { - return 0; + while (<$fh>) { + chomp; + return 1 if m/^START-INFO-DIR-ENTRY$/; } + return 0; } sub element_class($) @@ -679,6 +672,9 @@ sub mtree($self) sub create($self, $filename) { my $data = {}; + if ($filename =~ m/\.info$/) { + $DB::single = 1; + } for my $class (OpenBSD::FS::File->classes) { if ($class->recognize($filename, $self, $data)) { return $class->create($filename, $self); Index: update-plist.1 =================================================================== RCS file: /build/data/openbsd/cvs/src/share/man/man1/update-plist.1,v diff -u -p -r1.10 update-plist.1 --- update-plist.1 14 Apr 2024 17:24:15 -0000 1.10 +++ update-plist.1 2 Jul 2026 14:35:39 -0000 @@ -29,11 +29,14 @@ .Op Fl c Ar var .Op Fl E Ar ext .Op Fl e Ar ext +.Op Fl H Ar hints +.Op Fl h Ar hints .Op Fl I Ar var .Op Fl i Ar var .Op Fl j Ar jobs .Op Fl S Ar var .Op Fl s Ar var +.Op Fl t Ar pkgpath .Op Fl X Ar path .Op Fl w Ar suffix .Fl - @@ -114,6 +117,20 @@ Variable may expand to nothing, in which case the variable from .Fl c Ar var can be used to prevent duplicate entries. +.It Fl H Ar hints +Add an +.Ar hints +file, that contains locations of files in the format +.Dl path subpackage +as used for the texlive packages. +Those hints are absolute and will preempt already existing entries. +.It Fl h Ar hints +Add an +.Ar hints +file, that contains locations of files in the format +.Dl path subpackage +as used for the texlive packages. +Those hints are indicative and will not preempt already existing entries. .It Fl i Ar var Ignore variable .Ar var @@ -152,6 +169,9 @@ e.g., for directories like .Pa /etc/rc.d or .Pa /usr/local . +.It Fl t Ar pkgpath +Trim files corresponding to another package in the ports tree, +by ignoring entries in the corresponding packing-list. .It Fl v Verbose mode. Explain about directories stripped from dependencies. @@ -164,6 +184,11 @@ that (usually) should not end into packi Exclude file at absolute .Ar path from the information recorded in the packing-list. +The +.Ar path +goes through glob, +as documented in +.Xr perlfunc 3p . .El .Pp .Nm @@ -321,3 +346,8 @@ is now run as non-root, .Nm can't figure out users and groups for new files, so these should be considered carefully. +.Pp +.Fl h +and +.Fl H +are not implemented yet !