On Mon, Jul 06, 2026 at 04:54:11PM +0200, Marc Espie wrote:
> On Mon, Jul 06, 2026 at 10:13:18AM +0200, Marc Espie wrote:
> > This is what I'm currently running.
> > 
> > It appears to be doing the right thing.
> > 
> > The ${_PBUILD} tee ${WRKDIR}/hints >/dev/null
> > is because the "hints" script does create the *.mk files as well,
> > so needs to run as ports user.
> > 
> > This does expose TWO internal variables from the ports tree, for now.
> > 
> > Adds two options (-h/-H and -t) to update-plist.
> > 
> > I haven't made up my mind whether both -h need to exist.  There is a little
> > bit of boilerplate code if so...
> > 
> > It seems to be decently good at recreating the tex packing-lists more
> > or less, with some changes in directories, which is what I wanted to
> > fix in the first place.
> > 
> > The fullname/fullstring I also sent as a separate smaller patch that could
> > be committed now.
> > 
> > With this, a large chunk of Edd's update_plist_hints can go, namely all
> > the stuff that avoids all the -t paths to other ports.
> > 
> > 
> > Corraling texlive into the fold also means being able to run pkglocate
> > regularly, which will help into finding further conflicts in future versions
> > and thus finding some more -t if we want to move other parts to other 
> > packages.
> 
> Final patch until I get feedback from edd. This implements the -h/-H
> difference, long with useful comments.
> 
> Con: it's somewhat ad-hoc for texlive
> Pro: texlive is such a large port, making it less painful to maintain
> is nice.
> 
> (also, maybe -t might come in handy some other times)

Here's a diff that actually applies to -current.

Index: infrastructure/bin/update-plist
===================================================================
RCS file: /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     6 Jul 2026 16:05:23 -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: /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   6 Jul 2026 16:05:51 -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: /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        6 Jul 2026 16:05:51 -0000
@@ -186,16 +186,19 @@ 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 += -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 +211,12 @@ man_symlinks: patch
                ${WRKSRC}/texmf-dist/doc/man > man_symlinks.mk
 
 .include <bsd.port.mk>
+
+${WRKDIR}/hints: ${_FAKE_COOKIE}
+       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

Reply via email to