summaryrefslogtreecommitdiffstats
path: root/tools/checkusedmodules
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-23 15:17:59 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-23 15:17:59 +0000
commit5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f (patch)
treeb57bf9a086f96a9de4af2bf5549614f792def76a /tools/checkusedmodules
parent42ae4ada630b554a98e0e99f623f305040bc77cc (diff)
downloaddrakx-5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f.tar
drakx-5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f.tar.gz
drakx-5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f.tar.bz2
drakx-5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f.tar.xz
drakx-5a9c35b61ed5eef7fda4b46cfa6fe37201dc837f.zip
Add a new check script in tools. It compares the perl modules used by the .pm
files in perl-install against the ones listed in share/list, to detect potential missing modules (and potential run-time problems during the stage 2)
Diffstat (limited to 'tools/checkusedmodules')
-rwxr-xr-xtools/checkusedmodules22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/checkusedmodules b/tools/checkusedmodules
new file mode 100755
index 000000000..433ed54d9
--- /dev/null
+++ b/tools/checkusedmodules
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script compares the perl modules used by the .pm files in perl-install
+# against the ones listed in share/list, to detect potential missing modules
+# (and potential run-time problems during the stage 2)
+
+cd ../perl-install || exit 1;
+
+# list of used .pm files
+find . -name '*.pm' -not -name b_dump_strings.pm -not -path ./interactive/http.pm | \
+ xargs perl -lne '/^\s*(use|require)\s+([\w:]+)/ && print $2' | sort -u > /tmp/gi-used-pm
+
+# list of .pm files included in install
+perl -lne 'm{/(?:PERL_VERSION|ARCH-linux|vendor_perl/\*)/([\w/]+)\.pm$} and $_=$1, s,/,::,g, print' share/list > /tmp/gi-found-pm0
+find . -name blib -prune -o -name '*.pm' | perl -ne 's,^\./,,; s/\.pm$// or next; s,/,::,g; print' >> /tmp/gi-found-pm0
+
+# compute difference
+sort -u /tmp/gi-found-pm0 > /tmp/gi-found-pm
+diff -u /tmp/gi-{used,found}-pm | perl -lne 'BEGIN{print"Unpackaged modules:"} s/^-(?!-)/ / && print'
+
+# cleanup
+rm -f /tmp/gi-used-pm /tmp/gi-found-pm{,0}