Commit 6b89b456a13198c0373e56a7bcf9f841784a494e

Authored by Lucas Kanashiro
1 parent c081cf76

Rename some variables

Showing 1 changed file with 15 additions and 15 deletions   Show diff stats
lib/CoprStatus.pm
@@ -45,10 +45,10 @@ sub copr_info { @@ -45,10 +45,10 @@ sub copr_info {
45 $info->{$package}->{$repo."_version"} = $version if $status eq "succeeded"; 45 $info->{$package}->{$repo."_version"} = $version if $status eq "succeeded";
46 } 46 }
47 47
48 - foreach my $key (keys %{$info}) { 48 + foreach my $package (keys %{$info}) {
49 my $git_url = git_url('http://softwarepublico.gov.br', 49 my $git_url = git_url('http://softwarepublico.gov.br',
50 'gitlab/softwarepublico/softwarepublico/raw/<branch>/src/pkg-rpm/<package>/<package>.spec', 50 'gitlab/softwarepublico/softwarepublico/raw/<branch>/src/pkg-rpm/<package>/<package>.spec',
51 - $branch, $key); 51 + $branch, $package);
52 my $spec = $ua->get($git_url); 52 my $spec = $ua->get($git_url);
53 my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m; 53 my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m;
54 if($version =~ /%\{version\}/) { 54 if($version =~ /%\{version\}/) {
@@ -58,7 +58,7 @@ sub copr_info { @@ -58,7 +58,7 @@ sub copr_info {
58 my $release = 'no_release'; 58 my $release = 'no_release';
59 $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m; 59 $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m;
60 $version = "$version-$release"; 60 $version = "$version-$release";
61 - $info->{$key}->{'git_version_'.$branch} = $version; 61 + $info->{$package}->{'git_version_'.$branch} = $version;
62 } 62 }
63 63
64 } 64 }
@@ -67,12 +67,12 @@ sub compare_versions { @@ -67,12 +67,12 @@ sub compare_versions {
67 copr_info('softwarepublico', 'v4', 'stable-4.x'); 67 copr_info('softwarepublico', 'v4', 'stable-4.x');
68 copr_info('softwarepublico', 'v5', 'master'); 68 copr_info('softwarepublico', 'v5', 'master');
69 my $match = {}; 69 my $match = {};
70 - foreach my $key (keys %{$info}) {  
71 - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) {  
72 - $match->{$key} = 1; 70 + foreach my $package (keys %{$info}) {
  71 + if($info->{$package}->{'v5_version'} eq $info->{$package}->{git_version_master}) {
  72 + $match->{$package} = 1;
73 } 73 }
74 else { 74 else {
75 - $match->{$key} = 0; 75 + $match->{$package} = 0;
76 } 76 }
77 } 77 }
78 78
@@ -83,17 +83,17 @@ sub info2html { @@ -83,17 +83,17 @@ sub info2html {
83 copr_info('softwarepublico', 'v4', 'stable-4.x'); 83 copr_info('softwarepublico', 'v4', 'stable-4.x');
84 copr_info('softwarepublico', 'v5', 'master'); 84 copr_info('softwarepublico', 'v5', 'master');
85 my $table_entries=""; 85 my $table_entries="";
86 - foreach my $key (keys %{$info}) { 86 + foreach my $package (keys %{$info}) {
87 my $fill_v4_row; 87 my $fill_v4_row;
88 my $fill_v5_row; 88 my $fill_v5_row;
89 - if($info->{$key}->{'v4_version'} eq $info->{$key}->{'git_version_stable-4.x'}) { 89 + if($info->{$package}->{'v4_version'} eq $info->{$package}->{'git_version_stable-4.x'}) {
90 $fill_v4_row = "success"; 90 $fill_v4_row = "success";
91 } 91 }
92 else { 92 else {
93 $fill_v4_row = "danger"; 93 $fill_v4_row = "danger";
94 } 94 }
95 95
96 - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) { 96 + if($info->{$package}->{'v5_version'} eq $info->{$package}->{git_version_master}) {
97 $fill_v5_row = "success"; 97 $fill_v5_row = "success";
98 } 98 }
99 else { 99 else {
@@ -101,11 +101,11 @@ sub info2html { @@ -101,11 +101,11 @@ sub info2html {
101 } 101 }
102 102
103 $table_entries .= "<tr> 103 $table_entries .= "<tr>
104 - <td><b>$key</b></td>  
105 - <td>$info->{$key}->{'git_version_stable-4.x'}</td>  
106 - <td class=\"$fill_v4_row\">$info->{$key}->{'v4_version'}</td>  
107 - <td>$info->{$key}->{'git_version_master'}</td>  
108 - <td class=\"$fill_v5_row\">$info->{$key}->{'v5_version'}</td> 104 + <td><b>$package</b></td>
  105 + <td>$info->{$package}->{'git_version_stable-4.x'}</td>
  106 + <td class=\"$fill_v4_row\">$info->{$package}->{'v4_version'}</td>
  107 + <td>$info->{$package}->{'git_version_master'}</td>
  108 + <td class=\"$fill_v5_row\">$info->{$package}->{'v5_version'}</td>
109 </tr>"; 109 </tr>";
110 } 110 }
111 111