summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-10-11 13:46:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-10-11 13:46:18 +0000
commitd8172283289fd503a4f62261a7b1ebc2af32ca7a (patch)
tree3602a6ee1d72574baf0f4f264a1a829e2ebc6e3c /usr.sbin/pkg_add/OpenBSD
parent2cc9ba7c0def09e8aaead5c57e152a6ccc852c19 (diff)
aggregate all MESSAGES and display them at the end, with proper markers to
separate distinct packages.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index af0a22a1666..b9e01330f94 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.50 2004/10/11 13:29:05 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.51 2004/10/11 13:46:17 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -1119,12 +1119,38 @@ package OpenBSD::PackingElement::FREQUIRED_BY;
our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
sub category() { OpenBSD::PackageInfo::REQUIRED_BY }
-package OpenBSD::PackingElement::FDISPLAY;
+package OpenBSD::PackingElement::DisplayFile;
our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
+use OpenBSD::Error;
+
+sub prepare
+{
+ my ($self, $state) = @_;
+ unless (defined $state->{display}) {
+ require OpenBSD::Temp;
+ require File::Temp;
+
+ ($state->{display}, $state->{displayname}) = File::Temp::tempfile("display.XXXXXXXXX", DIR => $OpenBSD::Temp::tempbase);
+ }
+ my $fname = $state->{dir}.$self->{name};
+ open(my $src, '<', $fname) or Fatal "Can't open $fname: $!";
+ my $dest = $state->{display};
+ local $_;
+ print $dest "+-------------- ", $state->{pkgname}, "\n";
+ while (<$src>) {
+ next if m/^\+\-+\s*$/;
+ s/^\+ //;
+ print $dest $_;
+ }
+ print $dest "+-------------- ", $state->{pkgname}, "\n";
+}
+
+package OpenBSD::PackingElement::FDISPLAY;
+our @ISA=qw(OpenBSD::PackingElement::DisplayFile);
sub category() { OpenBSD::PackageInfo::DISPLAY }
package OpenBSD::PackingElement::FUNDISPLAY;
-our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
+our @ISA=qw(OpenBSD::PackingElement::DisplayFile);
sub category() { OpenBSD::PackageInfo::UNDISPLAY }
package OpenBSD::PackingElement::FMTREE_DIRS;