X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Ffind-use.pl;h=61bfff751096c2060367bb7a373bbd4bf436f17e;hb=90a1b6fad6aeeab84fc96d6511fdf42fff315df5;hp=f65143ee6e388350cf3ec1431cd3cacc2d0a6a51;hpb=26a34e3320547212a2718d8de05da44bd14f6b47;p=kivitendo-erp.git diff --git a/scripts/find-use.pl b/scripts/find-use.pl index f65143ee6..61bfff751 100755 --- a/scripts/find-use.pl +++ b/scripts/find-use.pl @@ -1,10 +1,20 @@ #!/usr/bin/perl -l + +BEGIN { + use FindBin; + + unshift(@INC, $FindBin::Bin . '/../modules/override'); # Use our own versions of various modules (e.g. YAML). + push (@INC, $FindBin::Bin . '/..'); # '.' will be removed from @INC soon. + push (@INC, $FindBin::Bin . '/../modules/fallback'); # Only use our own versions of modules if there's no system version. +} + use strict; #use warnings; # corelist and find throw tons of warnings use File::Find; use Module::CoreList; use SL::InstallationCheck; use Term::ANSIColor; +use Getopt::Long; my (%uselines, %modules, %supplied, %requires); @@ -20,6 +30,9 @@ my (%uselines, %modules, %supplied, %requires); 'Rose::DB::Object::ConventionManager' => 1, 'Rose::DB::Object::Manager' => 1, 'Rose::DB::Object::Metadata' => 1, + 'Rose::DB::Object::Helpers' => 1, + 'Rose::DB::Object::Util' => 1, + 'Rose::DB::Object::Constants' => 1, }, 'Rose::Object' => { 'Rose::Object::MakeMethods::Generic' => 1, @@ -31,16 +44,42 @@ my (%uselines, %modules, %supplied, %requires); 'Template::Plugin' => 1, 'Template::Plugin::Filter' => 1, 'Template::Plugin::HTML' => 1, + 'Template::Stash' => 1, }, 'Devel::REPL' => { 'namespace::clean' => 1, - } + }, + 'Email::MIME' => { + 'Email::MIME::Creator' => 1, + }, + 'Test::Harness' => { + 'TAP::Parser' => 1, + 'TAP::Parser::Aggregator' => 1, + }, + 'Archive::Zip' => { + 'Archive::Zip::Member' => 1, + }, + 'HTML::Parser' => { + 'HTML::Entities' => 1, + }, + 'URI' => { + 'URI::Escape' => 1, + }, + 'File::MimeInfo' => { + 'File::MimeInfo::Magic' => 1, + }, ); +GetOptions( + 'files-with-match|l' => \ my $l, +); + +chmod($FindBin::Bin . '/..'); + find(sub { return unless /(\.p[lm]|console)$/; - # remember modules shipped with Lx-Office + # remember modules shipped with kivitendo $supplied{modulize($File::Find::name)}++ if $File::Find::dir =~ m#modules/#; @@ -51,6 +90,7 @@ find(sub { next if /SL::/; next if /Support::Files/; # our own test support module next if /use (warnings|strict|vars|lib|constant|utf8)/; + next if /^use (with|the)/; my ($useline) = m/^use\s+(.*?)$/; @@ -101,6 +141,11 @@ for my $useline (keys %uselines) { } } +# have all documented modules mentioned here +$modules{$_->{name}} ||= { status => 'required' } for @SL::InstallationCheck::required_modules; +$modules{$_->{name}} ||= { status => 'optional' } for @SL::InstallationCheck::optional_modules; +$modules{$_->{name}} ||= { status => 'developer' } for @SL::InstallationCheck::developer_modules; + # build transitive closure for documented dependancies my $changed = 1; while ($changed) { @@ -118,8 +163,12 @@ while ($changed) { } } -print sprintf "%8s : %s (%s)", color_text($modules{$_}->{status}), $_, join(' ', @{ $modules{$_}->{files} || [] }) - for sort { +do { + print sprintf "%8s : %s", color_text($modules{$_}->{status}), $_; + if ($l) { + print " $_" for @{ $modules{$_}->{files} || [] }; + } +} for sort { $modules{$a}->{status} cmp $modules{$b}->{status} || $a cmp $b } keys %modules; @@ -175,7 +224,6 @@ find-use =head1 EXAMPLE # perl scipts/find-use.pl - !missing : Perl::Tags !missing : Template::Constants !missing : DBI @@ -221,5 +269,3 @@ Sven Schöling Es.schoeling@linet-services.deE Distributed under the terms of the GNU General Public License v2. =cut - -