Make: Support shallow git clones for testing

Since commit 1ec9b94, we derive the version number from git tags with
build-aux/git-version-gen.  When a shallow clone doesn't include a
suitable tag, this fails, and make refuses to build anything.  Since
Travis uses git-clone --depth=50, it'll break as soon as we've got
more than 50 commits since the last release.

Support arbitrarily shallow clones for limited purposes like testing
by falling back from a proper V.N-H version number to UNKNOWN-H.

To guard against use of such builds for other purposes, log a warning
on server startup, and print one on player login.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2017-09-02 17:18:30 +02:00
parent 41ce9e37fd
commit 5e1b590867
4 changed files with 16 additions and 5 deletions

View file

@ -91,7 +91,7 @@ while (<>) {
or /^[0-9]+ (sector|ship|plane|unit|nuke|lost item)/));
### Version
s/(Wolfpack( |\\\\040)Empire( |\\\\040))[0-9][^ "]*/${1}4.4.0/;
s/(Wolfpack( |\\\\040)Empire( |\\\\040))(UNKNOWN-|[0-9])[^ "]*/${1}4.4.0/;
### Formatted time
# nat_timeused in prompt
s/^\[[0-9]+(:[0-9]+\] Command \:)/[0$1/;