Skip to content

Commit 0046ea6

Browse files
kinkieyadij
authored andcommitted
Use git to extract default build-info (when enabled) (#1892)
Have configure option --enable-build-info[=yes] refer to git instead of bazaar to extract information about what is being built to include in the output of `squid -v`
1 parent ff6bad6 commit 0046ea6

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

acinclude/squid-util.m4

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,18 @@ AC_DEFUN([SQUID_EMBED_BUILD_INFO],[
254254
AS_CASE(["$enableval"],
255255
[no],[:],
256256
[yes],[
257-
AS_IF([test -d "${srcdir}/.bzr"],[
258-
AC_PATH_PROG(BZR,bzr,$FALSE)
259-
squid_bzr_branch_nick=`cd ${srcdir} && ${BZR} nick 2>/dev/null`
260-
AS_IF([test $? -eq 0 -a "x$squid_bzr_branch_nick" != "x"],[
261-
squid_bzr_branch_revno=`cd ${srcdir} && ${BZR} revno 2>/dev/null | sed 's/\"//g'`
262-
])
263-
AS_IF([test $? -eq 0 -a "x$squid_bzr_branch_revno" != "x"],[
264-
sh -c "cd ${srcdir} && ${BZR} diff 2>&1 >/dev/null"
265-
AS_IF([test $? -eq 1],[
266-
squid_bzr_branch_revno="$squid_bzr_branch_revno+changes"
257+
AC_PATH_PROG(GIT,git,$FALSE)
258+
AS_IF([test "x$GIT" != "x$FALSE"],[
259+
squid_git_branch="`cd ${srcdir} && ${GIT} branch --show-current 2>/dev/null`"
260+
squid_git_revno="`cd ${srcdir} && ${GIT} rev-parse --short HEAD 2>/dev/null`"
261+
AS_IF([test "x$squid_git_branch" != "x"], [:], [squid_git_branch="unknown"])
262+
AS_IF([test "x$squid_git_revno" != "x"],[
263+
AS_IF([cd ${srcdir} && ! ${GIT} diff --quiet HEAD],[ # there are uncommitted changes
264+
squid_git_revno="$squid_git_revno plus changes"
267265
])
268266
])
269-
AS_IF([test "x$squid_bzr_branch_revno" != "x"],[
270-
squid_build_info="Built branch: ${squid_bzr_branch_nick}-r${squid_bzr_branch_revno}"
271-
])
272267
])
268+
squid_build_info="Git: branch ${squid_git_branch:-unavailable} revision ${squid_git_revno:-unavailable}"
273269
],
274270
[squid_build_info=$enableval]
275271
)

0 commit comments

Comments
 (0)