summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjasonjayr <jasonjayr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-29 04:55:06 +0000
committerjasonjayr <jasonjayr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-29 04:55:06 +0000
commitfda00ca36161398bc22c4dd230956c9351fcdd4e (patch)
treea973f923af607901d5c42d70954b6bcf59c50713
parent74f62b00367f7da37b7c860259116e4c4f970202 (diff)
Added the devel directory, for Builder + developer utilities
Added the find-use script, to locate all the perl modules we use that are not distributed with perl itself. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@373 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xutils/devel/find-use59
1 files changed, 59 insertions, 0 deletions
diff --git a/utils/devel/find-use b/utils/devel/find-use
new file mode 100755
index 00000000..fa2014f0
--- /dev/null
+++ b/utils/devel/find-use
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -w
+=head1 NAME
+
+find-use
+
+=head1 EXAMPLE
+
+ ~/ledgersmb # utils/devel/find-use
+ 0.000000 : HTML::Entities
+ 0.000000 : Locale::Maketext::Lexicon
+ 0.000000 : Module::Build
+ ...
+
+=head1 EXPLINATION
+
+This util is useful for package builders to identify all the CPAN dependencies we've made. It required Module::CoreList (which is core, but is not yet in any stable
+release of perl) to determine if a module is distributed with perl or not. The output reports which version of perl the module is in. If it reports 0.000000, then the
+module is not in core perl, and needs to be installed before LedgerSMB will operate.
+
+=head1 AUTHOR
+
+http://www.ledgersmb.org/ - The LedgerSMB team
+
+=head1 LICENSE
+
+Distributed under the terms of the LedgerSMB code.
+
+=cut
+
+
+use strict;
+use warnings;
+
+open GREP, "grep -r '^use ' . |";
+use Module::CoreList;
+
+my %uselines;
+while(<GREP>) {
+ next if /LedgerSMB::/;
+ next if /use warnings/;
+ next if /use strict/;
+ next if /use vars/;
+ chomp;
+ my ($file, $useline) = m/^([^:]+):use\s(.*?)$/;
+ $uselines{$useline}||=[];
+ push @{$uselines{$useline}}, $file;
+}
+
+my %modules;
+foreach my $useline (keys %uselines) {
+
+ my ($module) = grep { $_ } $useline =~ /(?:base ['"]([a-z:]+)|([a-z:]+)(?:\s|;))/i;
+ my $version = Module::CoreList->first_release($module);
+ $modules{$module} = $version||0;
+}
+
+foreach my $mod (sort { $modules{$a} == 0 ? -1 : $modules{$b} == 0 ? 1 : 0 or $a cmp $b } keys %modules) {
+ printf "%2.6f : %s\n", $modules{$mod}, $mod;
+}