[PATCH] Makefile.in: Only set git version if .git directory exists
If Bird is compiled from a release tarball, but there is a git repository somewhere in a parent directory, the Makefile git version logic will pick up that version and use it as the Bird version, which is obviously not desirable. For instance, on OpenWrt this results in something like this: BIRD version reboot-6789-g4e9ce23aa5 Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index c8168bbe..1184d583 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,7 +21,7 @@ INSTALL=@INSTALL@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ INSTALL_DATA=@INSTALL_DATA@ -git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null)) +git-label:=$(strip $(shell [ -d .git ] && git describe --always --dirty=-x 2>/dev/null)) ifneq ($(git-label),) CFLAGS += -DGIT_LABEL="$(git-label)" endif -- 2.17.0
Hi! On 05/02/2018 06:43 PM, Toke Høiland-Jørgensen wrote:
If Bird is compiled from a release tarball, but there is a git repository somewhere in a parent directory, the Makefile git version logic will pick up that version and use it as the Bird version, which is obviously not desirable> For instance, on OpenWrt this results in something like this:
BIRD version reboot-6789-g4e9ce23aa5
Thank you for reporting the bug and sending the patch! Anyway, it failed with my config as I use multiple worktree configuration (where .git is only a file containing the real gitdir path). I also fixed it for build outside the workdir. M.
Jan Maria Matejka <jan.matejka@nic.cz> writes:
Hi!
On 05/02/2018 06:43 PM, Toke Høiland-Jørgensen wrote:
If Bird is compiled from a release tarball, but there is a git repository somewhere in a parent directory, the Makefile git version logic will pick up that version and use it as the Bird version, which is obviously not desirable> For instance, on OpenWrt this results in something like this:
BIRD version reboot-6789-g4e9ce23aa5
Thank you for reporting the bug and sending the patch! Anyway, it failed with my config as I use multiple worktree configuration (where .git is only a file containing the real gitdir path). I also fixed it for build outside the workdir.
Ah, right, didn't think of more esoteric git configs. Anyway, can confirm that you version also works for OpenWrt builds. Thanks! :) -Toke
participants (2)
-
Jan Maria Matejka -
Toke Høiland-Jørgensen