Simon Josefsson via Gnulib discussion list wrote:
> +EXTRA_DIST += $(top_srcdir)/.version
> +BUILT_SOURCES += $(top_srcdir)/.version
> +$(top_srcdir)/.version:
> + echo '$(VERSION)' > $@-t
> + mv $@-t $@
Wait a moment. Before putting this into a Makefile fragment, we should
fix it first.
1) I claim that it is over-engineered. Why are there 2 files that contain
the version, '.tarball-version' and '.version'? And which is the original
one, which is the copy?
The answers are contained in the .git-version-gen file as comments, but I
still have problems remembering them.
2) You want to have reproducible tarballs, right? Look at the .version files
in coreutils and gettext releases:
$ for f in coreutils-*.tar.gz ; do echo ; echo $f; tar xOfz $f
${f%.tar.gz}/.version 2>/dev/null; done
coreutils-6.10.tar.gz
6.10
coreutils-6.11.104-00a30.tar.gz
6.11.104-00a30
coreutils-6.11.tar.gz
6.11
coreutils-6.12.tar.gz
6.12
coreutils-6.9-375-3e3f8.tar.gz
6.9-375-3e3f8
coreutils-6.9.tar.gz
coreutils-7.1.tar.gz
7.1
coreutils-7.3.tar.gz
7.3
coreutils-7.5.tar.gz
7.5
coreutils-7.6.tar.gz
7.5.81-fb19a
coreutils-8.10.tar.gz
8.10
coreutils-8.11.tar.gz
8.11
coreutils-8.12.tar.gz
8.12
coreutils-8.13.tar.gz
8.12.197-032bb
coreutils-8.14.tar.gz
8.14
coreutils-8.15.tar.gz
8.15
coreutils-8.17.tar.gz
8.17
coreutils-8.1.tar.gz
8.1
coreutils-8.3.tar.gz
8.3
coreutils-8.4.tar.gz
8.3.10-a4da4
coreutils-8.9.tar.gz
8.8.10-2468c
coreutils-9.2.tar.gz
9.2
coreutils-9.3.tar.gz
9.3
coreutils-9.4.tar.gz
9.4
coreutils-9.5.tar.gz
9.5
$ for f in gettext-*.tar.gz ; do echo ; echo $f; tar xOfz $f
${f%.tar.gz}/.version 2>/dev/null; done
gettext-0.19.1.tar.gz
0.19.1
gettext-0.19.2.tar.gz
0.19.2
gettext-0.19.3.tar.gz
0.19.3
gettext-0.19.4.tar.gz
0.19.4
gettext-0.19.5.1.tar.gz
0.19.5.1
gettext-0.19.5.tar.gz
0.19.5
gettext-0.19.6.tar.gz
0.19.6
gettext-0.19.7.tar.gz
0.19.7
gettext-0.19.8.1.tar.gz
0.19.8.1
gettext-0.19.8.tar.gz
0.19.8
gettext-0.19.tar.gz
0.19
gettext-0.20.1.tar.gz
0.20.1
gettext-0.20.2.tar.gz
0.20.2
gettext-0.20.tar.gz
0.20
gettext-0.21.1.tar.gz
20220912
gettext-0.21.tar.gz
0.20.1.124-32cf
gettext-0.22.1.tar.gz
0.22.1
gettext-0.22.2.tar.gz
0.22.2
gettext-0.22.3.tar.gz
0.22.2
gettext-0.22.4.tar.gz
0.22.2
gettext-0.22.5.tar.gz
0.22.5
gettext-0.22.tar.gz
0.22
gettext-0.23.tar.gz
0.23
Look especially at coreutils-7.6, coreutils-8.4, coreutils-8.9, coreutils-8.13,
gettext-0.21, gettext-0.21.1.
It appears that the .version file contains the version number of the *last*
"make dist" invocation the maintainer did in the particular directory
*before* making the final "make dist". Which is clearly a thing that is not
derived from what is checked into git.
Put another way: It is desirable, for reproducibility, that in a release
tarball, .tarball-version and .version have the same contents. If neither
Pàdraig nor I succeed in ensuring this property, there is clearly something
wrong with the way these two files are defined.
Bruno