osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40941?usp=email )

Change subject: testenv: use separate cache dirs per distro
......................................................................

testenv: use separate cache dirs per distro

Change-Id: I0f1c05bb4d8cfababc24477976abf8a0baa3daba
---
M _testenv/testenv/cmd.py
M _testenv/testenv/podman.py
M _testenv/testenv/testsuite.py
3 files changed, 14 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved




diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py
index afe9003..6f50677 100644
--- a/_testenv/testenv/cmd.py
+++ b/_testenv/testenv/cmd.py
@@ -3,6 +3,7 @@
 import logging
 import os
 import os.path
+import re
 import subprocess
 import testenv
 import testenv.testsuite
@@ -14,6 +15,12 @@
 make_dir_version = 3


+def distro_cache_suffix():
+    if not testenv.args.podman or testenv.args.distro == "debian:bookworm":
+        return ""
+    return f"-{re.sub('[^a-zA-Z0-9]', '-', testenv.args.distro)}"
+
+
 def init_env():
     """Adjust "Environment variables set by testenv" in README.md when making
     changes here."""
@@ -26,6 +33,7 @@
             install_dir = "/"
         else:
             install_dir = os.path.join(testenv.args.cache, "podman/install")
+        install_dir += distro_cache_suffix()
     else:
         install_dir = os.path.join(testenv.args.cache, "host/install")

@@ -58,6 +66,7 @@
         make_dir += str(make_dir_version)
         if testenv.args.asan:
             make_dir += "-asan"
+        make_dir += distro_cache_suffix()
         env_extra["OSMO_DEV_MAKE_DIR"] = make_dir

     if testenv.args.kernel == "debian":
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 77a728f..8ce6766 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -102,8 +102,9 @@
     global apt_dir_var_lib
     global run_shell_on_stop

-    apt_dir_var_cache = os.path.join(testenv.args.cache, "podman", 
"var-cache-apt")
-    apt_dir_var_lib = os.path.join(testenv.args.cache, "podman", "var-lib-apt")
+    suffix = testenv.cmd.distro_cache_suffix()
+    apt_dir_var_cache = os.path.join(testenv.args.cache, "podman", 
f"var-cache-apt{suffix}")
+    apt_dir_var_lib = os.path.join(testenv.args.cache, "podman", 
f"var-lib-apt{suffix}")

     os.makedirs(apt_dir_var_cache, exist_ok=True)
     os.makedirs(apt_dir_var_lib, exist_ok=True)
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 8d89ad8..0e00b0f 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -41,7 +41,8 @@

     if testenv.args.podman or os.path.exists(ttcn3_dir):
         cache_dir = "podman" if testenv.args.podman else "host"
-        builddir = os.path.join(testenv.args.cache, cache_dir, 
f"titan-{titan_version}")
+        suffix = testenv.cmd.distro_cache_suffix()
+        builddir = os.path.join(testenv.args.cache, cache_dir, 
f"titan-{titan_version}{suffix}")
         path_old = testenv.cmd.generate_env(podman=testenv.args.podman)["PATH"]
         builddir_env = {
             "BUILDDIR": builddir,

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40941?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I0f1c05bb4d8cfababc24477976abf8a0baa3daba
Gerrit-Change-Number: 40941
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to