Skip to content

Commit

Permalink
Fix to support sematic versions #597
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Jul 26, 2023
1 parent 18ce621 commit 768a5f1
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions virtual-server-lib-funcs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19360,11 +19360,20 @@ sub save_domain_ssh_pubkey

sub get_module_version_and_type
{
my ($list, $gpl) = @_;
my $mver = $module_info{'version'};
my ($v_major, $v_minor, $v_type);
if ($mver =~ /(?|(\d+)\.(\d+\.\d+)\.(\w+)|(\d+)\.(\d+)\.(\w+))/) {
($v_major, $v_minor, $v_type) = ($1, $2, $3);
my ($list, $gpl, $ver) = @_;
my $mver = $ver || $module_info{'version'};
my ($v_major, $v_minor, $v_build, $v_type);
if ($mver =~ /(?<major>\d+)\.(?<minor>\d+)\.(?<build>\d+).*?(?<type>[a-z]+)/i) {
($v_major, $v_minor, $v_build, $v_type) = ($+{major}, $+{minor}, $+{build}, $+{type});
}
elsif ($mver =~ /(?<major>\d+)\.(?<minor>\d+).*?(?<type>[a-z]+)/i) {
($v_major, $v_minor, $v_build, $v_type) = ($+{major}, $+{minor}, undef, $+{type});
}
elsif ($mver =~ /(?<major>\d+)\.(?<minor>\d+)\.(?<build>\d+)/) {
($v_major, $v_minor, $v_build) = ($+{major}, $+{minor}, $+{build});
}
elsif ($mver =~ /(?<major>\d+)\.(?<minor>\d+)/) {
($v_major, $v_minor) = ($+{major}, $+{minor});
}
else {
return $mver;
Expand All @@ -19380,8 +19389,8 @@ sub get_module_version_and_type
$v_type = "";
}
}
return $list ? ($v_major, $v_minor, $v_type) :
"$v_major.$v_minor$v_type";
return $list ? ($v_major, $v_minor, $v_build, &trim($v_type)) :
"$v_major.$v_minor".(defined($v_build) ? ".$v_build" : "")."$v_type";
}

# set_provision_features(&domain)
Expand Down

0 comments on commit 768a5f1

Please sign in to comment.