make-release: Run git describe once

Run git describe once at the beginning of make-release to find the
version information used to derive the tarball file names and saved in
the .version file.

This is a cleanup and refactoring change to prepare for a future commit.

Change-Id: I0debeeffa5d2c63ab1498588766cb36424d15cd5
Reviewed-on: https://gerrit.openafs.org/14150
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Michael Meffie 2020-04-16 09:41:41 -04:00 committed by Benjamin Kaduk
parent d0753c0ace
commit 188ca8bf52

View File

@ -45,13 +45,16 @@ if ($tagPoint) {
my $version = `git describe --abbrev=4 $tagName`;
chomp $version;
$version=~s/openafs-[^-]*-//;
$version=~s/_/./g;
if (!$version) {
die "Failed to describe $tagName.\n";
}
my $suffix = $version;
$suffix =~ s/openafs-[^-]*-//;
$suffix =~ s/_/./g;
my $name = "openafs-$suffix";
# Grab the tagged code into a temporary directory
my $name = "openafs-".$version;
my $tempDir = File::Temp::tempdir();
system ("git archive --format=tar --prefix=$name/ $tagName ".
" | tar -C $tempDir -x") == 0
@ -68,7 +71,10 @@ if ($last) {
}
# Describe the tree
system("git describe --abbrev=4 $tagName > $tempDir/$name/.version");
open(my $fh, ">", "$tempDir/$name/.version") or
die "Failed to open $tempDir/$name/.version: $!\n";
print $fh "$version\n";
close($fh);
# Run regen.sh to create the rest of the tree
system ("cd $tempDir/$name && ./regen.sh") == 0