Allow packages in fatpack-whitelists

This commit is contained in:
Simon Schuster 2016-09-06 14:46:09 +02:00
parent 1bec9a01e3
commit 874209c804

View file

@ -14,14 +14,12 @@ my $truncate = '';
my $inputfile; my $inputfile;
my $usage=''; my $usage='';
my @whitelist=('io'); my @whitelist=('io');
my @cliwhitelist;
GetOptions('output=s' => \$outdir, 'truncate' => \$truncate, 'input=s' => \$inputfile, 'help' => \$usage, 'whitelist=s' => \@cliwhitelist); GetOptions('output=s' => \$outdir, 'truncate' => \$truncate, 'input=s' => \$inputfile, 'help' => \$usage, 'whitelist=s' => \@whitelist);
@cliwhitelist = split(/,/, join(',', @cliwhitelist)); @whitelist = uniq(split(/,/, join(',', @whitelist)));
push @whitelist, @cliwhitelist; my $whitelisted = join '|', map{ "^" . $_ } map{quotemeta} sort {length($b)<=>length($a)}@whitelist;
@whitelist = uniq(@whitelist); my $whitelistre = qr/($whitelisted)/;
my %whitelisted = map {$_ => 1} @whitelist;
if ( $usage if ( $usage
|| ((!$outdir) || (! -d $outdir)) || ((!$outdir) || (! -d $outdir))
@ -168,7 +166,7 @@ sub main {
# Add all new modules and their contents # Add all new modules and their contents
foreach my $module (@new) { foreach my $module (@new) {
if (! exists $modules->{$module} && ! exists $whitelisted{$module}) { if (! exists $modules->{$module} && $module !~ $whitelistre) {
$modules->{$module} = getModule($includedir, $module); $modules->{$module} = getModule($includedir, $module);
} }
} }