]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Revise "srcid" file handling
authorMichał Kępień <michal@isc.org>
Tue, 9 Jun 2020 12:47:06 +0000 (14:47 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 9 Jun 2020 12:47:06 +0000 (14:47 +0200)
The "srcid" file present in each BIND source tarball contains a
shortened hash of the Git commit corresponding to a given BIND release.
This allows a Git reference to be included in an archive that otherwise
lacks any Git information.

Before the move to Automake, if an "srcid" file was present in the root
source directory at the time ./configure was run, its contents were used
as the value of a compile-time constant which was then baked into BIND
binaries; otherwise, "git rev-parse" was used to determine the value of
that constant.

With Automake, a similar approach was attempted that required the
"srcid" file to be present at autoreconf time in order for it to be
used.  However, note that this means that even if that file is present
in a source tarball created using "make dist", its contents are not
going to influence the value of the aforementioned compile-time constant
because autoreconf hardcodes the output of "git rev-parse" into the
configure script at autoreconf time.

To make things more clear, always use "git rev-parse" for determining
the value of the PACKAGE_SRCID compile-time constant when running
autoreconf.  This causes "srcid" to be an empty string in source
tarballs built from other source tarballs, but that is not deemed to be
much of an issue as "make dist" is expected to be run from Git
repository clones.  Remove stderr redirections to /dev/null to ensure
errors caused e.g. by running "make dist" from outside a Git repository
clone are not hidden.  Trim the Git commit hash to 7 characters for
consistency between Unix and Windows systems.

Despite the above, ensure the "srcid" file is present in source tarballs
created using "make dist" as that file is used by the build process on
Windows.

Makefile.am
configure.ac

index 13e499f8972658bb04ed80f27cdf1c3aa6083560..8b95fa378bddff636125c6605362a81403214e7c 100644 (file)
@@ -22,3 +22,4 @@ EXTRA_DIST =                  \
 
 dist-hook:
        find $(distdir) -type f -name .gitignore -delete
+       git rev-parse --short HEAD | cut -b1-7 > $(distdir)/srcid
index 8fb9cac1c9de2ae96db42488fa1300578c1985a0..cc5970205637201d1385c568bb80bd658a790abd 100644 (file)
@@ -17,7 +17,7 @@ m4_define([bind_VERSION_MINOR], 17)dnl
 m4_define([bind_VERSION_PATCH], 1)dnl
 m4_define([bind_VERSION_EXTRA], -dev)dnl
 m4_define([bind_DESCRIPTION], [(Development Release)])dnl
-m4_define([bind_SRCID], [m4_esyscmd_s([if test -f srcid; then cat srcid; else git rev-parse --short HEAD 2>/dev/null; fi])])dnl
+m4_define([bind_SRCID], [m4_esyscmd_s([git rev-parse --short HEAD | cut -b1-7])])dnl
 m4_define([bind_PKG_VERSION], [[bind_VERSION_MAJOR.bind_VERSION_MINOR.bind_VERSION_PATCH]bind_VERSION_EXTRA])dnl
 
 #