IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30885


Ignore:
Timestamp:
Mar 13, 2011, 5:00:00 PM (15 years ago)
Author:
eugene
Message:

adding a new tagset for updated darwin builds; adding verbosity to pscheckmods

Location:
branches/eam_branches/ipp-20110213/psconfig
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psconfig/pscheckmods

    r28191 r30885  
    11#!/usr/bin/env perl
    22
     3$VERBOSE = 0;
     4if (@ARGV > 2 && $ARGV[0] eq "-v") {
     5    $VERBOSE = 1;
     6    shift @ARGV;
     7}
    38if (@ARGV != 2) { die "USAGE: pscheckmods (module) (version)\n"; }
    49
    5 # print STDERR "checking in @INC\n";
     10if ($VERBOSE) { print STDERR "checking in @INC\n"; }
     11
     12# &detailed_require ($ARGV[0]);
    613
    714$x = eval "require $ARGV[0]; 1";
    815if (! $x) {
    9     # print "$ARGV[0]: missing\n";
    10     exit 1;
     16    if (! $VERBOSE) { exit 1; }
     17    print "$ARGV[0]: missing\n";
     18    &detailed_require ($ARGV[0]);
    1119}
    12 # print "x: $x\n";
     20if ($VERBOSE) { print "x: $x\n"; }
    1321
    1422$version = eval "\$$ARGV[0]::VERSION";
     
    2129
    2230exit 0;
     31
     32sub detailed_require {
     33    my ($filename) = @_;
     34    $filename =~ s|::|/|g;
     35    $filename = "$filename.pm";
     36    print "$filename\n";
     37    if (exists $INC{$filename}) {
     38        return 1 if $INC{$filename};
     39        die "Compilation failed in require";
     40    }
     41    my ($realfilename,$result);
     42  ITER: {
     43      foreach $prefix (@INC) {
     44          $realfilename = "$prefix/$filename";
     45          print "$realfilename\n";
     46          if (-f $realfilename) {
     47              $INC{$filename} = $realfilename;
     48              $result = do $realfilename;
     49              last ITER;
     50          }
     51      }
     52      die "Can't find $filename in \@INC";
     53    }
     54    if ($@) {
     55        $INC{$filename} = undef;
     56        die $@;
     57    } elsif (!$result) {
     58        delete $INC{$filename};
     59        die "$filename did not return true value";
     60    } else {
     61        return $result;
     62    }
     63}
Note: See TracChangeset for help on using the changeset viewer.