build(release): fix version script [skip ci]
This commit is contained in:
parent
bf0642ccb8
commit
12d8f49a65
@ -224,47 +224,35 @@ sub parseVersion {
|
|||||||
warn "$0: internal error (parseVersion called on undef at $c)\n";
|
warn "$0: internal error (parseVersion called on undef at $c)\n";
|
||||||
return undef
|
return undef
|
||||||
}
|
}
|
||||||
my ($pre,$ma,$mi,$p,$sp,$brn,$brv) = ();
|
my %cap = ();
|
||||||
if($v=~m#^([a-z]*)([0-9]+)$#) {
|
if(
|
||||||
$pre = $1;
|
$v=~m#^(?<pre>[a-z]*)(?<ma>[0-9]+)$# ||
|
||||||
$ma = $2;
|
$v=~m#^(?<pre>[a-z]*)(?<ma>[0-9]+)\.(?<mi>[0-9]+)$# ||
|
||||||
} elsif($v=~m#^([a-z]*)([0-9]+)\.([0-9]+)$#) {
|
$v=~m#^(?<pre>[a-z]*)(?<ma>[0-9]+)\.(?<mi>[0-9]+)\.(?<p>[0-9]+)$# ||
|
||||||
$pre = $1;
|
$v=~m#^(?<pre>[a-z]*)(?<ma>[0-9]+)\.(?<mi>[0-9]+)\.(?<p>[0-9]+)-test-(?<sp>(?<brn>[a-z]+)-(?<brv>[0-9\.]+))$# ||
|
||||||
$ma = $2;
|
$v=~m#^(?<pre>[a-z]*)(?<ma>[0-9]+)\.(?<mi>[0-9]+)\.(?<p>[0-9]+)-(?<sp>.*)$#
|
||||||
$mi = $3
|
) {
|
||||||
} elsif($v=~m#^([a-z]*)([0-9]+)\.([0-9]+)\.([0-9]+)$#) {
|
%cap = %+
|
||||||
$pre = $1;
|
# my ($pre,$ma,$mi,$p,$sp,$brn,$brv) = ();
|
||||||
$ma = $2;
|
|
||||||
$mi = $3;
|
|
||||||
$p = $4;
|
|
||||||
} elsif($v=~m#^([a-z]*)([0-9]+)\.([0-9]+)\.([0-9]+)-test-([a-z]+)-([0-9\.]+)$#) {
|
|
||||||
$pre = $1;
|
|
||||||
$ma = $2;
|
|
||||||
$mi = $3;
|
|
||||||
$p = $4;
|
|
||||||
$sp = $5;
|
|
||||||
$brn = $6;
|
|
||||||
$brv = $7;
|
|
||||||
} elsif($v=~m#^([a-z]*)([0-9]+)\.([0-9]+)\.([0-9]+)-(.*)$#) {
|
|
||||||
$pre = $1;
|
|
||||||
$ma = $2;
|
|
||||||
$mi = $3;
|
|
||||||
$p = $4;
|
|
||||||
$sp = $5;
|
|
||||||
} else {
|
} else {
|
||||||
warn "$0: unexpected old version number: $v\n" if $par{v};
|
warn "$0: unexpected old version number: $v\n" if $par{v};
|
||||||
return undef
|
return undef
|
||||||
}
|
}
|
||||||
$pre = 'v' if '' eq $pre;
|
$cap{pre} = 'v' if '' eq $cap{pre};
|
||||||
return {
|
my %ret = (
|
||||||
prefix=>$pre,
|
prefix=>$cap{pre},
|
||||||
major=>$ma,
|
major=>$cap{ma},
|
||||||
minor=>$mi,
|
minor=>$cap{mi},
|
||||||
patch=>$p,
|
patch=>$cap{p},
|
||||||
subpatch=>$sp,
|
subpatch=>$cap{sp},
|
||||||
branchname=>$brn,
|
branchname=>$cap{brn},
|
||||||
branchversion=>$brv,
|
branchversion=>$cap{brv},
|
||||||
|
);
|
||||||
|
if($par{v}) {
|
||||||
|
my $parsed = join '; ', map { "$_=>$ret{$_}" } sort keys %ret;
|
||||||
|
warn "Version '$v' was parsed to '$parsed'\n"
|
||||||
}
|
}
|
||||||
|
return \%ret
|
||||||
}
|
}
|
||||||
|
|
||||||
#@oldVersions = sort {
|
#@oldVersions = sort {
|
||||||
@ -474,7 +462,7 @@ SEARCHVERSION: for my $v(@versions) {
|
|||||||
sub justVersionInc {
|
sub justVersionInc {
|
||||||
my ($v, $react) = @_;
|
my ($v, $react) = @_;
|
||||||
my $vv = parseVersion($v);
|
my $vv = parseVersion($v);
|
||||||
$vv->{patch}++ if $react->{patch};
|
$vv->{patch}++; # if $react->{patch}; # in principal a good idea to increase only when a patch action happend, but we need a new version, even if nothing happend, so we always increase patch; if there are other changes as well, it is overwritten anyways
|
||||||
do {$vv->{minor}++; $vv->{patch}=0} if $react->{minor};
|
do {$vv->{minor}++; $vv->{patch}=0} if $react->{minor};
|
||||||
do {$vv->{major}++; $vv->{minor}=0; $vv->{patch}=0} if $react->{major};
|
do {$vv->{major}++; $vv->{minor}=0; $vv->{patch}=0} if $react->{major};
|
||||||
return vsJustVersion($vv);
|
return vsJustVersion($vv);
|
||||||
@ -500,6 +488,7 @@ for(@allVersions) {
|
|||||||
$allVersions{$_} = 1
|
$allVersions{$_} = 1
|
||||||
}
|
}
|
||||||
while(exists $allVersions{$newVersion}) {
|
while(exists $allVersions{$newVersion}) {
|
||||||
|
warn "Version conflict, so we try another version, '$newVersion' exists already\n" if $par{v};
|
||||||
if($mainVersion) {
|
if($mainVersion) {
|
||||||
die "$0: probably internal error (collision in main version)\n"
|
die "$0: probably internal error (collision in main version)\n"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user