jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [tools/] [checklibs.pl] - Blame information for rev 10

 

Line No. Rev Author Line
11simandl#!/usr/bin/env perl
2 
3use warnings;
4use diagnostics;
5use strict;
6 
7use Cwd;
8 
9my $mydir=Cwd::cwd();
10my @path= split /\//,$mydir;
11my $subdir=pop @path;
12my $subsubdir=pop @path;
13 
14my $modname="";
15my $type="";
16 
17 
18if ($subdir eq "lib") { $type="lib"; }
19if ($subdir eq "modules") { $type="allmods"; }
20if ($subdir eq "platform") { $type="module"; $modname=$subsubdir; chdir ".."; }
21if ($subsubdir eq "modules") { $type="module"; $modname=$subdir; }
22if ((-d "lib") and (-d "modules") and (-d "tools")) { $type="everything"; }
23 
24print "$type\n";
25 
26if ($type eq "module") { check_module($modname); }
27elsif ($type eq "allmods") { check_all_mods(); }
28elsif ($type eq "lib") { check_main_libs(); }
29elsif ($type eq "everything") { chdir "lib"; check_main_libs(); chdir "../modules"; check_all_mods(); }
30 
31 
32 
33sub check_module {
34 my $modname=shift;
35 print "CHECKING MODULE ",uc $modname,"\n";
36 opendir DIR,"./platform";
37 my @files= grep /\.pm$/,readdir DIR;
38 closedir DIR;
39 use lib "./platform";
40 foreach my $nn (@files) {
41 chomp $nn;
42 print " $modname/$nn\n";
43 require "$nn";
44 if ($nn ne "common.pm") {
45 scrub_package("HotSaNICmod");
46 scrub_package("syssnmp");
47 }
48 }
49 print "\n";
50 }
51 
52 
53sub check_all_mods {
54 opendir DIR,".";
55 my @modules = grep !/\.|CVS/,readdir DIR;
56 closedir DIR;
57 foreach my $modname (@modules) {
58 if (-d $modname) {
59 print $modname;
60 chdir $modname;
61 check_module($modname);
62 chdir "..";
63 }
64 }
65 }
66 
67 
68sub check_main_libs {
69 print "CHECKING MAIN LIBRARIES\n";
70 opendir DIR,".";
71 my @files= grep /\.pm$/,readdir DIR;
72 closedir DIR;
73 chdir "CVS";
74 use lib "..";
75 foreach my $nn (@files) {
76 chomp $nn;
77 print " $nn\n";
78 require "$nn";
79 }
80 chdir "..";
81 print "\n";
82 }
83 
84 
85sub scrub_package {
86 no strict 'refs';
87 my $pack = shift;
88 die "Shouldn't delete main package"
89 if $pack eq "" || $pack eq "main";
90 my $stash = *{$pack . '::'}{HASH};
91 my $name;
92 foreach $name (keys %$stash) {
93 my $fullname = $pack . '::' . $name;
94 # Get rid of everything with that name.
95 undef $$fullname;
96 undef @$fullname;
97 undef %$fullname;
98 undef &$fullname;
99 undef *$fullname;
100 }
101 }
102 

Powered by WebSVN 2.2.1