diff --git a/lib/CoprStatus.pm b/lib/CoprStatus.pm index 4f76410..83686e1 100644 --- a/lib/CoprStatus.pm +++ b/lib/CoprStatus.pm @@ -45,7 +45,19 @@ sub copr_info { my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m; $version = "$version-$release"; - $info->{$key}->{'git_version'} = $version; + $info->{$key}->{'git_version_master'} = $version; + } + + foreach my $key (keys %{$info}) { + my $spec = $ua->get("https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/raw/stable-4.x/src/pkg-rpm/$key/$key.spec"); + my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m; + if($version =~ /%\{version\}/) { + $version = $1 if $spec->decoded_content =~ /define version\s*([^\s]+)\s*$/m; + } + + my $release = $1 if $spec->decoded_content =~ /^Release:\s*([^\s]+)\s*$/m; + $version = "$version-$release"; + $info->{$key}->{'git_version_stable_4'} = $version; } return $info; @@ -55,7 +67,7 @@ sub compare_versions { my $info = copr_info(); my $match = {}; foreach my $key (keys %{$info}) { - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { + if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) { $match->{$key} = 1; } else { @@ -72,14 +84,14 @@ sub info2html { foreach my $key (keys %{$info}) { my $fill_v4_row; my $fill_v5_row; - if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version}) { + if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version_stable_4}) { $fill_v4_row = "success"; } else { $fill_v4_row = "danger"; } - if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) { + if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version_master}) { $fill_v5_row = "success"; } else { @@ -88,8 +100,9 @@ sub info2html { $table_entries .= "
+ | Release 4 | ++ | Release 5 | ++ | |
---|---|---|---|---|---|
PACKAGE | -git | +git:stable-4.x | softwarepublico/v4 | +git:master | softwarepublico/v5 |