From 94c0bb6431c92978a0db8871177b3919b9f1d2ee Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 30 Jun 2019 14:57:26 +0000 Subject: refactor a bit of code: retrieve_fullname/retrieve_size, so that special files are a bit less special. Leave ::Sample for now --- usr.sbin/pkg_add/OpenBSD/Delete.pm | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD/Delete.pm') diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 1d1a4ca5101..4f88063e588 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.157 2018/07/07 11:32:01 espie Exp $ +# $OpenBSD: Delete.pm,v 1.158 2019/06/30 14:57:25 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -303,8 +303,8 @@ package OpenBSD::PackingElement::DirBase; sub prepare_for_deletion { my ($self, $state, $pkgname) = @_; - my $fname = $state->{destdir}.$self->fullname; - $state->vstat->remove_directory($fname, $self); + $state->vstat->remove_directory( + $self->retrieve_fullname($state, $pkgname), $self); } sub delete @@ -401,9 +401,9 @@ sub prepare_for_deletion { my ($self, $state, $pkgname) = @_; - my $fname = $state->{destdir}.$self->fullname; + my $fname = $self->retrieve_fullname($state, $pkgname); my $s; - my $size = $self->{tied} ? 0 : $self->{size}; + my $size = $self->{tied} ? 0 : $self->retrieve_size; if ($state->{delete_first}) { $s = $state->vstat->remove_first($fname, $size); } else { @@ -507,22 +507,6 @@ sub copy_old_stuff package OpenBSD::PackingElement::SpecialFile; use OpenBSD::PackageInfo; -sub prepare_for_deletion -{ - my ($self, $state, $pkgname) = @_; - - my $fname = $self->fullname; - my $size = $self->{size}; - if (!defined $size) { - $size = (stat $fname)[7]; - } - my $s = $state->vstat->remove($fname, $self->{size}); - return unless defined $s; - if ($s->ro) { - $s->report_ro($state, $fname); - } -} - sub copy_old_stuff { } -- cgit v1.2.3