[Nagiosplug-checkins] SF.net SVN: nagiosplug: [1777] nagiosplug/trunk

tonvoon at users.sourceforge.net tonvoon at users.sourceforge.net
Thu Sep 13 13:36:57 CEST 2007


Revision: 1777
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1777&view=rev
Author:   tonvoon
Date:     2007-09-13 04:36:57 -0700 (Thu, 13 Sep 2007)

Log Message:
-----------
Adding in optional Nagios::Plugin perl module (and
dependencies) compilation and installation

Modified Paths:
--------------
    nagiosplug/trunk/Makefile.am
    nagiosplug/trunk/configure.in

Added Paths:
-----------
    nagiosplug/trunk/perlmods/
    nagiosplug/trunk/perlmods/Class-Accessor-0.31.tar.gz
    nagiosplug/trunk/perlmods/Config-Tiny-2.10.tar.gz
    nagiosplug/trunk/perlmods/Makefile.am
    nagiosplug/trunk/perlmods/Math-Calc-Units-1.06.tar.gz
    nagiosplug/trunk/perlmods/Nagios-Plugin-0.20.tar.gz
    nagiosplug/trunk/perlmods/Params-Validate-0.88.tar.gz
    nagiosplug/trunk/perlmods/Test-Simple-0.70.tar.gz
    nagiosplug/trunk/perlmods/install_order
    nagiosplug/trunk/tools/build_perl_modules

Modified: nagiosplug/trunk/Makefile.am
===================================================================
--- nagiosplug/trunk/Makefile.am	2007-09-05 07:39:09 UTC (rev 1776)
+++ nagiosplug/trunk/Makefile.am	2007-09-13 11:36:57 UTC (rev 1777)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = gl lib plugins plugins-scripts plugins-root po
+SUBDIRS = gl lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@
 
 EXTRA_DIST = config.rpath \
 	ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CODING FAQ LEGAL NEWS \
@@ -23,8 +23,9 @@
 
 test:
 	cd lib && $(MAKE) test
-	cd plugins; $(MAKE) test
-	cd plugins-scripts; $(MAKE) test
+	if test "$(PERLMODS_DIR)" != ""; then cd perlmods && $(MAKE) test; fi
+	cd plugins && $(MAKE) test
+	cd plugins-scripts && $(MAKE) test
 
 nagios-plugins.spec: nagios-plugins.spec.in
 	sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@

Modified: nagiosplug/trunk/configure.in
===================================================================
--- nagiosplug/trunk/configure.in	2007-09-05 07:39:09 UTC (rev 1776)
+++ nagiosplug/trunk/configure.in	2007-09-13 11:36:57 UTC (rev 1777)
@@ -1503,6 +1503,16 @@
 	AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
 fi
 
+dnl Perl modules
+AC_ARG_ENABLE(perl-modules,
+	AC_HELP_STRING([--enable-perl-modules], 
+		[Enables installation of Nagios::Plugin and its dependencies (default: no)]),
+	[enable_perl_modules=$enableval],
+	[enable_perl_modules=no])
+if test "$enable_perl_modules" = "yes" ; then
+  AC_SUBST(PERLMODS_DIR,perlmods)
+fi
+
 dnl External libraries - see ACKNOWLEDGEMENTS
 gl_INIT
 
@@ -1521,6 +1531,7 @@
   plugins-scripts/subst 
   plugins-scripts/utils.pm 
   plugins-scripts/utils.sh 
+  perlmods/Makefile
   command.cfg 
   test.pl 
   pkg/solaris/pkginfo 
@@ -1558,6 +1569,7 @@
 ACX_FEATURE([with],[openssl])
 ACX_FEATURE([with],[gnutls])
 ACX_FEATURE([with],[perl])
+ACX_FEATURE([enable],[perl-modules])
 ACX_FEATURE([with],[cgiurl])
 ACX_FEATURE([with],[trusted-path])
 

Added: nagiosplug/trunk/perlmods/Class-Accessor-0.31.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Class-Accessor-0.31.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/Config-Tiny-2.10.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Config-Tiny-2.10.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/Makefile.am
===================================================================
--- nagiosplug/trunk/perlmods/Makefile.am	                        (rev 0)
+++ nagiosplug/trunk/perlmods/Makefile.am	2007-09-13 11:36:57 UTC (rev 1777)
@@ -0,0 +1,13 @@
+perlmoduledir = $(exec_prefix)/perl
+
+all-local:
+	$(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -m .
+
+install-exec-local:
+	$(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -i .
+
+test:
+	$(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -t .
+
+clean-local:
+	$(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -c .

Added: nagiosplug/trunk/perlmods/Math-Calc-Units-1.06.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Math-Calc-Units-1.06.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/Nagios-Plugin-0.20.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Nagios-Plugin-0.20.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/Params-Validate-0.88.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Params-Validate-0.88.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/Test-Simple-0.70.tar.gz
===================================================================
(Binary files differ)


Property changes on: nagiosplug/trunk/perlmods/Test-Simple-0.70.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: nagiosplug/trunk/perlmods/install_order
===================================================================
--- nagiosplug/trunk/perlmods/install_order	                        (rev 0)
+++ nagiosplug/trunk/perlmods/install_order	2007-09-13 11:36:57 UTC (rev 1777)
@@ -0,0 +1,7 @@
+# Modules installed in this order
+Test-Simple
+Params-Validate
+Math-Calc-Units
+Class-Accessor
+Config-Tiny
+Nagios-Plugin

Added: nagiosplug/trunk/tools/build_perl_modules
===================================================================
--- nagiosplug/trunk/tools/build_perl_modules	                        (rev 0)
+++ nagiosplug/trunk/tools/build_perl_modules	2007-09-13 11:36:57 UTC (rev 1777)
@@ -0,0 +1,86 @@
+#!/usr/bin/perl
+# SYNTAX:
+#	build_perl_modules -d dest_dir [-c] [-m] [-t] [-i] tarball_dir
+#
+# DESCRIPTION:
+#	Installs perl modules found in tarball_dir
+#	Expects a file called install_order, containing one line per distribution name
+#	Will take action against each distribution in turn
+#	-d is a necessary destination directory for the perl mods
+#	If -c is set, will remove the module build directories and exit
+#	If -m is set, will run perl Makefile.PL and make
+#	If -t is set, will run make test
+#	If -i is set, will run make install
+#	Options are discrete. This is because an overall ./configure, make, make test, make install
+#	are run in different invocations. Obviously, you can't run a -t without a -m, but there's no
+#	checking here for that
+
+# Can only use base modules
+use warnings;
+use strict;
+use Config;
+use Getopt::Std;
+use Cwd;
+use File::Path;
+
+my $opts = {};
+getopts('d:cmti', $opts) || die "Invalid options";
+my $moddir = shift @ARGV or die "Must specify a directory where tarballs exist";
+
+my $destdir = $opts->{d};
+die "Must set a destination directory" unless $destdir;
+
+chdir $moddir or die "Cannot change to $moddir";
+open F, "install_order" or die "Cannot open install_order file";
+my @files = grep { ! /^#/ && chop } <F>;
+close F;
+
+my @tarballs;
+foreach my $f (@files) {
+	# Needs to be better. Also, what if there are two with same name?
+	my $tarball;
+	eval '$tarball = <'."$f".'*.tar.gz>';
+	die unless ($tarball);
+	print "Got $f, with file: $tarball",$/;
+	push @tarballs, $tarball;
+	(my $dir = $tarball) =~ s/\.tar.gz//;
+	# Need to do cleaning before doing each module in turn
+	if ($opts->{c}) {
+		print "Cleaning $dir",$/;
+		rmtree($dir);
+	}
+}
+
+if ($opts->{c}) {
+	print "Finished cleaning",$/;
+	exit;
+}
+
+my $topdir = cwd();
+foreach my $tarball (@tarballs) {
+	(my $dir = $tarball) =~ s/\.tar.gz//;
+	if ($opts->{m}) {
+		# Don't compile if already done - this is because of invocating this
+		# script at different stages
+		unless (-e $dir) {
+			system("gunzip -c $tarball | tar -xf -") == 0 or die "Cannot extract $tarball";
+			chdir $dir or die "Can't chdir into $dir";
+			system("perl Makefile.PL PREFIX=$destdir INSTALLDIRS=site LIB=$destdir/lib") == 0 or die "Can't run perl Makefile.PL";
+			system("make") == 0 or die "Can't run make";
+			chdir $topdir or die "Can't chdir to top";;
+		}
+	}
+
+	chdir $dir or die "Can't chdir into $dir";
+
+	# Need to add this so this module is found for subsequent ones
+	$ENV{PERL5LIB}="$topdir/$dir/blib/lib:$ENV{PERL5LIB}";
+
+	if ($opts->{t}) {
+		system("make test") == 0 or die "Can't run make test failed";
+	}
+	if ($opts->{i}) {
+		system("make install SITEPREFIX=$destdir") == 0 or die "Can't run make install";
+	}
+	chdir $topdir or die "Can't go back to $topdir";
+}


Property changes on: nagiosplug/trunk/tools/build_perl_modules
___________________________________________________________________
Name: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list