From: Sebastian Harl Date: Sat, 6 Oct 2007 19:29:24 +0000 (+0200) Subject: Added README.Debian.plugins.in and gen_plugin_deps.pl. X-Git-Tag: collectd-4.2.0-1~21 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=113b61864abec15606317396446d6bf36178966f;p=pkg-collectd.git Added README.Debian.plugins.in and gen_plugin_deps.pl. The script gen_plugin_deps.pl generates a list of dependencies for each plugin requiring anything besides libc6. README.Debian.plugins.in and this list are then used to create README.Debian.plugins which is included in the collectd binary package. --- diff --git a/debian/README.Debian b/debian/README.Debian index c3e7c13..053592b 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -4,9 +4,10 @@ collectd on Debian General notes: -------------- -- This package is split up into several packages to prevent you from having to - install dependencies that you don't actually need. Any plugin that has - dependencies other than libc gets its own package. +- Some plugins require additional libraries. To prevent you from having to + install dependencies that you don't actually need those libraries are + recommendations rather than dependencies. See README.Debian.plugins in the + "collectd" package for details. Configuring collectd: --------------------- diff --git a/debian/README.Debian.plugins.in b/debian/README.Debian.plugins.in new file mode 100644 index 0000000..b1ecd67 --- /dev/null +++ b/debian/README.Debian.plugins.in @@ -0,0 +1,17 @@ +collectd plugins on Debian +========================== + +Some plugins require additional libraries. To prevent you from having to +install dependencies that you don't actually need those libraries are +recommendations rather than dependencies. + +apt-get(8) and aptitude(8) will install recommended packages automatically by +default. If you did not disable this feature you will have everything in place +to operate all plugins. Else you have to install missing dependencies manually +(see the section "Plugin dependencies" below). + +Plugin dependencies: +-------------------- + +@PLUGIN_DEPS@ + diff --git a/debian/gen_plugin_deps.pl b/debian/gen_plugin_deps.pl new file mode 100755 index 0000000..77ea6d3 --- /dev/null +++ b/debian/gen_plugin_deps.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl +# +# collectd - gen_plugin_deps.pl +# Copyright (C) 2007 Sebastian Harl +# +# 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; only version 2 of the License is applicable. +# +# 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, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Author: +# Sebastian Harl + +use strict; +use warnings; + +my $infile = "debian/README.Debian.plugins.in"; +my $outfile = "debian/README.Debian.plugins"; + +my ($ifile, $ofile); + +if (! open($ifile, "<", $infile)) { + print STDERR "Could not open file '$infile': $!\n"; + exit 1; +} + +if (! open($ofile, ">", $outfile)) { + print STDERR "Could not open file '$outfile': $!\n"; + exit 1; +} + +while (my $line = <$ifile>) { + if ($line !~ m/^\@PLUGIN_DEPS\@\n$/) { + print $ofile $line; + } + else { + print_plugin_deps($ofile); + } +} + +close($ofile); +close($ifile); + +sub print_plugin_deps +{ + my $fh = shift; + my $pdir = undef; + my $i = 0; + + my $plugindir = "debian/collectd/usr/lib/collectd/"; + + if (! opendir($pdir, $plugindir)) { + print STDERR "Could not open directory '$plugindir': $!\n"; + exit 1; + } + + foreach my $dirent (sort readdir($pdir)) { + if ($dirent !~ m/^(\w+).so$/) { + next; + } + + my $name = $1; + my $deps = `dpkg-shlibdeps -O $plugindir/$dirent`; + + chomp $deps; + + $deps =~ s/^shlibs:Depends=//; + + my @deps = grep !m/^libc6\b/, split m/, /, $deps; + + if (scalar @deps) { + if (0 < $i) { + print $fh "\n"; + } + + ++$i; + + print $fh "$name:\n"; + foreach my $dep (@deps) { + print $fh " * $dep\n"; + } + } + } +} + +# vim: set tw=78 sw=4 ts=4 noexpandtab : + diff --git a/debian/rules b/debian/rules index 8c5c9cc..071908a 100755 --- a/debian/rules +++ b/debian/rules @@ -58,6 +58,8 @@ clean: unpatch -$(MAKE) distclean + rm -f debian/README.Debian.plugins + dh_clean debconf-updatepo @@ -91,6 +93,8 @@ install-arch: build for UTIL in extractDS.px migrate-3-4.px; do \ cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \ done + + perl ./debian/gen_plugin_deps.pl binary-indep: install-indep dh_testdir @@ -111,7 +115,7 @@ binary-arch: build install-arch dh_testroot dh_installchangelogs -a ChangeLog dh_installdocs -A -a debian/README.Debian AUTHORS README TODO - dh_installdocs -a debian/NEWS.Debian + dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \ contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/ dh_installdebconf -a