From f80f23a4b689bddf3272476385a26eb4c4203207 Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 24 Jan 2018 16:52:44 +0000 Subject: [PATCH] add the glue to generate future libset, which are currently 100% unused --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 18 +++++++++++++++++- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 15 +++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 3d632e854f9..4ce7be14e39 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.248 2018/01/01 14:02:37 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.249 2018/01/24 16:52:44 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1097,6 +1097,22 @@ sub category() { "libset" } sub keyword() { "libset" } __PACKAGE__->register_with_factory; +sub new +{ + my ($class, $args) = @_; + if ($args =~ m/(.*)\:(.*)/) { + return bless {name => $1, libs => [split(/\,/, $2)]}, $class; + } else { + die "Bad args for libset: $args"; + } +} + +sub stringize +{ + my $self = shift; + return $self->{name}.':'.join(',', @{$self->{libs}}); +} + package OpenBSD::PackingElement::PkgPath; our @ISA=qw(OpenBSD::PackingElement::Meta); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 9dbd714511d..c01a70d9d87 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.130 2018/01/05 13:39:55 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.131 2018/01/24 16:52:45 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -103,16 +103,20 @@ sub handle_options } $state->{system_version} += $d; }, + 'w' => sub { + my $w = shift; + $state->{libset}{$w} = 1; + }, 'W' => sub { my $w = shift; $state->{wantlib}{$w} = 1; }, }; $state->{no_exports} = 1; - $state->SUPER::handle_options('p:f:d:M:U:A:B:P:V:W:qQS', + $state->SUPER::handle_options('p:f:d:M:U:A:B:P:V:w:W:qQS', '[-nQqvSx] [-A arches] [-B pkg-destdir] [-D name[=value]]', '[-L localbase] [-M displayfile] [-P pkg-dependency]', - '[-U undisplayfile] [-V n] [-W wantedlib]', + '[-U undisplayfile] [-V n] [-W wantedlib] [-w libset]', '[-d desc -D COMMENT=value -f packinglist -p prefix]', 'pkg-name'); @@ -810,7 +814,7 @@ sub solve_wantlibs my $okay = 1; my $lib_finder = OpenBSD::lookup::library->new($solver); my $h = $solver->{set}->{new}[0]; - for my $lib (@{$h->{plist}->{wantlib}}) { + for my $lib (@{$h->{plist}{wantlib}}) { $solver->{localbase} = $h->{plist}->localbase; next if $lib_finder->lookup($solver, $solver->{to_register}->{$h}, $state, @@ -1191,6 +1195,9 @@ sub add_elements for my $w (sort keys %{$state->{wantlib}}) { OpenBSD::PackingElement::Wantlib->add($plist, $w); } + for my $w (sort keys %{$state->{libset}}) { + OpenBSD::PackingElement::Libset->add($plist, $w); + } if (defined $state->opt('A')) { OpenBSD::PackingElement::Arch->add($plist, $state->opt('A')); -- 2.20.1