From de20fbecd0e467378671e67e2060a7f0c83b1468 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Wed, 11 Jun 2008 09:42:14 +0000 Subject: let elements be responsible for computing their own md5 (allows special behavior for @bin object). --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD/PackingElement.pm') diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index dec07fc226e..a707dd14534 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.146 2008/06/06 14:49:21 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.147 2008/06/11 09:42:13 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -250,6 +250,13 @@ sub realname return $state->{destdir}.$name; } +sub compute_md5 +{ + my ($self, $filename) = @_; + require OpenBSD::md5; + return OpenBSD::md5::fromfile($filename); +} + # exec/unexec and friends package OpenBSD::PackingElement::Action; our @ISA=qw(OpenBSD::PackingElement::Object); @@ -1312,23 +1319,26 @@ sub exec_on_delete { 0 } sub add_md5 { - my ($self, $md5) = @_; - $self->{md5} = $md5; + &OpenBSD::PackingElement::FileBase::add_md5; } sub add_size { - my ($self, $sz) = @_; - $self->{size} = $sz; + &OpenBSD::PackingElement::FileBase::add_size; } -sub needs_keyword { 0 } +sub compute_md5 +{ + &OpenBSD::PackingElement::FileObject::compute_md5; +} sub write { &OpenBSD::PackingElement::FileBase::write; } +sub needs_keyword { 0 } + sub add_object { my ($self, $plist) = @_; -- cgit v1.2.3