diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-01-19 14:32:23 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-01-19 14:32:23 +0000 |
commit | ae1970a0cd0a3aba7c728923280d4f72c5a6e3e1 (patch) | |
tree | a8a07fc4b111641f0591b2305b70186669ddd0cd /usr.sbin | |
parent | a413c4ef59396e1c3731c36bcdee63d898aa78b1 (diff) |
simplify using LibSpec
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Signature.pm | 31 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create | 20 |
2 files changed, 13 insertions, 38 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Signature.pm b/usr.sbin/pkg_add/OpenBSD/Signature.pm index 0f842c2fd6b..f58112e3107 100644 --- a/usr.sbin/pkg_add/OpenBSD/Signature.pm +++ b/usr.sbin/pkg_add/OpenBSD/Signature.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Signature.pm,v 1.3 2010/01/19 10:21:28 espie Exp $ +# $OpenBSD: Signature.pm,v 1.4 2010/01/19 14:32:22 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -32,12 +32,10 @@ package OpenBSD::PackingElement::Wantlib; sub signature { my ($self, $hash) = @_; - require OpenBSD::SharedLibs; - my ($stem, $major, $minor) = OpenBSD::SharedLibs::parse_spec($self->name); - if (defined $stem) { - $hash->{$stem} = OpenBSD::LibrarySpec->new($stem, - $major, $minor); + my $spec = $self->spec; + if ($spec->is_valid) { + $hash->{$spec->key} = $spec; } } @@ -172,30 +170,19 @@ sub compare return $r; } -package OpenBSD::LibrarySpec; -sub new -{ - my ($class, $stem, $major, $minor) = @_; - bless {stem => $stem, major => $major, minor => $minor}, $class; -} - -sub to_string -{ - my $self = shift; - return join('.', $self->{stem}, $self->{major}, $self->{minor}); -} +package OpenBSD::LibSpec; sub compare { my ($a, $b) = @_; - if ($a->{stem} ne $b->{stem}) { + if ($a->key ne $b->key) { return undef; } - if ($a->{major} != $b->{major}) { - return $a->{major} <=> $b->{major}; + if ($a->major != $b->major) { + return $a->major <=> $b->major; } - return $a->{minor} <=> $b->{minor}; + return $a->minor <=> $b->minor; } 1; diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index e527a176d70..49aa92cf72e 100644 --- a/usr.sbin/pkg_add/pkg_create +++ b/usr.sbin/pkg_add/pkg_create @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_create,v 1.132 2010/01/10 21:27:59 espie Exp $ +# $OpenBSD: pkg_create,v 1.133 2010/01/19 14:32:22 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -299,30 +299,18 @@ sub makesum_plist } } -package OpenBSD::PackingElement::Dependency; +package OpenBSD::PackingElement::Depend; sub avert_duplicates_and_other_checks { my ($self, $allfiles) = @_; if (!$self->spec->is_valid) { - print STDERR "Error in packing-list: invalid dependency: $self->{pattern}\n"; + print STDERR "Error in packing-list: invalid \@", + $self->keyword, " ", $self->stringize, "\n"; $main::errors++; } $self->SUPER::avert_duplicates_and_other_checks($allfiles); } -package OpenBSD::PackingElement::Wantlib; -sub avert_duplicates_and_other_checks -{ - my ($self, $allfiles) = @_; - require OpenBSD::SharedLibs; - - if (!defined OpenBSD::SharedLibs::parse_spec($self->name)) { - print STDERR "Error in packing-list: invalid wantlib: ", - $self->name, "\n"; - $main::errors++; - } - $self->SUPER::avert_duplicates_and_other_checks($allfiles); -} # put together file and filename, in order to handle fragments simply package MyFile; |