Commit 0fd997ecf4444c84715c7121e068287acbaafc39

Authored by Athos
1 parent 290cd879

add row for git stable-4.x branch

Now the v4 repo is compared with the git stable-4.x branch instead of
master.
Showing 3 changed files with 29 additions and 8 deletions   Show diff stats
lib/CoprStatus.pm
@@ -45,7 +45,19 @@ sub copr_info { @@ -45,7 +45,19 @@ sub copr_info {
45 45
46 my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m; 46 my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m;
47 $version = "$version-$release"; 47 $version = "$version-$release";
48 - $info->{$key}->{'git_version'} = $version; 48 + $info->{$key}->{'git_version_master'} = $version;
  49 + }
  50 +
  51 + foreach my $key (keys %{$info}) {
  52 + my $spec = $ua->get("https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/raw/stable-4.x/src/pkg-rpm/$key/$key.spec");
  53 + my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m;
  54 + if($version =~ /%\{version\}/) {
  55 + $version = $1 if $spec->decoded_content =~ /define version\s*([^\s]+)\s*$/m;
  56 + }
  57 +
  58 + my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m;
  59 + $version = "$version-$release";
  60 + $info->{$key}->{'git_version_stable_4'} = $version;
49 } 61 }
50 62
51 return $info; 63 return $info;
@@ -55,7 +67,7 @@ sub compare_versions { @@ -55,7 +67,7 @@ sub compare_versions {
55 my $info = copr_info(); 67 my $info = copr_info();
56 my $match = {}; 68 my $match = {};
57 foreach my $key (keys %{$info}) { 69 foreach my $key (keys %{$info}) {
58 - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { 70 + if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) {
59 $match->{$key} = 1; 71 $match->{$key} = 1;
60 } 72 }
61 else { 73 else {
@@ -72,14 +84,14 @@ sub info2html { @@ -72,14 +84,14 @@ sub info2html {
72 foreach my $key (keys %{$info}) { 84 foreach my $key (keys %{$info}) {
73 my $fill_v4_row; 85 my $fill_v4_row;
74 my $fill_v5_row; 86 my $fill_v5_row;
75 - if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version}) { 87 + if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version_stable_4}) {
76 $fill_v4_row = "success"; 88 $fill_v4_row = "success";
77 } 89 }
78 else { 90 else {
79 $fill_v4_row = "danger"; 91 $fill_v4_row = "danger";
80 } 92 }
81 93
82 - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { 94 + if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) {
83 $fill_v5_row = "success"; 95 $fill_v5_row = "success";
84 } 96 }
85 else { 97 else {
@@ -88,8 +100,9 @@ sub info2html { @@ -88,8 +100,9 @@ sub info2html {
88 100
89 $table_entries .= "<tr> 101 $table_entries .= "<tr>
90 <td><b>$key</b></td> 102 <td><b>$key</b></td>
91 - <td>$info->{$key}->{'git_version'}</td> 103 + <td>$info->{$key}->{'git_version_stable_4'}</td>
92 <td class=\"$fill_v4_row\">$info->{$key}->{'v4_version'}</td> 104 <td class=\"$fill_v4_row\">$info->{$key}->{'v4_version'}</td>
  105 + <td>$info->{$key}->{'git_version_master'}</td>
93 <td class=\"$fill_v5_row\">$info->{$key}->{'v5_version'}</td> 106 <td class=\"$fill_v5_row\">$info->{$key}->{'v5_version'}</td>
94 </tr>"; 107 </tr>";
95 } 108 }
@@ -8,12 +8,12 @@ my $info = CoprStatus::copr_info(); @@ -8,12 +8,12 @@ my $info = CoprStatus::copr_info();
8 ok(ref($info), 'HASH'); 8 ok(ref($info), 'HASH');
9 foreach my $key (keys %{$info}) { 9 foreach my $key (keys %{$info}) {
10 ok(ref($info->{$key}), 'HASH'); 10 ok(ref($info->{$key}), 'HASH');
11 - ok($info->{$key}->{'git_version'}); 11 + ok($info->{$key}->{'git_version_master'});
12 ok($info->{$key}->{'v4_version'}); 12 ok($info->{$key}->{'v4_version'});
13 ok($info->{$key}->{'v5_version'}); 13 ok($info->{$key}->{'v5_version'});
14 like($info->{$key}->{'v4_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/); 14 like($info->{$key}->{'v4_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/);
15 like($info->{$key}->{'v5_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/); 15 like($info->{$key}->{'v5_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/);
16 - like($info->{$key}->{'git_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/); 16 + like($info->{$key}->{'git_version_master'}, qr/[[:ascii:]]+-[[:ascii:]]+/);
17 } 17 }
18 18
19 my $match = CoprStatus::compare_versions; 19 my $match = CoprStatus::compare_versions;
template.html.tt
@@ -47,9 +47,17 @@ @@ -47,9 +47,17 @@
47 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 table-responsive"> 47 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 table-responsive">
48 <table class="table table-striped"> 48 <table class="table table-striped">
49 <tr> 49 <tr>
  50 + <th></th>
  51 + <th>Release 4</th>
  52 + <th></th>
  53 + <th>Release 5</th>
  54 + <th></th>
  55 + </tr>
  56 + <tr>
50 <th>PACKAGE</th> 57 <th>PACKAGE</th>
51 - <th>git</th> 58 + <th>git:stable-4.x</th>
52 <th>softwarepublico/v4</th> 59 <th>softwarepublico/v4</th>
  60 + <th>git:master</th>
53 <th>softwarepublico/v5</th> 61 <th>softwarepublico/v5</th>
54 </tr> 62 </tr>
55 {$table_entries} 63 {$table_entries}