From 3c83b0b46948c0f97e8f96976a752f37d16f1fe9 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 11 Jul 2010 10:05:19 +0000 Subject: move compare into LibSpec, it's not so specific to Signature after all --- usr.sbin/pkg_add/OpenBSD/LibSpec.pm | 15 ++++++++++++++- usr.sbin/pkg_add/OpenBSD/Signature.pm | 17 +---------------- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm index bdff9e84fd5..ba1d0d5c766 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: LibSpec.pm,v 1.12 2010/06/30 10:51:04 espie Exp $ +# $OpenBSD: LibSpec.pm,v 1.13 2010/07/11 10:05:18 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -290,4 +290,17 @@ sub match return !$spec->no_match($library, $base); } +sub compare +{ + my ($a, $b) = @_; + + if ($a->key ne $b->key) { + return undef; + } + if ($a->major != $b->major) { + return $a->major <=> $b->major; + } + return $a->minor <=> $b->minor; +} + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/Signature.pm b/usr.sbin/pkg_add/OpenBSD/Signature.pm index b4cd10312a4..b6628b746dd 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.8 2010/06/30 10:51:04 espie Exp $ +# $OpenBSD: Signature.pm,v 1.9 2010/07/11 10:05:18 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -170,19 +170,4 @@ sub compare return $r; } -package OpenBSD::LibSpec; - -sub compare -{ - my ($a, $b) = @_; - - if ($a->key ne $b->key) { - return undef; - } - if ($a->major != $b->major) { - return $a->major <=> $b->major; - } - return $a->minor <=> $b->minor; -} - 1; -- cgit v1.2.3