Changeset f5e593b3a2875895dd7e3f4489b4435f7712c831

Show
Ignore:
Timestamp:
05/14/09 14:12:39 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1242310359 +0000
git-parent:

[88a71780101cbf23034aa0cb840f9f0368fda2dd]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1242310359 +0000
Message:

make the license check support include pattern or exclude pattern and default to include 'unknown', refs #126

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • buildtools/license-audit

    r88a7178 rf5e593b  
    11#!/usr/bin/perl 
    22 
     3use Getopt::Long; 
    34use File::Find; 
    45use strict; 
     6 
     7my $include_re = undef; 
     8my $exclude_re = undef; 
     9 
     10GetOptions("i=s" => \$include_re, 
     11           "x=s" => \$exclude_re); 
     12die "-i or -x, not both\n", if(defined($include_re) && defined($exclude_re)); 
     13$exclude_re = qr/$exclude_re/ if defined($exclude_re); 
     14$include_re ||= 'unknown' unless defined($exclude_re); 
     15$include_re = qr/$include_re/ if defined($include_re); 
    516 
    617my %licenses = ( 
     
    220231  if($fname =~ /\.(?:c|h|java|cpp|hpp|C|s|lua)$/) { 
    221232    my $license = detect_license($fname); 
    222     print "$fname -> ($license)\n"; 
     233    if(($include_re && $license =~ $include_re) || 
     234       ($exclude_re && $license !~ $exclude_re)) { 
     235      print "$fname -> ($license)\n"; 
     236    } 
    223237  } 
    224238  return 1;