[master] 1959515e8 Revert part of previous commit, to compatible with old versions of python3

Poul-Henning Kamp phk at FreeBSD.org
Mon Dec 1 17:27:04 UTC 2025


commit 1959515e87e0a079ddcf5507c6c2f5637210136a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Dec 1 17:25:55 2025 +0000

    Revert part of previous commit, to compatible with old versions of python3

diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2
index 9038ec694..931baeb3c 160000
--- a/bin/varnishtest/vtest2
+++ b/bin/varnishtest/vtest2
@@ -1 +1 @@
-Subproject commit 9038ec69478866fa318b20c64aa89be8a75ba6a6
+Subproject commit 931baeb3cd2c2f57e165285218d4cb22789c9d2b
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index d03c9fba1..76ae54c6c 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -1206,8 +1206,6 @@ class vcc():
     # parts from varnish-cache include/generate.py
     def version(self):
         srcdir = os.path.dirname(self.inputfile)
-        if not srcdir:
-            srcdir = "."
 
         pkgstr = "NOVERSION"
 
@@ -1228,30 +1226,13 @@ class vcc():
     # parts from varnish-cache include/generate.py
     def vcs(self):
         srcdir = os.path.dirname(self.inputfile)
-        if not srcdir:
-            srcdir = "."
 
-        gitver = "NOGIT"
+        gitver = subprocess.check_output([
+            "git -C %s rev-parse HEAD 2>/dev/null || echo NOGIT" %
+            srcdir], shell=True, universal_newlines=True).strip()
         gitfile = "vmod_vcs_version.txt"
 
-        status = subprocess.run(
-            [
-                "git",
-                "-C",
-                srcdir,
-                "rev-parse",
-                "HEAD"
-            ],
-            shell=False,
-            universal_newlines=True,
-            capture_output=True
-        )
-
-        if status.returncode == 0:
-            gitver = status.stdout.strip()
-            with open(gitfile, "w") as fh:
-                fh.write(gitver)
-        else:
+        if gitver == "NOGIT":
             for d in [".", srcdir]:
                 f = os.path.join(d, gitfile)
                 if not os.path.exists(f):
@@ -1262,6 +1243,10 @@ class vcc():
                 gitver = fh.read()
                 fh.close()
                 break;
+        else:
+            fh = open(gitfile, "w")
+            fh.write(gitver)
+            fh.close()
 
         if gitver == "NOGIT":
             print("WARNING: Neither git nor vmod_vcs_version.txt found.\n\t" +



More information about the varnish-commit mailing list