]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use a dedicated file for each autoconf variable
authorTom Krizek <tkrizek@isc.org>
Mon, 25 Mar 2024 13:56:08 +0000 (14:56 +0100)
committerNicki Křížek <nicki@isc.org>
Thu, 9 May 2024 15:08:10 +0000 (17:08 +0200)
To avoid any escaping issues or messing with a language-specific format
when the variable has to be parsed, create a dedicated file for each
variable that is obtained from autoconf.

16 files changed:
.gitlab-ci.yml
.reuse/dep5
bin/tests/system/.gitignore
bin/tests/system/isctest/vars/.ac_vars/CURL.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/NC.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/PERL.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/PYTEST.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/PYTHON.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/SHELL.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in [new file with mode: 0644]
bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in [new file with mode: 0644]
bin/tests/system/isctest/vars/autoconf.py [new file with mode: 0644]
bin/tests/system/isctest/vars/autoconf.py.in [deleted file]
configure.ac

index 27dcb698c75e56d9eba680d52b49543a5a12235d..8ae413727fa9be18f4aebce9299c1004511b7462 100644 (file)
@@ -271,11 +271,11 @@ stages:
 
 # change directory to the workspace before including this
 .find_python: &find_python
-  - PYTHON="$(sed -n -E 's|^[[:space:]]*"PYTHON":[[:space:]]*"([^"]*)",[[:space:]]*$|\1|p' bin/tests/system/isctest/vars/autoconf.py)"
+  - PYTHON="$(cat bin/tests/system/isctest/vars/.ac_vars/PYTHON)"
   - test -x "$PYTHON"
 
 .find_pytest: &find_pytest
-  - PYTEST="$(sed -n -E 's|^[[:space:]]*"PYTEST":[[:space:]]*"([^"]*)",[[:space:]]*$|\1|p' bin/tests/system/isctest/vars/autoconf.py)"
+  - PYTEST="$(cat bin/tests/system/isctest/vars/.ac_vars/PYTEST)"
   - test -x "$PYTEST"
 
 .parse_tsan: &parse_tsan
index 0de1a85da0630eb99328111a22f4cbfee77275dd..1becbd1686dcaad6b2c420b32a8e1e0117afe847 100644 (file)
@@ -47,6 +47,7 @@ Files: **/*.after*
        bin/tests/system/forward/CA/index.txt
        bin/tests/system/forward/CA/index.txt.attr
        bin/tests/system/forward/CA/serial
+       bin/tests/system/isctest/vars/.ac_vars/*
        bin/tests/system/journal/ns1/managed-keys.bind.in
        bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
        bin/tests/system/journal/ns2/managed-keys.bind.in
index 05ae7f8b4e3f65112cb3184c9618fbf87bc12959..3c2db219b0840ce9f74af4ba988003b56d400a0e 100644 (file)
@@ -19,7 +19,8 @@ named.run
 /start.sh
 /stop.sh
 /ifconfig.sh
-/isctest/vars/autoconf.py
+/isctest/vars/.ac_vars/*
+!/isctest/vars/.ac_vars/*.in
 
 # Ignore file names with underscore in their name except python or shell files.
 # This is done to ignore the temporary directories and symlinks created by the
diff --git a/bin/tests/system/isctest/vars/.ac_vars/CURL.in b/bin/tests/system/isctest/vars/.ac_vars/CURL.in
new file mode 100644 (file)
index 0000000..0772e63
--- /dev/null
@@ -0,0 +1 @@
+@CURL@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in b/bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in
new file mode 100644 (file)
index 0000000..d6b9931
--- /dev/null
@@ -0,0 +1 @@
+@FSTRM_CAPTURE@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/NC.in b/bin/tests/system/isctest/vars/.ac_vars/NC.in
new file mode 100644 (file)
index 0000000..b1181ca
--- /dev/null
@@ -0,0 +1 @@
+@NC@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/PERL.in b/bin/tests/system/isctest/vars/.ac_vars/PERL.in
new file mode 100644 (file)
index 0000000..f6644c1
--- /dev/null
@@ -0,0 +1 @@
+@PERL@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/PYTEST.in b/bin/tests/system/isctest/vars/.ac_vars/PYTEST.in
new file mode 100644 (file)
index 0000000..f6700d5
--- /dev/null
@@ -0,0 +1 @@
+@PYTEST@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/PYTHON.in b/bin/tests/system/isctest/vars/.ac_vars/PYTHON.in
new file mode 100644 (file)
index 0000000..5d697c3
--- /dev/null
@@ -0,0 +1 @@
+@PYTHON@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/SHELL.in b/bin/tests/system/isctest/vars/.ac_vars/SHELL.in
new file mode 100644 (file)
index 0000000..e65178b
--- /dev/null
@@ -0,0 +1 @@
+@SHELL@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in b/bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in
new file mode 100644 (file)
index 0000000..ad1e3ec
--- /dev/null
@@ -0,0 +1 @@
+@abs_top_builddir@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in b/bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in
new file mode 100644 (file)
index 0000000..ab6784b
--- /dev/null
@@ -0,0 +1 @@
+@abs_top_srcdir@
diff --git a/bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in b/bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in
new file mode 100644 (file)
index 0000000..86d98e0
--- /dev/null
@@ -0,0 +1 @@
+@XSLTPROC@
diff --git a/bin/tests/system/isctest/vars/autoconf.py b/bin/tests/system/isctest/vars/autoconf.py
new file mode 100644 (file)
index 0000000..7000ef2
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+from pathlib import Path
+from typing import Dict
+
+
+def load_ac_vars_from_files() -> Dict[str, str]:
+    ac_vars = {}
+    ac_vars_dir = Path(__file__).resolve().parent / ".ac_vars"
+    var_paths = [
+        path
+        for path in ac_vars_dir.iterdir()
+        if path.is_file() and not path.name.endswith(".in")
+    ]
+    for var_path in var_paths:
+        ac_vars[var_path.name] = var_path.read_text(encoding="utf-8").strip()
+    return ac_vars
+
+
+AC_VARS = load_ac_vars_from_files()
diff --git a/bin/tests/system/isctest/vars/autoconf.py.in b/bin/tests/system/isctest/vars/autoconf.py.in
deleted file mode 100644 (file)
index 5f1741b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-AC_VARS = {
-    "TOP_BUILDDIR": "@abs_top_builddir@",
-    "TOP_SRCDIR": "@abs_top_srcdir@",
-    "FSTRM_CAPTURE": "@FSTRM_CAPTURE@",
-    "SHELL": "@SHELL@",
-    "PYTHON": "@PYTHON@",
-    "PERL": "@PERL@",
-    "CURL": "@CURL@",
-    "NC": "@NC@",
-    "XSLTPROC": "@XSLTPROC@",
-    "PYTEST": "@PYTEST@",
-}
index 31c965697c50f61cdf3f6d33082c12df979bfdbc..bf7405cc1b1d4bb4972259a32a3abde28380d2dc 100644 (file)
@@ -1656,7 +1656,16 @@ AC_CONFIG_FILES([tests/unit-test-driver.sh],
 
 AC_CONFIG_FILES([bin/tests/Makefile
                 bin/tests/system/Makefile
-                bin/tests/system/isctest/vars/autoconf.py
+                bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR
+                bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR
+                bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE
+                bin/tests/system/isctest/vars/.ac_vars/SHELL
+                bin/tests/system/isctest/vars/.ac_vars/PYTHON
+                bin/tests/system/isctest/vars/.ac_vars/PERL
+                bin/tests/system/isctest/vars/.ac_vars/CURL
+                bin/tests/system/isctest/vars/.ac_vars/NC
+                bin/tests/system/isctest/vars/.ac_vars/XSLTPROC
+                bin/tests/system/isctest/vars/.ac_vars/PYTEST
                 bin/tests/system/dyndb/driver/Makefile
                 bin/tests/system/dlzexternal/driver/Makefile
                 bin/tests/system/hooks/driver/Makefile