diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-27 12:07:59 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-27 12:07:59 +0000 |
commit | 9074f1b2989f67cdc3997d4c5dbfed824146c1e2 (patch) | |
tree | 2762600c06c96ca77c6baea938a0652a3cfe9c6f /usr.sbin | |
parent | 4e856b2e517446073ed13ca7b3a7d89fa4c23e91 (diff) |
record sample/extra directories if !extra, so that SharedItems won't warn
if those directories are not empty...
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 25 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Error.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/SharedItems.pm | 5 |
3 files changed, 29 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index b491f66dfde..eb726416ce1 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.12 2004/11/27 11:36:16 espie Exp $ +# $OpenBSD: Delete.pm,v 1.13 2004/11/27 12:07:58 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -158,6 +158,20 @@ sub delete { } +package OpenBSD::PackingElement::FileObject; +use File::Basename; + +sub mark_dir +{ + my ($self, $state, $dir) = @_; + + $state->{dirs_okay}->{$dir} = 1; + my $d2 = dirname($dir); + if ($d2 ne $dir) { + $self->mark_dir($state, $d2); + } +} + package OpenBSD::PackingElement::NewUser; sub delete { @@ -272,6 +286,8 @@ sub delete package OpenBSD::PackingElement::Sample; use OpenBSD::md5; use OpenBSD::Error; +use File::Basename; + sub delete { my ($self, $state) = @_; @@ -298,6 +314,7 @@ sub delete if ($state->{quick}) { unless ($state->{extra}) { + $self->mark_dir($state, dirname($name)); $state->print("You should also remove $realname\n"); return; } @@ -307,6 +324,7 @@ sub delete print "File $realname identical to sample\n" if $state->{not} or $state->{verbose}; } else { unless ($state->{extra}) { + $self->mark_dir($state, dirname($name)); $state->print("You should also remove $realname (which was modified)\n"); return; } @@ -363,6 +381,8 @@ sub delete } package OpenBSD::PackingElement::Extra; +use File::Basename; + sub delete { my ($self, $state) = @_; @@ -378,9 +398,11 @@ sub delete print "problem deleting extra file $realname\n"; } else { $state->print("You should also remove $realname\n"); + $self->mark_dir($state, dirname($name)); } } + package OpenBSD::PackingElement::Extradir; sub delete { @@ -391,6 +413,7 @@ sub delete $self->SUPER::delete($state); } else { $state->print("You should also remove the directory $realname\n"); + $self->mark_dir($state, $self->fullname()); } } diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 594a1f59e2c..7498bb35865 100644 --- a/usr.sbin/pkg_add/OpenBSD/Error.pm +++ b/usr.sbin/pkg_add/OpenBSD/Error.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Error.pm,v 1.6 2004/11/15 02:44:50 espie Exp $ +# $OpenBSD: Error.pm,v 1.7 2004/11/27 12:07:58 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -72,7 +72,7 @@ sub Warn sub new { my $class = shift; - bless {messages=>{}}, $class; + bless {messages=>{}, dirs_okay=>{}}, $class; } sub set_pkgname diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm index 31a56f170a8..27429a0340e 100644 --- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm +++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SharedItems.pm,v 1.4 2004/11/27 11:36:16 espie Exp $ +# $OpenBSD: SharedItems.pm,v 1.5 2004/11/27 12:07:58 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -74,7 +74,8 @@ sub cleanup $i->cleanup($state); } if (!rmdir $realname) { - $state->print("Error deleting directory $realname: $!\n"); + $state->print("Error deleting directory $realname: $!\n") + unless $state->{dirs_okay}->{$d}; } } $done++; |