build(.gitlab-ci/version.pl): Can now automatically determine the remote repository.

This commit is contained in:
Stephan Barth 2024-10-25 15:48:19 +02:00
parent f0bd9d57b5
commit f2067bdb56

View File

@ -70,6 +70,11 @@ my %parKinds = (
def=>'',
help=>'Use this file name to write the changelog to, but use "changelog" to read the old changelog. If not set for both versions the parameter changelog is used.',
},
autovcsurl=>{
arity=>1,
def=>q#git ls-remote --get-url origin | sed 's/[^@]*@\([^:]*\):\(.*\)\.git$/https:\/\/\1\/\2/'#,
help=>'Automated computation for vcsurl. If both values are set then vcsurl is used."',
},
vcsurl=>{
arity=>1,
def=>'',
@ -163,6 +168,12 @@ for my $as(split /,/, $par{change}) {
}
}
if($par{autovcsurl} and not $par{vcsurl}) {
$par{vcsurl} = qx($par{autovcsurl});
chomp $par{vcsurl};
$par{vcsurl}=~s#/*$#/#
}
if($par{changelog} and not $par{vcsurl}) {
die "Parameter 'changelog' given, but parameter 'vcsurl' is not. Please state the url of your repository for computation of a changelog.\n"
}
@ -576,7 +587,7 @@ if($par{changelog}) {
}
#print Data::Dumper::Dumper(\%extend);
my $preVersion = '';
if($sects[0][0]=~m/^##\s*\[([^\]\[]+)\]\(/) {
if(defined $sects[0] and defined $sects[0][0] and $sects[0][0]=~m/^##\s*\[([^\]\[]+)\]\(/) {
$preVersion = $1;
$preVersion =~ s#^v?#v#;
}