diff options
author | Jeff Fearn <jfearn@redhat.com> | 2020-05-07 11:41:39 +1000 |
---|---|---|
committer | Jeff Fearn <jfearn@redhat.com> | 2020-05-07 11:41:39 +1000 |
commit | 353af77714fd29aeab330255808636a9088eecc2 (patch) | |
tree | ecaadcb99519d2b53a96e7dfe9661b498156827a /t/010dependencies.t | |
parent | Bumped version to 5.0.4 (diff) | |
download | bugzilla-353af77714fd29aeab330255808636a9088eecc2.tar.gz bugzilla-353af77714fd29aeab330255808636a9088eecc2.tar.bz2 bugzilla-353af77714fd29aeab330255808636a9088eecc2.zip |
Bug 478886 - Open Source Red Hat BugzillaRelease-5.0.4-rh44
Import Red Hat Bugzilla changes.
Diffstat (limited to 't/010dependencies.t')
-rw-r--r-- | t/010dependencies.t | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/t/010dependencies.t b/t/010dependencies.t index afd29a652..d6dc1b1c0 100644 --- a/t/010dependencies.t +++ b/t/010dependencies.t @@ -30,7 +30,8 @@ use constant MODULE_REGEX => qr/ ['"]? ([\w:\.\\]+) /x; -use constant BASE_REGEX => qr/^use (?:base|parent) (?:-norequire, )?qw\(([^\)]+)/; +use constant BASE_REGEX => + qr/^use (?:base|parent) (?:-norequire, )?qw\(([^\)]+)/; # Extract all Perl modules. foreach my $file (@Support::Files::testitems) { @@ -42,46 +43,47 @@ foreach my $file (@Support::Files::testitems) { } foreach my $module (keys %mods) { - my $reading = 1; - my @use; - - open(SOURCE, $mods{$module}); - while (my $line = <SOURCE>) { - last if ($line =~ /^__END__/); - if ($line =~ /^=cut/) { - $reading = 1; - next; - } - next unless $reading; - if ($line =~ /^=(head|over|item|back|pod|begin|end|for)/) { - $reading = 0; - next; - } - if ($line =~ /^package\s+([^;]);/) { - $module = $1; - } - elsif ($line =~ BASE_REGEX or $line =~ MODULE_REGEX) { - my $used_string = $1; - # "use base"/"use parent" can have multiple modules - my @used_array = split(/\s+/, $used_string); - foreach my $used (@used_array) { - next if $used !~ /^Bugzilla/; - $used =~ s#/#::#g; - $used =~ s#\.pm$##; - $used =~ s#\$module#[^:]+#; - $used =~ s#\${[^}]+}#[^:]+#; - $used =~ s#[" ]##g; - push(@use, grep(/^\Q$used\E$/, keys %mods)); - } - } + my $reading = 1; + my @use; + + open(SOURCE, $mods{$module}); + while (my $line = <SOURCE>) { + last if ($line =~ /^__END__/); + if ($line =~ /^=cut/) { + $reading = 1; + next; + } + next unless $reading; + if ($line =~ /^=(head|over|item|back|pod|begin|end|for)/) { + $reading = 0; + next; } - close (SOURCE); + if ($line =~ /^package\s+([^;]);/) { + $module = $1; + } + elsif ($line =~ BASE_REGEX or $line =~ MODULE_REGEX) { + my $used_string = $1; - foreach my $u (@use) { - if (!grep {$_ eq $u} @{$deps{$module}}) { - push(@{$deps{$module}}, $u); + # "use base"/"use parent" can have multiple modules + my @used_array = split(/\s+/, $used_string); + foreach my $used (@used_array) { + next if $used !~ /^Bugzilla/; + $used =~ s#/#::#g; + $used =~ s#\.pm$##; + $used =~ s#\$module#[^:]+#; + $used =~ s#\$\{[^}]+}#[^:]+#; + $used =~ s#[" ]##g; + push(@use, grep(/^\Q$used\E$/, keys %mods)); } } + } + close(SOURCE); + + foreach my $u (@use) { + if (!grep { $_ eq $u } @{$deps{$module}}) { + push(@{$deps{$module}}, $u); + } + } } sub creates_loop { |