diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingElement.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index de0ad3b97a3..4662cdd5dec 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.153 2009/03/03 11:01:26 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.154 2009/03/05 10:43:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -376,6 +376,30 @@ sub make_hardlink $self->{link} = $linkname; } +sub may_check_digest +{ + my ($self, $file, $state) = @_; + if ($state->{check_digest}) { + $self->check_digest($file, $state); + } +} + +sub check_digest +{ + my ($self, $file, $state) = @_; + if (!defined $self->{d}) { + $state->fatal($self->fullname, " does not have a signature"); + } + my $d = $self->compute_digest($file->{destdir}.$file->{name}); + if (!$d->equals($self->{d})) { + $state->fatal("checksum for ", $self->fullname, + " does not match"); + } + if ($state->{very_verbose}) { + print "Checksum match for ", $self->fullname, "\n"; + } +} + sub IsFile() { 1 } package OpenBSD::PackingElement::File; @@ -764,6 +788,11 @@ our @ISA=qw(OpenBSD::PackingElement::UniqueOption); sub category() { 'manual-installation' } +# XXX don't incorporate this in signatures. +sub write_no_sig() +{ +} + package OpenBSD::PackingElement::SystemPackage; our @ISA=qw(OpenBSD::PackingElement::UniqueOption); @@ -1574,6 +1603,7 @@ package OpenBSD::PackingElement::DigitalSignature; our @ISA=qw(OpenBSD::PackingElement::Unique); sub keyword() { 'digital-signature' } __PACKAGE__->register_with_factory; +sub category() { "digital-signature" } # parse to and from a subset of iso8601 # @@ -1628,7 +1658,7 @@ sub write_no_sig { my ($self, $fh) = @_; print $fh "\@", $self->keyword, " ", $self->{key}, ":", - $self->{timestamp}, "\n"; + time_to_iso8601($self->{timestamp}), "\n"; } package OpenBSD::PackingElement::Old; |