From d8ee8a56a3a5ac156f8d840f050b8223fb955636 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Fri, 10 Feb 2017 17:50:31 +0200 Subject: Add building infrastructure --- .gitignore | 10 ++++++++++ MANIFEST | 6 ++++++ Makefile.PL | 20 ++++++++++++++++++++ bootstrap.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ syslogck | 8 +++++--- 5 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 MANIFEST create mode 100644 Makefile.PL create mode 100644 bootstrap.pl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b43081a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.emacs* +*~ +/MYMETA.json +/MYMETA.yml +Makefile +/syslogck-*.tar.gz +/tmp +/blib +/pm_to_blib +/inc diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..344ac44 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,6 @@ +Changes +LICENSE +Makefile.PL +MANIFEST This list of files +inc/ExtUtils/AutoInstall.pm +syslogck diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..8e9812f --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,20 @@ +# -*- perl -*- +use strict; +use lib 'inc'; +use ExtUtils::AutoInstall ( + -core => { + 'Getopt::Long' => 2.34, + 'File::Basename' => 2.84, + 'Pod::Usage' => 1.51, + 'Pod::Man' => 2.25, + 'Sys::Syslog' => 0.29 + } +); + +WriteMakefile(NAME => 'syslogck', + ABSTRACT_FROM => 'syslogck', + VERSION_FROM => 'syslogck', + AUTHOR => 'Sergey Poznyakoff ', + LICENSE => 'gpl', + EXE_FILES => [ 'syslogck' ] +); diff --git a/bootstrap.pl b/bootstrap.pl new file mode 100644 index 0000000..90db16a --- /dev/null +++ b/bootstrap.pl @@ -0,0 +1,61 @@ +#! /usr/bin/perl +# This file is part of acmeman. +# Copyright (C) 2014, 2017 Sergey Poznyakoff +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +use strict; +use CPAN; +use Cwd qw(getcwd); +use File::Path qw(mkpath); + +#### +my $incdir = "inc/ExtUtils"; +my $topdir = getcwd; + +my $modname = "ExtUtils::AutoInstall"; + +my $mod = CPAN::Shell->expandany($modname) or die "Can't expand $modname"; +my $file = $mod->inst_file; +my $dir; + +if (defined($file)) { + print "$modname installed at $file\n"; + if (-f $file) { + $file =~ s#/[^/]+\.pm$##; + if (-d $file) { + $dir = $file; + } else { + die "Can't find $modname directory"; + } + } +} else { + print "Getting $modname\n"; + my $distro = $mod->get or die "Can't get distribution for $modname"; + $dir = $distro->dir; +} + +$file = "$dir/$incdir/AutoInstall.pm"; +$file = "$dir/AutoInstall.pm" unless (-f $file); +-f $file or die "$file not found"; + +use autodie; +chdir $topdir; +mkpath $incdir unless -d $incdir; +chdir $incdir; +no autodie; +unlink "AutoInstall.pm"; +use autodie; +symlink $file, "AutoInstall.pm"; + diff --git a/syslogck b/syslogck index 808dadd..0427a00 100644 --- a/syslogck +++ b/syslogck @@ -7,6 +7,8 @@ use Pod::Usage; use Pod::Man; use Getopt::Long qw(:config gnu_getopt no_ignore_case); +our $VERSION = '0.99'; + use constant { EX_OK => 0, EX_USAGE => 64, @@ -39,9 +41,9 @@ can be changed by supplying the name of the file in the command line. Multiple arguments are allowed. The configuration parser is very permissive. It selects only lines that -can reliably be parsed as traditional syslog selector lines. This allows to -use B with any flavor of syslog that allows for traditional -configuration (e.g. B). +can reliably be parsed as traditional syslog selector lines, and silently +ignores the rest. This allows to use B with any flavor of syslog +that allows for traditional configuration (e.g. B). On success (test message appeared in the log), B silently exits with code B<0>. If the message did not appear in the log within the time out period, -- cgit v1.2.1