This is essentially the same issue as https://github.com/OpenTTD/nml/issues/112 for nml. When the dist tarball is put into another git repo (e.g. for the Debian packaging), findversion.sh favors the git detected version over the release version in .ottdrev.
It does seem that .ottdrev is only ever written into the bundles, never in the working directory itself. That means that fixing this could be a matter of reversing the priority in findversion.sh (read .ottdrev if it exists, try git otherwise).
However, it also seems that there is already another mechanism for remembering whether a release versions is used, namely writing GIT= to Makefile.dist. An alternative could be to let the makefile read .ottdrev itself, without even calling findversion.sh when GIT is empty.
Or even cleaner, maybe, would be to write REPO_VERSIONS=... to Makefile.dist and then only call findversion.sh if $REPO_VERSIONS is empty. This would allow removing .ottdrev completely and keep all release-specific info in a single file.
How is that?
Note that this is not a blocking problem right now - in the normal Debian workflow, the package is built in a chroot using an export from the git repo, without a .git directory, so things work as expected. However, this issue does (AFAICT, haven't tried yet) break building from the git directory directly (which would be otherwise supported).
This is essentially the same issue as https://github.com/OpenTTD/nml/issues/112 for nml. When the dist tarball is put into another git repo (e.g. for the Debian packaging),
findversion.sh
favors the git detected version over the release version in.ottdrev
.It does seem that
.ottdrev
is only ever written into the bundles, never in the working directory itself. That means that fixing this could be a matter of reversing the priority in findversion.sh (read.ottdrev
if it exists, try git otherwise).However, it also seems that there is already another mechanism for remembering whether a release versions is used, namely writing
GIT=
to Makefile.dist. An alternative could be to let the makefile read.ottdrev
itself, without even callingfindversion.sh
whenGIT
is empty.Or even cleaner, maybe, would be to write
REPO_VERSIONS=...
toMakefile.dist
and then only callfindversion.sh
if$REPO_VERSIONS
is empty. This would allow removing.ottdrev
completely and keep all release-specific info in a single file.How is that?
Note that this is not a blocking problem right now - in the normal Debian workflow, the package is built in a chroot using an export from the git repo, without a .git directory, so things work as expected. However, this issue does (AFAICT, haven't tried yet) break building from the git directory directly (which would be otherwise supported).