From d8172283289fd503a4f62261a7b1ebc2af32ca7a Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 11 Oct 2004 13:46:18 +0000 Subject: aggregate all MESSAGES and display them at the end, with proper markers to separate distinct packages. --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD') 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 # @@ -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; -- cgit v1.2.3