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 45  
46 46 my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m;
47 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 63 return $info;
... ... @@ -55,7 +67,7 @@ sub compare_versions {
55 67 my $info = copr_info();
56 68 my $match = {};
57 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 71 $match->{$key} = 1;
60 72 }
61 73 else {
... ... @@ -72,14 +84,14 @@ sub info2html {
72 84 foreach my $key (keys %{$info}) {
73 85 my $fill_v4_row;
74 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 88 $fill_v4_row = "success";
77 89 }
78 90 else {
79 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 95 $fill_v5_row = "success";
84 96 }
85 97 else {
... ... @@ -88,8 +100,9 @@ sub info2html {
88 100  
89 101 $table_entries .= "<tr>
90 102 <td><b>$key</b></td>
91   - <td>$info->{$key}->{'git_version'}</td>
  103 + <td>$info->{$key}->{'git_version_stable_4'}</td>
92 104 <td class=\"$fill_v4_row\">$info->{$key}->{'v4_version'}</td>
  105 + <td>$info->{$key}->{'git_version_master'}</td>
93 106 <td class=\"$fill_v5_row\">$info->{$key}->{'v5_version'}</td>
94 107 </tr>";
95 108 }
... ...
t/app.t
... ... @@ -8,12 +8,12 @@ my $info = CoprStatus::copr_info();
8 8 ok(ref($info), 'HASH');
9 9 foreach my $key (keys %{$info}) {
10 10 ok(ref($info->{$key}), 'HASH');
11   - ok($info->{$key}->{'git_version'});
  11 + ok($info->{$key}->{'git_version_master'});
12 12 ok($info->{$key}->{'v4_version'});
13 13 ok($info->{$key}->{'v5_version'});
14 14 like($info->{$key}->{'v4_version'}, qr/[[:ascii:]]+-[[:ascii:]]+/);
15 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 19 my $match = CoprStatus::compare_versions;
... ...
template.html.tt
... ... @@ -47,9 +47,17 @@
47 47 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 table-responsive">
48 48 <table class="table table-striped">
49 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 57 <th>PACKAGE</th>
51   - <th>git</th>
  58 + <th>git:stable-4.x</th>
52 59 <th>softwarepublico/v4</th>
  60 + <th>git:master</th>
53 61 <th>softwarepublico/v5</th>
54 62 </tr>
55 63 {$table_entries}
... ...