summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-11-21 15:07:10 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-11-21 15:07:10 +0000
commit32fc7a72fe52f879f566613a6779635b04149d9e (patch)
tree33dd3263a1d34bfc89ee21fb375579cefe94bbfe /usr.sbin/pkg_add
parent18e6d7ce4c8f9ec5c0be694bdd93f6163bee2821 (diff)
a long time ago, DISPLAY and UNDISPLAY required special treatment, as they
were displayed "on the fly". But prepare+log means the display happens later in any case, so they can be done as part of regular plist. Also, mark known manpage dirs for even more verbiage reduction...
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm26
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm36
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm16
3 files changed, 54 insertions, 24 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index e94596b9224..e4fff12d87b 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.161 2014/07/12 19:50:43 espie Exp $
+# $OpenBSD: Add.pm,v 1.162 2014/11/21 15:07:09 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -694,7 +694,10 @@ sub install
{
my ($self, $state) = @_;
$self->SUPER::install($state);
- $state->log("You may wish to add #1 to /etc/man.conf", $self->fullname);
+ if (!$state->{knownmandirs}{$self->fullname}) {
+ $state->log("You may wish to add #1 to /etc/man.conf",
+ $self->fullname);
+ }
}
package OpenBSD::PackingElement::Manpage;
@@ -875,4 +878,23 @@ sub prepare_for_addition
}
}
+package OpenBSD::PackingElement::FDISPLAY;
+sub install
+{
+ my ($self, $state) = @_;
+ my $d = $self->{d};
+ if (!$state->{known_displays}{$self->{d}->key}) {
+ $self->prepare($state);
+ }
+ $self->SUPER::install($state);
+}
+
+package OpenBSD::PackingElement::FUNDISPLAY;
+sub find_extractible
+{
+ my ($self, $state, $wanted, $tied) = @_;
+ $state->{known_displays}{$self->{d}->key} = 1;
+ $self->SUPER::find_extractible($state, $wanted, $tied);
+}
+
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index ef4db3602c0..20c79375754 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.138 2014/11/20 15:08:21 espie Exp $
+# $OpenBSD: Delete.pm,v 1.139 2014/11/21 15:07:09 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -141,12 +141,6 @@ sub delete_plist
$plist->register_manpage($state, 'rmman');
manpages_unindex($state);
$state->progress->visit_with_size($plist, 'delete', $state);
- if ($plist->has(UNDISPLAY)) {
- my $d = $plist->get(UNDISPLAY)->{d};
- if (!$state->{known_displays}{$$d}) {
- $plist->get(UNDISPLAY)->prepare($state);
- }
- }
}
unregister_dependencies($plist, $state);
@@ -340,6 +334,7 @@ sub record_shared
$self->{pkgname} = $pkgname;
push(@{$recorder->{dirs}{$self->fullname}} , $self);
}
+
package OpenBSD::PackingElement::Fontdir;
sub record_shared
{
@@ -680,4 +675,31 @@ sub copy_old_stuff
OpenBSD::PackingElement::Comment->add($plist, "\@".$self->keyword." ".$self->stringize);
}
+package OpenBSD::PackingElement::FDISPLAY;
+sub delete
+{
+ my ($self, $state) = @_;
+ $state->{known_displays}{$self->{d}->key} = 1;
+ $self->SUPER::delete($state);
+}
+
+package OpenBSD::PackingElement::FUNDISPLAY;
+sub delete
+{
+ my ($self, $state) = @_;
+ my $d = $self->{d};
+ if (!$state->{known_displays}{$self->{d}->key}) {
+ $self->prepare($state);
+ }
+ $self->SUPER::delete($state);
+}
+
+package OpenBSD::PackingElement::Mandir;
+sub delete
+{
+ my ($self, $state) = @_;
+ $state->{knownmandirs}{$self->fullname} = 1;
+ $self->SUPER::delete($state);
+}
+
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index d6ffc984b71..9a3a79f5cc7 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.75 2014/11/20 15:08:21 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.76 2014/11/21 15:07:09 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -736,10 +736,6 @@ sub delete_old_packages
require OpenBSD::Delete;
try {
OpenBSD::Delete::delete_plist($o->plist, $state);
- if ($o->plist->has(DISPLAY)) {
- my $d = $o->plist->get(DISPLAY)->{d};
- $state->{known_displays}{$$d} = 1;
- }
} catchall {
$state->errsay($_);
$state->fatal(partial_install(
@@ -816,10 +812,6 @@ sub really_add
try {
OpenBSD::Add::perform_extraction($handle,
$state);
- if ($handle->plist->has(UNDISPLAY)) {
- my $d = $handle->plist->get(UNDISPLAY)->{d};
- $state->{known_displays}{$$d} = 1;
- }
} catchall {
unless ($state->{interrupted}) {
$state->errsay($_);
@@ -871,12 +863,6 @@ sub really_add
add_installed($pkgname);
delete $handle->{partial};
OpenBSD::PkgCfl::register($handle, $state);
- if ($plist->has(DISPLAY)) {
- my $d = $plist->get(DISPLAY)->{d};
- if (!$state->{known_displays}{$$d}) {
- $plist->get(DISPLAY)->prepare($state);
- }
- }
}
delete $state->{partial};
$set->{solver}->register_dependencies($state);