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 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 49 my $git_url = git_url('http://softwarepublico.gov.br',
50 50 'gitlab/softwarepublico/softwarepublico/raw/<branch>/src/pkg-rpm/<package>/<package>.spec',
51   - $branch, $key);
  51 + $branch, $package);
52 52 my $spec = $ua->get($git_url);
53 53 my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m;
54 54 if($version =~ /%\{version\}/) {
... ... @@ -58,7 +58,7 @@ sub copr_info {
58 58 my $release = 'no_release';
59 59 $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m;
60 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 67 copr_info('softwarepublico', 'v4', 'stable-4.x');
68 68 copr_info('softwarepublico', 'v5', 'master');
69 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 74 else {
75   - $match->{$key} = 0;
  75 + $match->{$package} = 0;
76 76 }
77 77 }
78 78  
... ... @@ -83,17 +83,17 @@ sub info2html {
83 83 copr_info('softwarepublico', 'v4', 'stable-4.x');
84 84 copr_info('softwarepublico', 'v5', 'master');
85 85 my $table_entries="";
86   - foreach my $key (keys %{$info}) {
  86 + foreach my $package (keys %{$info}) {
87 87 my $fill_v4_row;
88 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 90 $fill_v4_row = "success";
91 91 }
92 92 else {
93 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 97 $fill_v5_row = "success";
98 98 }
99 99 else {
... ... @@ -101,11 +101,11 @@ sub info2html {
101 101 }
102 102  
103 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 109 </tr>";
110 110 }
111 111  
... ...