summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-09 17:44:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-09 17:44:22 +0000
commit2b0b9e6678db5218af464e10855bfc5c25430ece (patch)
treedbf6cac74663f64f6f22bd05888d3dfb810e0544 /usr.sbin/pkg_add
parentc8a56e9339064aeedad16623c7ebd41acdef7351 (diff)
build signature objects that we will be able to compare
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm24
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm20
2 files changed, 32 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index d6aa9401a8b..ab66cc72b44 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.170 2010/01/05 17:53:23 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.171 2010/01/09 17:44:21 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -315,12 +315,6 @@ sub category
package OpenBSD::PackingElement::Depend;
our @ISA=qw(OpenBSD::PackingElement::Meta);
-sub signature
-{
- my ($self, $hash) = @_;
- $hash->{$self->name} = 1;
-}
-
# Abstract class for all file-like elements
package OpenBSD::PackingElement::FileBase;
our @ISA=qw(OpenBSD::PackingElement::FileObject);
@@ -922,6 +916,12 @@ sub stringize
(qw(pkgpath pattern def)));
}
+sub signature
+{
+ my ($self, $hash) = @_;
+ $hash->{$self->{pkgpath}} = OpenBSD::PackageName->from_string($self->{def});
+}
+
OpenBSD::Auto::cache(spec,
sub {
require OpenBSD::Search;
@@ -958,6 +958,16 @@ sub add_digest
&OpenBSD::PackingElement::FileBase::add_digest;
}
+sub signature
+{
+ my ($self, $hash) = @_;
+ require OpenBSD::SharedLibs;
+
+ if (my ($stem, $major, $minor) = OpenBSD::SharedLibs::parse_spec($self->name)) {
+ $hash->{$stem} = OpenBSD::LibrarySpec->new($stem, $major, $minor);
+ }
+}
+
package OpenBSD::PackingElement::PkgPath;
our @ISA=qw(OpenBSD::PackingElement::Meta);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 7bfea41c668..b1f80c28890 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.99 2010/01/02 12:52:18 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.100 2010/01/09 17:44:21 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -578,9 +578,7 @@ sub signature
} else {
my $k = {};
$self->visit('signature', $k);
- my $o = [$self->pkgname, sort keys %$k];
- return OpenBSD::PackingList::Signature->new($self->pkgname,
- [sort keys %$k]);
+ return OpenBSD::PackingList::Signature->new($self->pkgname, $k);
}
}
@@ -594,7 +592,7 @@ sub new
sub string
{
my $self = shift;
- return join(',', $self->{name}, @{$self->{extra}});
+ return join(',', $self->{name}, sort map {$_->to_string} values %{$self->{extra}});
}
sub compare
@@ -612,4 +610,16 @@ sub string
return $self->{extra};
}
+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});
+}
1;