Commit 290cd8797bb4273cc5cd4e081f3dce84a4e95bd7
1 parent
566e55f8
Exists in
master
and in
2 other branches
improve iterations on hash keys
Showing
1 changed file
with
3 additions
and
7 deletions
Show diff stats
lib/CoprStatus.pm
| @@ -36,9 +36,7 @@ sub copr_info { | @@ -36,9 +36,7 @@ sub copr_info { | ||
| 36 | $info->{$package}->{'v5_version'} = $version if $status eq "succeeded"; | 36 | $info->{$package}->{'v5_version'} = $version if $status eq "succeeded"; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | - foreach my $key (%{$info}) { | ||
| 40 | - next if(ref($key) eq 'HASH'); | ||
| 41 | - | 39 | + foreach my $key (keys %{$info}) { |
| 42 | my $spec = $ua->get("https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/raw/master/src/pkg-rpm/$key/$key.spec"); | 40 | my $spec = $ua->get("https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/raw/master/src/pkg-rpm/$key/$key.spec"); |
| 43 | my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m; | 41 | my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m; |
| 44 | if($version =~ /%\{version\}/) { | 42 | if($version =~ /%\{version\}/) { |
| @@ -56,8 +54,7 @@ sub copr_info { | @@ -56,8 +54,7 @@ sub copr_info { | ||
| 56 | sub compare_versions { | 54 | sub compare_versions { |
| 57 | my $info = copr_info(); | 55 | my $info = copr_info(); |
| 58 | my $match = {}; | 56 | my $match = {}; |
| 59 | - foreach my $key (%{$info}) { | ||
| 60 | - next if(ref($key) eq 'HASH'); | 57 | + foreach my $key (keys %{$info}) { |
| 61 | if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { | 58 | if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { |
| 62 | $match->{$key} = 1; | 59 | $match->{$key} = 1; |
| 63 | } | 60 | } |
| @@ -72,8 +69,7 @@ sub compare_versions { | @@ -72,8 +69,7 @@ sub compare_versions { | ||
| 72 | sub info2html { | 69 | sub info2html { |
| 73 | my $info = copr_info(); | 70 | my $info = copr_info(); |
| 74 | my $table_entries=""; | 71 | my $table_entries=""; |
| 75 | - foreach my $key (%{$info}) { | ||
| 76 | - next if(ref($key) eq 'HASH'); | 72 | + foreach my $key (keys %{$info}) { |
| 77 | my $fill_v4_row; | 73 | my $fill_v4_row; |
| 78 | my $fill_v5_row; | 74 | my $fill_v5_row; |
| 79 | if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version}) { | 75 | if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version}) { |