diff options
author | joe <joe@FreeBSD.org> | 2001-05-20 06:32:07 +0800 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-05-20 06:32:07 +0800 |
commit | 5e6a87afbeaf8d8d9db1e78f83ee67b7e1f761a9 (patch) | |
tree | 4c551f0177408712d97f808644bff00811e7347a /devel | |
parent | bc5dfd9a89ff6f5e96dd03738eaa81156146565c (diff) | |
download | freebsd-ports-gnome-5e6a87afbeaf8d8d9db1e78f83ee67b7e1f761a9.tar.gz freebsd-ports-gnome-5e6a87afbeaf8d8d9db1e78f83ee67b7e1f761a9.tar.zst freebsd-ports-gnome-5e6a87afbeaf8d8d9db1e78f83ee67b7e1f761a9.zip |
Log::Dispatch is a suite of OO modules for logging messages to multiple
outputs, each of which can have a minimum and maximum log level. It is
designed to be easily subclassed, both for creating a new dispatcher
object and particularly for creating new outputs.
PR: ports/27412
Diffstat (limited to 'devel')
-rw-r--r-- | devel/Makefile | 1 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/Makefile | 48 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/distinfo | 1 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/files/patch-broken-perl-syslog | 20 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/files/patch-simpler-Makefile.PL | 107 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/pkg-comment | 1 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/pkg-descr | 14 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/pkg-plist | 18 | ||||
-rw-r--r-- | devel/p5-Log-Dispatch/scripts/configure.pl | 172 |
9 files changed, 382 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile index c691645587c4..2a0c274897c0 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -315,6 +315,7 @@ SUBDIR += p5-Locale-PGetText SUBDIR += p5-Locale-gettext SUBDIR += p5-LockFile-Simple + SUBDIR += p5-Log-Dispatch SUBDIR += p5-Mac-FileSpec-Unixish SUBDIR += p5-Make SUBDIR += p5-OLE-Storage_Lite diff --git a/devel/p5-Log-Dispatch/Makefile b/devel/p5-Log-Dispatch/Makefile new file mode 100644 index 000000000000..39529fbeb815 --- /dev/null +++ b/devel/p5-Log-Dispatch/Makefile @@ -0,0 +1,48 @@ +# New ports collection makefile for: devel/p5-Log-Dispatch +# Date created: 17 May 2001 +# Whom: Anton Berezin <tobez@tobez.org> +# +# $FreeBSD$ +# + +PORTNAME= Log-Dispatch +PORTVERSION= 1.79 +CATEGORIES= devel perl5 +MASTER_SITES= ${MASTER_SITE_PERL_CPAN} +MASTER_SITE_SUBDIR= Log +PKGNAMEPREFIX= p5- + +MAINTAINER= tobez@tobez.org + +RUN_DEPENDS= ${BUILD_DEPENDS} + +PERL_CONFIGURE= yes + +MAN3= Log::Dispatch.3 \ + Log::Dispatch::ApacheLog.3 \ + Log::Dispatch::Base.3 \ + Log::Dispatch::Email.3 \ + Log::Dispatch::Email::MIMELite.3 \ + Log::Dispatch::Email::MailSend.3 \ + Log::Dispatch::Email::MailSendmail.3 \ + Log::Dispatch::File.3 \ + Log::Dispatch::Handle.3 \ + Log::Dispatch::Output.3 \ + Log::Dispatch::Screen.3 \ + Log::Dispatch::Syslog.3 +MANPREFIX= ${PREFIX}/lib/perl5/${PERL_VERSION} + +SCRIPTS_ENV+= WRKDIRPREFIX="${WRKDIRPREFIX}" \ + REALCURDIR="${.CURDIR}" + +pre-fetch: + @${SETENV} ${SCRIPTS_ENV} ${PERL} ${SCRIPTDIR}/configure.pl + +post-clean: + @${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc + +.if exists(${WRKDIRPREFIX}${.CURDIR}/Makefile.inc) +.include "${WRKDIRPREFIX}${.CURDIR}/Makefile.inc" +.endif + +.include <bsd.port.mk> diff --git a/devel/p5-Log-Dispatch/distinfo b/devel/p5-Log-Dispatch/distinfo new file mode 100644 index 000000000000..8199d30e470b --- /dev/null +++ b/devel/p5-Log-Dispatch/distinfo @@ -0,0 +1 @@ +MD5 (Log-Dispatch-1.79.tar.gz) = 454da144672bd6b0fb24a12b17830991 diff --git a/devel/p5-Log-Dispatch/files/patch-broken-perl-syslog b/devel/p5-Log-Dispatch/files/patch-broken-perl-syslog new file mode 100644 index 000000000000..ae1d37f69777 --- /dev/null +++ b/devel/p5-Log-Dispatch/files/patch-broken-perl-syslog @@ -0,0 +1,20 @@ +--- Dispatch/Syslog.pm.orig Thu May 17 16:23:51 2001 ++++ Dispatch/Syslog.pm Thu May 17 16:24:15 2001 +@@ -45,7 +45,7 @@ + $self->{ident} = $params{ident} || $0; + $self->{logopt} = $params{logopt} || ''; + $self->{facility} = $params{facility} || 'user'; +- $self->{socket} = $params{socket} || 'unix'; ++ $self->{socket} = $params{socket} || undef; + + $self->{priorities} = [ 'DEBUG', + 'INFO', +@@ -56,7 +56,7 @@ + 'ALERT', + 'EMERG' ]; + +- Sys::Syslog::setlogsock $self->{socket}; ++ Sys::Syslog::setlogsock $self->{socket} if defined $self->{socket}; + } + + sub log_message diff --git a/devel/p5-Log-Dispatch/files/patch-simpler-Makefile.PL b/devel/p5-Log-Dispatch/files/patch-simpler-Makefile.PL new file mode 100644 index 000000000000..4f02ca4beff4 --- /dev/null +++ b/devel/p5-Log-Dispatch/files/patch-simpler-Makefile.PL @@ -0,0 +1,107 @@ +--- Makefile.PL.orig Thu May 17 18:13:04 2001 ++++ Makefile.PL Thu May 17 18:13:22 2001 +@@ -6,104 +6,8 @@ + require 5.005; + } + +-{ +- unless (-d './Install') +- { +- mkdir './Install', 0755 +- or die "can't make dir ./Install: $!"; +- } +- +- my %config; +- $config{email_address} = prompt( q[ +-To do a full test of the Log::Dispatch::* modules, we need +-to attempt to send an email. If you want these tests to +-be done please supply an address. +-Address?] ); +- +- $config{syslog} = prompt( q[ +-Do you want to test Log::Dispatch::Syslog by sending a message as +-daemon.notice? +-Yes/No?], 'No' ); +- +- delete $config{syslog} if $config{syslog} !~ /^y(?:es)?/i; +- +- if ($config{syslog}) +- { +- my $default; +- foreach ( qw( /var/adm/messages +- /var/adm/syslog +- /var/log/messages +- /var/log/syslog +- /var/log/syslog +- /etc/log/syslog ) ) +- { +- if (-e) +- { +- $default = $_; +- last; +- } +- } +- +- $config{syslog_file} = prompt('What file would a message sent as daemon.notice end up in?', $default); +- +- unless (-r $config{syslog_file}) +- { +- warn "$config{syslog_file} is not readable. Syslog tests will be skipped\n"; +- delete $config{syslog}; +- delete $config{syslog_file}; +- } +- } +- +- open CFG, ">./Install/TestConfig.pm" +- or die "can't write to ./Install/TestConfig.pm: $!"; +- +- print CFG <<"EOF"; +-# +-# This file was automatically generated by Makefile.PL. Do not +-# edit, instead do a "make realclean" in the toplevel directory and +-# rerun "perl makefile.PL". +-# +- +-package Install::TestConfig; +-EOF +- +- print CFG "\%config = \n(\n"; +- foreach (keys %config) +- { +- print CFG "\t$_ => '$config{$_}',\n"; +- } +- print CFG ');'; +- close CFG; +-} + + my %extra_pms; +-{ +- print <<'EOF'; +- +-Please list any extra modules you would like added as part of this +-installation. These should be located somewhere under the Dispatch/ +-directory. Please type the path after Dispatch/ (including the .pm +-extension). +- +-Press enter a blank line when you are done. +- +-EOF +- +- while (1) +- { +- chomp (my $module = <STDIN>); +- last unless $module; +- +- if (-e "./Dispatch/$module") +- { +- $extra_pms{"Dispatch/$module"} = '$(INST_LIBDIR)/Dispatch/' . $module; +- } +- else +- { +- warn "Couldn't find ./Dispatch/$module\n"; +- } +- } +-} + + + diff --git a/devel/p5-Log-Dispatch/pkg-comment b/devel/p5-Log-Dispatch/pkg-comment new file mode 100644 index 000000000000..002f071ab325 --- /dev/null +++ b/devel/p5-Log-Dispatch/pkg-comment @@ -0,0 +1 @@ +A suite of OO modules for logging messages to multiple outputs diff --git a/devel/p5-Log-Dispatch/pkg-descr b/devel/p5-Log-Dispatch/pkg-descr new file mode 100644 index 000000000000..1e6e7e17b2ce --- /dev/null +++ b/devel/p5-Log-Dispatch/pkg-descr @@ -0,0 +1,14 @@ +Log::Dispatch is a suite of OO modules for logging messages to multiple +outputs, each of which can have a minimum and maximum log level. It is +designed to be easily subclassed, both for creating a new dispatcher +object and particularly for creating new outputs. + +It also allows both global (dispatcher level) and local (logging object) +message formatting callbacks which allows greater flexibility and should +reduce the need for subclassing. + +Subclassing is only needed to send a message to a different output, not +to change the message format. + +-Anton +<tobez@tobez.org> diff --git a/devel/p5-Log-Dispatch/pkg-plist b/devel/p5-Log-Dispatch/pkg-plist new file mode 100644 index 000000000000..2a1250c253d4 --- /dev/null +++ b/devel/p5-Log-Dispatch/pkg-plist @@ -0,0 +1,18 @@ +lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto/Log/Dispatch/.packlist +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/ApacheLog.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Base.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Email.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Email/MIMELite.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Email/MailSend.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Email/MailSendmail.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/File.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Handle.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Output.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Screen.pm +lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Syslog.pm +@dirrm lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch/Email +@unexec rmdir %D/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto/Log/Dispatch 2>/dev/null || true +@unexec rmdir %D/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto/Log 2>/dev/null || true +@unexec rmdir %D/lib/perl5/site_perl/%%PERL_VER%%/Log/Dispatch 2>/dev/null || true +@unexec rmdir %D/lib/perl5/site_perl/%%PERL_VER%%/Log 2>/dev/null || true diff --git a/devel/p5-Log-Dispatch/scripts/configure.pl b/devel/p5-Log-Dispatch/scripts/configure.pl new file mode 100644 index 000000000000..cdadc0aef39a --- /dev/null +++ b/devel/p5-Log-Dispatch/scripts/configure.pl @@ -0,0 +1,172 @@ +#! /usr/bin/perl -w +use strict; + +unless (defined $ENV{WRKDIRPREFIX} and + defined $ENV{REALCURDIR} and + defined $ENV{LOCALBASE}) +{ + die "this script should not be run like that!\n"; +} + +my $batch = $ENV{BATCH} || 0; + +my $makedir = "$ENV{WRKDIRPREFIX}$ENV{REALCURDIR}"; +my $makefile = "$makedir/Makefile.inc"; +exit if -f $makefile; + +my @modules = ( + { + module => 'ApacheLog', + check => 'Apache::Log', +# file => '${PERL_ARCH}/Apache/Log.pm', + port => 'www/mod_perl', +# man3 => 'Log::Dispatch::ApacheLog', + }, + { + module => 'Email::MIMELite', + check => 'MIME::Lite', + port => 'mail/p5-MIME-Lite', + }, + { + module => 'Email::MailSend', + check => 'Mail::Send', + port => 'mail/p5-Mail-Tools', + }, + { + module => 'Email::MailSendmail', + check => 'Mail::Sendmail', + port => 'mail/p5-Mail-Sendmail', + }, + { + module => 'Syslog', + check => 'Sys::Syslog', + port => 'base perl', + nodepend=> 1, + } +); + +scan_modules(@modules); +@modules = select_modules(@modules); +generate_makefile_inc(@modules); +exit; + +sub generate_makefile_inc +{ + my @modules = @_; + + mkdir $makedir, 0777; + open INC, "> $makefile" or die "open: $makefile: $!\n"; + + for my $m (@modules) { + next if $m->{nodepend}; + my $mpath = $m->{found} || "/nonexistent"; + $mpath = varify_hardcoded_paths($mpath); + my $port = $m->{port}; + print INC "BUILD_DEPENDS+= $mpath:\${PORTSDIR}/$port\n"; + } + close INC; +} + +sub varify_hardcoded_paths +{ + local ($_) = @_; + s|(perl5/site_perl/)([\d._]+)/|$1\${PERL_VER}/|; + s|(perl5/site_perl/\${PERL_VER}/)mach/|$1\${PERL_ARCH}/|; + s|^$ENV{LOCALBASE}/|\${LOCALBASE}/|; + $_; +} + +sub got_module +{ + my ($m) = @_; + + $m =~ s|::|/|g; + $m .= ".pm"; + for (@INC) { + my $f = "$_/$m"; + return $f if -r $f; + } + return 0; +} + +sub scan_modules +{ + my @modules = @_; + for my $module (@modules) { + $module->{found} = got_module($module->{check}); + } +} + +sub select_modules +{ + my @modules = @_; + my @selected; + if ($batch) { + @selected = batch_select(@_); + } else { + @selected = ask_user(@_); + } + my @mod; + my %modules = map { $_->{module} => $_ } @modules; + for my $module (@selected) { + push @mod, $modules{$module} if exists $modules{$module}; + } + @mod; +} + +sub batch_select +{ + my @modules = @_; + my @selected; + for my $module (@modules) { + push @selected, $module->{module} if $module->{found}; + } + @selected; +} + +sub ask_user +{ + my @modules = @_; + my @dlg; + push @dlg, "/usr/bin/dialog"; + push @dlg, "--title", "Log::Dispatch configuration"; + push @dlg, "--clear", "--checklist", <<EOF; +Log::Dispatch distribution provides several predefined output objects. +Select output objects you will likely need. Those output objects for +which no extra software packages need to be installed are preselected. + + Please choose options by pressing SPACE to TOGGLE on option ON/OFF +EOF + push @dlg, -1, -1, 9; + for my $module (@modules) { + push @dlg, $module->{module}, "requires $module->{check}" . + ($module->{found} ? " (already installed)" : ""), + ($module->{found} ? "ON" : "OFF"); + } + + my @selected; + + my $pid = open(RESULT, "-|"); + if ($pid) { + # parent + my $r = ""; + while (<RESULT>) { + $r .= $_; + } + close(RESULT) or die "dialog(1) exited with non-zero return code\n"; + $r =~ s/"//g; + $r =~ s/\s+/ /g; + @selected = split ' ', $r; + } elsif (defined $pid) { + # child + open XCHG, ">& STDOUT" or die "dup: $!\n"; + open STDOUT, ">& STDERR" or die "dup: $!\n"; + open STDERR, ">& XCHG" or die "dup: $!\n"; + close XCHG if fileno(XCHG) > 2; + exec @dlg or die "cannot exec: $!\n"; + } else { + die "cannot fork: $!\n"; + } + + return @selected; +} |