diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-29 13:52:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-29 13:52:08 +0000 |
commit | 8f2bd2067fd2a565352afda9d61956f0e4f4d5a8 (patch) | |
tree | 17aada151e0edc323e6c0f14d2f31d091b0351ff /usr.sbin/pkg_add | |
parent | 5816a7fd0f4f02644d68e465adf9489073b335b5 (diff) |
don't bypass add_object to create special files, otherwise infodir won't
get defined.
Simplify and clean-up register_installation: everything is in the packing-list
so don't pass other arguments. Do not copy arbitrary info_names objects, but
use a copy_info visitor which copies exactly what files are around.
Use the stored infodir to locate DISPLAY and INSTALL files.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 32 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 15 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 5 |
3 files changed, 33 insertions, 19 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index c4359208186..85b596d3336 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.58 2007/05/28 13:00:04 espie Exp $ +# $OpenBSD: Add.pm,v 1.59 2007/05/29 13:52:07 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -46,12 +46,13 @@ sub manpages_index sub register_installation { - my ($dir, $dest, $plist) = @_; + my $plist = shift; return if $main::not; + my $dest = installed_info($plist->pkgname); + my $dir = $plist->infodir; mkdir($dest); - for my $i (info_names()) { - copy($dir.$i, $dest); - } + $plist->copy_info($dest); + $plist->set_infodir($dest); $plist->to_installation; } @@ -97,10 +98,8 @@ sub borked_installation } } OpenBSD::PackingElement::Cwd->add($plist, '.'); - my $pkgname = $plist->pkgname; $plist->{name}->{name} = $borked; - my $dest = installed_info($borked); - register_installation($dir, $dest, $plist); + register_installation($plist); Fatal @msg, ", partial installation recorded as $borked"; } @@ -118,6 +117,10 @@ sub install { } +sub copy_info +{ +} + sub set_modes { my ($self, $name) = @_; @@ -584,4 +587,17 @@ sub prepare_for_addition } } +sub copy_info +{ + my ($self, $dest) = @_; + require File::Copy; + + File::Copy::move($self->fullname, $dest); +} + +package OpenBSD::PackingElement::FCONTENTS; +sub copy_info +{ +} + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 89687a787d0..d694f368f1b 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.117 2007/05/29 13:00:17 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.118 2007/05/29 13:52:07 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -350,7 +350,7 @@ sub add_object my $j = is_info_name($self->fullname); if ($j) { bless $self, "OpenBSD::PackingElement::$j"; - $plist->addunique($self); + $self->add_object($plist); } else { $plist->add2list($self); } @@ -1290,18 +1290,17 @@ sub run { my ($self, $state, @args) = @_; - my $dir = $state->{dir}; my $not = $state->{not}; my $pkgname = $state->{pkgname}; - my $name = $self->{name}; + my $name = $self->fullname; return if $state->{dont_run_scripts}; OpenBSD::PackingElement::Lib::ensure_ldconfig($state); - print $self->beautify, " script: $dir$name $pkgname ", join(' ', @args), "\n" if $state->{beverbose}; + print $self->beautify, " script: $name $pkgname ", join(' ', @args), "\n" if $state->{beverbose}; return if $not; - chmod 0755, $dir.$name; - return if $state->system($dir.$name, $pkgname, @args) == 0; + chmod 0755, $name; + return if $state->system($name, $pkgname, @args) == 0; if ($state->{forced}->{scripts}) { $state->warn($self->beautify, " script failed\n"); } else { @@ -1345,7 +1344,7 @@ use OpenBSD::Error; sub prepare { my ($self, $state) = @_; - my $fname = $state->{dir}.$self->{name}; + my $fname = $self->fullname; open(my $src, '<', $fname) or Warn "Can't open $fname: $!"; while (<$src>) { next if m/^\+\-+\s*$/; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index da51e5264ca..94687061fbf 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.287 2007/05/29 13:15:23 espie Exp $ +# $OpenBSD: pkg_add,v 1.288 2007/05/29 13:52:07 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -494,8 +494,7 @@ sub really_add } OpenBSD::SharedLibs::add_libs_from_plist($plist); $plist->to_cache; - my $dest = installed_info($pkgname); - OpenBSD::Add::register_installation($dir, $dest, $plist); + OpenBSD::Add::register_installation($plist); if (defined $handle->{solver}) { $handle->{solver}->register_dependencies; } |