diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-31 10:00:23 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-31 10:00:23 +0000 |
commit | 7f95143f980038a332f0756e4bd91359566e262f (patch) | |
tree | 8035789f4f000245a3e61b00a66e93817924c495 | |
parent | 29a334db9d38a593a3d0fcd688be5603d31d7a19 (diff) |
a few cosmetic changes, move realname over to PackingElement to be
able to use it in other cases.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 27 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 13 |
2 files changed, 20 insertions, 20 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index e7e122ce25b..f74184d8220 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.54 2007/05/30 16:32:14 espie Exp $ +# $OpenBSD: Delete.pm,v 1.55 2007/05/31 10:00:22 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -29,14 +29,14 @@ sub rename_file_to_temp my $i = shift; require OpenBSD::Temp; - my $n = $i->fullname(); + my $n = $i->fullname; my ($fh, $j) = OpenBSD::Temp::permanent_file(undef, $n); close $fh; if (rename($n, $j)) { print "Renaming old file $n to $j\n"; - if ($i->{name} !~ m|^/| && $i->cwd() ne '.') { - my $c = $i->cwd(); + if ($i->{name} !~ m|^/| && $i->cwd ne '.') { + my $c = $i->cwd; $j =~ s|^\Q$c\E/||; } $i->{name} = $j; @@ -217,18 +217,7 @@ sub mark_dir { my ($self, $state) = @_; - $self->mark_directory($state, dirname($self->fullname())); -} - -sub realname -{ - my ($self, $state) = @_; - - my $name = $self->fullname; - if (defined $self->{tempname}) { - $name = $self->{tempname}; - } - return $state->{destdir}.$name; + $self->mark_directory($state, dirname($self->fullname)); } sub do_not_delete @@ -302,7 +291,7 @@ sub delete my ($self, $state) = @_; if ($state->{very_verbose}) { - print "dirrm: ", $self->fullname, "\n"; + print "rmdir: ", $self->fullname, "\n"; } $self->record_shared($state->{recorder}, $state->{pkgname}); @@ -423,7 +412,7 @@ sub prepare_for_deletetion { my ($self, $state, $pkgname) = @_; - my $fname = installed_info($pkgname).$self->{name}; + my $fname = $self->fullname; my $size = $self->{size}; if (!defined $size) { $size = (stat $fname)[7]; @@ -522,7 +511,7 @@ sub delete { my ($self, $state) = @_; unless ($state->{not}) { - my $fullname = $state->{destdir}.$self->fullname(); + my $fullname = $state->{destdir}.$self->fullname; VSystem($state->{very_verbose}, "install-info", "--delete", "--info-dir=".dirname($fullname), $fullname); } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 32f5285e2a1..9a8855937a9 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.120 2007/05/30 12:52:07 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.121 2007/05/31 10:00:22 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -329,6 +329,17 @@ sub set_tempname $self->{tempname} = $tempname; } +sub realname +{ + my ($self, $state) = @_; + + my $name = $self->fullname; + if (defined $self->{tempname}) { + $name = $self->{tempname}; + } + return $state->{destdir}.$name; +} + sub IsFile() { 1 } |