]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use git to extract default build-info (when enabled) (#1892)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Sat, 24 Aug 2024 23:30:23 +0000 (23:30 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 25 Aug 2024 00:28:20 +0000 (00:28 +0000)
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`

acinclude/squid-util.m4

index 4a33cce7f383aa10daa3d2bdf95c0062b973d783..02a63dfcd2bd8275bc44f1d1e85cf467d53c16cc 100644 (file)
@@ -287,22 +287,18 @@ AC_DEFUN([SQUID_EMBED_BUILD_INFO],[
     AS_CASE(["$enableval"],
       [no],[:],
       [yes],[
-        AS_IF([test -d "${srcdir}/.bzr"],[
-          AC_PATH_PROG(BZR,bzr,$FALSE)
-          squid_bzr_branch_nick=`cd ${srcdir} && ${BZR} nick 2>/dev/null`
-          AS_IF([test $? -eq 0 -a "x$squid_bzr_branch_nick" != "x"],[
-            squid_bzr_branch_revno=`cd ${srcdir} && ${BZR} revno 2>/dev/null | sed 's/\"//g'`
-          ])
-          AS_IF([test $? -eq 0 -a "x$squid_bzr_branch_revno" != "x"],[
-            sh -c "cd ${srcdir} && ${BZR} diff 2>&1 >/dev/null"
-            AS_IF([test $? -eq 1],[
-              squid_bzr_branch_revno="$squid_bzr_branch_revno+changes"
+        AC_PATH_PROG(GIT,git,$FALSE)
+        AS_IF([test "x$GIT" != "x$FALSE"],[
+          squid_git_branch="`cd ${srcdir} && ${GIT} branch --show-current 2>/dev/null`"
+          squid_git_revno="`cd ${srcdir} && ${GIT} rev-parse --short HEAD 2>/dev/null`"
+          AS_IF([test "x$squid_git_branch" != "x"], [:], [squid_git_branch="unknown"])
+          AS_IF([test "x$squid_git_revno" != "x"],[
+            AS_IF([cd ${srcdir} && ! ${GIT} diff --quiet HEAD],[ # there are uncommitted changes
+              squid_git_revno="$squid_git_revno plus changes"
             ])
           ])
-          AS_IF([test "x$squid_bzr_branch_revno" != "x"],[
-            squid_build_info="Built branch: ${squid_bzr_branch_nick}-r${squid_bzr_branch_revno}"
-          ])
         ])
+        squid_build_info="Git: branch ${squid_git_branch:-unavailable} revision ${squid_git_revno:-unavailable}"
       ],
       [squid_build_info=$enableval]
     )