From: Marc Espie Subject: Re: redux Re: patch: update-plist + texlive To: Edd Barrett Cc: ports@openbsd.org, sthen@openbsd.org, tb@openbsd.org Date: Tue, 7 Jul 2026 10:46:58 +0200 On Mon, Jul 06, 2026 at 08:38:54PM +0100, Edd Barrett wrote: > Hi Marc, > > > On Mon, Jul 06, 2026 at 10:13:18AM +0200, Marc Espie wrote: > > > > Final patch until I get feedback from edd. > > First, thanks for doing this. I appreciate that hacking TeX Live is neither > fun, nor sexy. > > I've now had a chance to play with this (I used tb@'s diff). > > It's looking pretty good. It's going to remove a load of duplicated logic, and > it's also already fixing things that have been missed, e.g. I spotted this in > the diff of the PLISTs after running `make update-plist`: > > ``` > -share/texmf-dist/scripts/minted/latex2pydata-0.5.0-py3-none-any.whl > -share/texmf-dist/scripts/minted/latexminted-0.6.0-py3-none-any.whl > +share/texmf-dist/scripts/minted/latex2pydata-0.5.0-${MODPY_PY_PREFIX}none-any.whl > +share/texmf-dist/scripts/minted/latexminted-0.6.0-${MODPY_PY_PREFIX}none-any.whl > ``` > > As you pointed out, we can now start culling some Python from FILESDIR. > `write_plists.py` is now totally redundant and can be removed. Updated patch: I don't see any HASH issue here ? Index: infrastructure/bin/update-plist =================================================================== RCS file: /build/data/openbsd/cvs/ports/infrastructure/bin/update-plist,v diff -u -p -r1.217 update-plist --- infrastructure/bin/update-plist 6 Jul 2026 08:12:40 -0000 1.217 +++ infrastructure/bin/update-plist 7 Jul 2026 07:52:36 -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 @@ -649,6 +653,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) { @@ -854,19 +863,25 @@ sub handle_options($state) 'S' => sub($var) { push(@{$state->{suffix_only}}, $var); }, - 'H' => sub($hints) { - $state->parse_hints_file($hints); - }, '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'); @@ -887,7 +902,20 @@ sub handle_options($state) } } -sub parse_hints_file($state, $fname) +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 read_hints_file($state, $fname, $mandatory) { open(my $f, '<', $fname) or $state->fatal("Can't read hints file #1: #2", $fname, $!); @@ -895,11 +923,23 @@ sub parse_hints_file($state, $fname) chomp; if (m/^\#(\S+)\s+(\-\S+)$/) { my ($filename, $subpackage) = ($1, $2); + $state->{ignored_hints}{$filename} = $subpackage; + } elsif (m/^(\S+)\s+(\-\S+)$/) { + my ($filename, $subpackage) = ($1, $2); + $state->{hints}[$mandatory]{$filename} = $subpackage; } else { $state->fatal("Bad hints file at line #1: #2", $., $_); } } + # XXX edd's script mentions the same files several times + # we assume that each hints file is independent, so far we only have 1 ! + for my $filename (keys %{$state->{hints}[$mandatory]}) { + delete $state->{ignored_hints}{$filename}; + } + # XXX the "mandatory" part doesn't apply to comments. + # Comments that are left are always ignored as ignore happens + # during scan_fake_dir. } package UpdatePlist; @@ -1062,6 +1102,24 @@ sub walk_up_directory($self, $path, $c) return 0; } +sub copy_hints($self, $path, $c, $mandatory) +{ + return unless exists $self->{hints}[$mandatory]{$path}; + my $s = $self->{hints}{$path}[$mandatory]; + my $p2 = $s->strip_prefix($path); + if ($p2 =~ m/^\// && !$c->absolute_okay) { + # this will get caught as new element + # TODO list of data to build inside + # its own cwd + last; + } + $self->{state}->say("Adding #1 to #2", $p2, + $s->olist->fullpkgpath2->{subpackage}); + my $a = $c->add($s->nlist, $p2); + $a->notice_new_file($self); + $a->{file} = $s->{file}; +} + sub last_resort($self, $path, $c) { # try all lists in order, until we find one with @@ -1095,9 +1153,12 @@ sub is_a_sample($self, $path) sub copy_object($self, $path) { my $o = $self->{objects}{$path}; + my $c = $o->element_class; + return if $self->copy_hints($path, $c, 1); return if $self->copy_existing($path, $o); - my $c = $o->element_class; + + return if $self->copy_hints($path, $c, 0); return if $self->walk_up_directory($path, $c); return if $self->last_resort($path, $c); @@ -1378,8 +1439,51 @@ 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}; +} + +sub post_process_hints($self, $base) +{ + my $state = $self->{state}; + # first make a hash of subpackages + my $h = {}; + for my $p (@{$self->{lists}}) { + my $subpackage = $p->olist->fullpkgpath2->{subpackage}; + $h->{$subpackage} = $p; + } + # now we can match the entries to the plist + while (my ($filename, $sub) = each %{$state->{ignored_hints}}) { + if (!exists $h->{$sub}) { + $state->fatal("Error: bad subpackage #1", $sub); + } + my $fullname = $base.$h->{$sub}{state}{prefix}.'/'.$filename; + $state->{ignored}{$fullname} = 1; + } + delete $state->{ignored_hints}; + + for my $m (0..1) { + while (my ($filename, $sub) = each %{$state->{hints}[$m]}) { + if (!exists $h->{$sub}) { + $state->fatal("Error: bad subpackage #1", $sub); + } + my $full = $h->{$sub}{state}{prefix}.'/'.$filename; + $self->{hints}[$m]{$full} = $h->{$sub}; + } + delete $state->{hints}; + } +} + my $self = UpdatePlist->new; my $base = OpenBSD::UpdatePlistFactory->parse_args($self); +$self->post_process_hints($base); +$self->ignore_excluded_plists($base); $self->known_objects; $self->scan_fake_dir($base); $self->zap_debug_files; Index: infrastructure/lib/OpenBSD/FS2.pm =================================================================== RCS file: /build/data/openbsd/cvs/ports/infrastructure/lib/OpenBSD/FS2.pm,v diff -u -p -r1.43 FS2.pm --- infrastructure/lib/OpenBSD/FS2.pm 4 Dec 2025 17:56:14 -0000 1.43 +++ infrastructure/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: print/texlive/texmf/Makefile =================================================================== RCS file: /build/data/openbsd/cvs/ports/print/texlive/texmf/Makefile,v diff -u -p -r1.77 Makefile --- print/texlive/texmf/Makefile 4 Jun 2026 22:39:53 -0000 1.77 +++ print/texlive/texmf/Makefile 7 Jul 2026 08:38:59 -0000 @@ -186,16 +186,20 @@ post-install: # The following targets are for development only and require Python3. -# Generating PLISTs is special for TeX Live. -update-plist: plist - @true +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_ARGS += -i MODPY_PY_PREFIX +UPDATE_PLIST_ARGS += -h ${WRKDIR}/hints + -plist: fake - env WRKINST=${WRKINST} TRUEPREFIX=${TRUEPREFIX} \ - python${MODPY_DEFAULT_VERSION_3} \ - ${FILESDIR}/update_plist_hints.py \ - ${WRKDIR}/texlive-${DIST_V}-extra/tlpkg/texlive.tlpdb | \ - python${MODPY_DEFAULT_VERSION_3} ${FILESDIR}/write_plists.py # Regenerate adj.mk. adj: patch @@ -208,3 +212,12 @@ man_symlinks: patch ${WRKSRC}/texmf-dist/doc/man > man_symlinks.mk .include + +${WRKDIR}/hints: ${_FAKE_COOKIE} ${FILESDIR}/update_plist_hints.py + env WRKINST=${WRKINST} TRUEPREFIX=${TRUEPREFIX} \ + python${MODPY_DEFAULT_VERSION_3} \ + ${FILESDIR}/update_plist_hints.py \ + ${WRKDIR}/texlive-${DIST_V}-extra/tlpkg/texlive.tlpdb \ + |${_PBUILD} tee $@ >/dev/null + +update-plist: ${WRKDIR}/hints