Marc Espie <es...@nerim.net> wrote: > As I said in a private email, grabbing the subpackage from > OpenBSD::PkgPath is a bit more complex than you thought. > > The following tweak to PackingElement should make it obvious how to grab > the subpackage if it exists. > > Bonus: PkgCreate will refuse to create invalid packages. > > Note that the ports infrastructure creates FULLPKGPATH-sub in a deterministic > order (register-plist wouldn't work otherwise) but it's not really documented > in pkg_create(1), the only rule is that you can't have more than one > subpackage, which is easy to check.
Thanks for looking into this! Of course, you're right. My attempt at looking into the `mandatory' field was only a tentative (looking at the Data::Dumper output it seemed like it only had subpackages - my testing was limited) but still it looked like a hack. I can't really say if it's better to set subpackage in PackingElement as you're doing or if it's better to just extract the -multi part manually in check-lib-depends, I don't have enough experience with the infrastructure to provide a valuable feedback here, I trust your judgement. However, with your patch I can really easily print the per-subpackage WANTLIB example in check-lib-depends! I did some tests with a "normal" package and with nginx (which has several subpackages) and it seems to work fine, thanks! Index: check-lib-depends =================================================================== RCS file: /home/cvs/ports/infrastructure/bin/check-lib-depends,v retrieving revision 1.46 diff -u -p -u -r1.46 check-lib-depends --- check-lib-depends 21 Jun 2021 15:16:52 -0000 1.46 +++ check-lib-depends 22 Jun 2022 10:38:15 -0000 @@ -595,7 +595,8 @@ sub analyze unless ($state->{quiet} && keys %{$r->{wantlib}} == 0) { $self->print_list($state, "Extra: ", $extra); } - $self->print_list($state, "WANTLIB +=", $r->{wantlib}); + my $subpkg = $plist->{extrainfo}->{path}->{subpackage} || ''; + $self->print_list($state, "WANTLIB$subpkg +=", $r->{wantlib}); if ($state->{full}) { $needed_libs->dump(\*STDOUT); }