summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 113b618)
raw | patch | inline | side by side (parent: 113b618)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 6 Oct 2007 19:32:16 +0000 (21:32 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 6 Oct 2007 19:32:16 +0000 (21:32 +0200) |
debian/bin/check_plugins.pl | [new file with mode: 0755] | patch | blob |
debian/bin/gen_plugin_deps.pl | [new file with mode: 0755] | patch | blob |
debian/check_plugins.pl | [deleted file] | patch | blob | history |
debian/gen_plugin_deps.pl | [deleted file] | patch | blob | history |
debian/rules | patch | blob | history |
diff --git a/debian/bin/check_plugins.pl b/debian/bin/check_plugins.pl
--- /dev/null
@@ -0,0 +1,158 @@
+#!/usr/bin/perl --
+#
+# collectd - check_plugins.pl
+# Copyright (C) 2006, 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 <sh at tokkee.org>
+
+# This script checks each plugin and reports the address of each plugin's
+# registered functions. It uses src/.libs/*.so for its checks. This can be
+# used to check what kind of operations each plugin supports after it has been
+# built.
+
+use strict;
+use warnings;
+
+my $srcdir = 'src/';
+my $libdir = 'src/.libs';
+
+my $plugins = {};
+
+my ($srcs, $libs) = (undef, undef);
+
+if (! opendir($srcs, $srcdir)) {
+ print STDERR "Could not open directory '$srcdir': $!\n"
+ . "Make sure you are in the toplevel source directory.\n";
+ exit 1;
+}
+
+while (my $dirent = readdir($srcs)) {
+ if ($dirent !~ m/^(.*)\.c$/) {
+ next;
+ }
+
+ my $name = $1;
+ my $src = undef;
+
+ if (! open($src, "<", "$srcdir/$dirent")) {
+ print STDERR "Unable to open '$srcdir/$dirent': $!\n";
+ next;
+ }
+
+ while (my $line = <$src>) {
+ if ($line =~ m/plugin_register_(\w+)\s*\("([^"]+)",\s*(\w+)/) {
+ my ($t, $n, $f) = ($1, $2, $3);
+
+ $plugins->{$name}->{$n}->{$t} = $f;
+ }
+ }
+
+ close($src);
+} # while (my $dirent = readdir($srcs))
+
+closedir($srcs);
+
+if (! opendir($libs, $libdir)) {
+ print STDERR "Could not open directory '$libdir': $!\n"
+ . "Make sure you ran 'make'.\n";
+ exit 1;
+}
+
+while (my $dirent = readdir($libs)) {
+ if ($dirent !~ m/^(.*)\.so$/) {
+ next;
+ }
+
+ my $name = $1;
+ my $nm = undef;
+
+ if (! defined $plugins->{$name}) {
+ print STDERR "No information available for plugin '$name'!\n";
+ next;
+ }
+
+ if (! open($nm, "-|", "nm $libdir/$dirent")) {
+ print STDERR "Unable to open pipe from nm(1): $!\n";
+ next;
+ }
+
+ while (my $line = <$nm>) {
+ if ($line !~ m/^([0-9a-fA-F]{8,}) [tT] (\w+)$/) {
+ next;
+ }
+
+ my $adr = $1;
+ my $sym = $2;
+
+ for my $n (keys %{$plugins->{$name}}) {
+ for my $t (keys %{$plugins->{$name}->{$n}}) {
+ if (defined $plugins->{$name}->{$n}->{$t}
+ && ($sym eq $plugins->{$name}->{$n}->{$t})) {
+ $plugins->{$name}->{$n}->{$t} = "0x" . $adr;
+ }
+ }
+ }
+ }
+
+ close($nm);
+} # while (my $dirent = readdir($libs))
+
+closedir($libs);
+
+print 'plugin name config init read write log shutdown';
+print $/ . '-' x 70 . $/;
+
+for my $name (sort keys %$plugins) {
+ if (! -f "$libdir/$name.so") {
+ print "$name.c has not been compiled.\n";
+ next;
+ }
+
+ for my $n (sort keys %{$plugins->{$name}}) {
+ dump_plugin_data($n, $plugins->{$name}->{$n});
+ }
+}
+
+exit 0;
+
+sub dump_plugin_data {
+ my $name = shift || return;
+ my $funcs = shift || return;
+
+ if (length($name) > 15) {
+ $name = substr($name, 0, 12) . '...';
+ }
+
+ printf '%-15s ', $name;
+
+ foreach my $t ("config", "init", "read", "write", "log", "shutdown") {
+ if (! defined $funcs->{$t}) {
+ print '- ';
+ }
+ elsif ($funcs->{$t} =~ m/^0x[A-Fa-f0-9]{8,}$/) {
+ print substr($funcs->{$t}, -8, 8) . " ";
+ }
+ else {
+ print 'nA ';
+ }
+ }
+
+ print $/;
+ return 1;
+} # sub dump_plugin_data
+
+# vim: set sw=4 ts=4 tw=78 noexpandtab :
diff --git a/debian/bin/gen_plugin_deps.pl b/debian/bin/gen_plugin_deps.pl
--- /dev/null
@@ -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 <sh at tokkee.org>
+
+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/check_plugins.pl b/debian/check_plugins.pl
--- a/debian/check_plugins.pl
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/perl --
-#
-# collectd - check_plugins.pl
-# Copyright (C) 2006, 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 <sh at tokkee.org>
-
-# This script checks each plugin and reports the address of each plugin's
-# registered functions. It uses src/.libs/*.so for its checks. This can be
-# used to check what kind of operations each plugin supports after it has been
-# built.
-
-use strict;
-use warnings;
-
-my $srcdir = 'src/';
-my $libdir = 'src/.libs';
-
-my $plugins = {};
-
-my ($srcs, $libs) = (undef, undef);
-
-if (! opendir($srcs, $srcdir)) {
- print STDERR "Could not open directory '$srcdir': $!\n"
- . "Make sure you are in the toplevel source directory.\n";
- exit 1;
-}
-
-while (my $dirent = readdir($srcs)) {
- if ($dirent !~ m/^(.*)\.c$/) {
- next;
- }
-
- my $name = $1;
- my $src = undef;
-
- if (! open($src, "<", "$srcdir/$dirent")) {
- print STDERR "Unable to open '$srcdir/$dirent': $!\n";
- next;
- }
-
- while (my $line = <$src>) {
- if ($line =~ m/plugin_register_(\w+)\s*\("([^"]+)",\s*(\w+)/) {
- my ($t, $n, $f) = ($1, $2, $3);
-
- $plugins->{$name}->{$n}->{$t} = $f;
- }
- }
-
- close($src);
-} # while (my $dirent = readdir($srcs))
-
-closedir($srcs);
-
-if (! opendir($libs, $libdir)) {
- print STDERR "Could not open directory '$libdir': $!\n"
- . "Make sure you ran 'make'.\n";
- exit 1;
-}
-
-while (my $dirent = readdir($libs)) {
- if ($dirent !~ m/^(.*)\.so$/) {
- next;
- }
-
- my $name = $1;
- my $nm = undef;
-
- if (! defined $plugins->{$name}) {
- print STDERR "No information available for plugin '$name'!\n";
- next;
- }
-
- if (! open($nm, "-|", "nm $libdir/$dirent")) {
- print STDERR "Unable to open pipe from nm(1): $!\n";
- next;
- }
-
- while (my $line = <$nm>) {
- if ($line !~ m/^([0-9a-fA-F]{8,}) [tT] (\w+)$/) {
- next;
- }
-
- my $adr = $1;
- my $sym = $2;
-
- for my $n (keys %{$plugins->{$name}}) {
- for my $t (keys %{$plugins->{$name}->{$n}}) {
- if (defined $plugins->{$name}->{$n}->{$t}
- && ($sym eq $plugins->{$name}->{$n}->{$t})) {
- $plugins->{$name}->{$n}->{$t} = "0x" . $adr;
- }
- }
- }
- }
-
- close($nm);
-} # while (my $dirent = readdir($libs))
-
-closedir($libs);
-
-print 'plugin name config init read write log shutdown';
-print $/ . '-' x 70 . $/;
-
-for my $name (sort keys %$plugins) {
- if (! -f "$libdir/$name.so") {
- print "$name.c has not been compiled.\n";
- next;
- }
-
- for my $n (sort keys %{$plugins->{$name}}) {
- dump_plugin_data($n, $plugins->{$name}->{$n});
- }
-}
-
-exit 0;
-
-sub dump_plugin_data {
- my $name = shift || return;
- my $funcs = shift || return;
-
- if (length($name) > 15) {
- $name = substr($name, 0, 12) . '...';
- }
-
- printf '%-15s ', $name;
-
- foreach my $t ("config", "init", "read", "write", "log", "shutdown") {
- if (! defined $funcs->{$t}) {
- print '- ';
- }
- elsif ($funcs->{$t} =~ m/^0x[A-Fa-f0-9]{8,}$/) {
- print substr($funcs->{$t}, -8, 8) . " ";
- }
- else {
- print 'nA ';
- }
- }
-
- print $/;
- return 1;
-} # sub dump_plugin_data
-
-# vim: set sw=4 ts=4 tw=78 noexpandtab :
diff --git a/debian/gen_plugin_deps.pl b/debian/gen_plugin_deps.pl
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/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 <sh at tokkee.org>
-
-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 071908a8054ceaba641236d620b35c4e13a9a528..cee782004fef76510c93cb9b2490e19f75ec703c 100755 (executable)
--- a/debian/rules
+++ b/debian/rules
dh_testdir
$(MAKE)
- perl ./debian/check_plugins.pl
+ perl ./debian/bin/check_plugins.pl
touch build-stamp
cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
done
- perl ./debian/gen_plugin_deps.pl
+ perl ./debian/bin/gen_plugin_deps.pl
binary-indep: install-indep
dh_testdir