osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43778?usp=email )


Change subject: testenv: podman_install: remove from_source()
......................................................................

testenv: podman_install: remove from_source()

All building from source is now done through osmo-dev.

Change-Id: I4e4d16aa665b1c7d744c97f1699229a6607b4fe1
---
M _testenv/testenv.py
M _testenv/testenv/podman_install.py
2 files changed, 3 insertions(+), 81 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/78/43778/1

diff --git a/_testenv/testenv.py b/_testenv/testenv.py
index 695a857..ffbff12 100755
--- a/_testenv/testenv.py
+++ b/_testenv/testenv.py
@@ -39,7 +39,6 @@
     if osmo_dev_has_any_targets:
         testenv.osmo_dev.check_init_needed()

-    testenv.podman_install.init()
     if osmo_dev_has_any_targets:
         testenv.cmd.init_env_osmo_dev()
     if testenv.args.binary_repo:
diff --git a/_testenv/testenv/podman_install.py 
b/_testenv/testenv/podman_install.py
index 3aff51e..dbadc9d 100644
--- a/_testenv/testenv/podman_install.py
+++ b/_testenv/testenv/podman_install.py
@@ -1,10 +1,7 @@
 # Copyright 2024 sysmocom - s.f.m.c. GmbH
 # SPDX-License-Identifier: GPL-3.0-or-later
 import logging
-import multiprocessing
 import os
-import packaging.version
-import re
 import shlex
 import string
 import subprocess
@@ -12,27 +9,6 @@
 import testenv.cmd
 import testenv.podman

-git_dir = None
-jobs = None
-
-
-def init():
-    global git_dir
-    global jobs
-
-    # Make the git dir we clone into specific to the repository we build
-    # against. Replace ":" because the libtool scripts fail to escape it when
-    # setting LD_LIBRARY_PATH, leading to "cannot open shared object file"
-    # errors.
-    git_dir = os.path.join(testenv.args.cache, "git", 
f"build_against_{testenv.args.binary_repo}".replace(":", "_"))
-
-    if testenv.args.jobs:
-        jobs = testenv.args.jobs
-    else:
-        jobs = multiprocessing.cpu_count()
-
-    os.makedirs(git_dir, exist_ok=True)
-

 def get_dbg_pkgs(dep):
     ret = [f"{dep}-dbg", f"{dep}-dbgsym"]
@@ -99,61 +75,6 @@
     testenv.cmd.run(["apt-get", "-q", "install", "-y", 
"--no-install-recommends"] + pkgs)


-def show_commit(project, cwd):
-    cmd = ["git", "-P", "-C", cwd, "-c", "color.ui=always", "log", "-1", 
"--oneline"]
-    logging.info(f"{project}: showing current commit")
-    testenv.cmd.run(cmd, no_podman=True)
-
-
-def clone_project(project):
-    git_dir_project = os.path.join(git_dir, project)
-    if os.path.exists(git_dir_project):
-        logging.debug(f"{project}: already cloned")
-        show_commit(project, git_dir_project)
-        return
-
-    branch = "master"
-    url = f"https://gerrit.osmocom.org/{project}";
-    if testenv.args.binary_repo.endswith(":latest"):
-        ls_remote = testenv.cmd.run(["git", "ls-remote", "--tags", url], 
capture_output=True, text=True, no_podman=True)
-        tags = []
-        pattern = re.compile("^\\d+\\.\\d+\\.\\d+$")
-        for line in ls_remote.stdout.split("\n"):
-            if "refs/tags/" in line:
-                tag = line.split("refs/tags/")[1].split("^")[0]
-                if pattern.match(tag):
-                    tags += [tag]
-        tags.sort(key=packaging.version.Version, reverse=True)
-        branch = tags[0]
-
-    logging.info(f"{project}: cloning {branch}")
-    testenv.cmd.run(
-        [
-            "git",
-            "-c",
-            "advice.detachedHead=false",
-            "-C",
-            git_dir,
-            "clone",
-            "--depth",
-            "1",
-            "--branch",
-            branch,
-            url,
-        ],
-        no_podman=True,
-    )
-    show_commit(project, git_dir_project)
-
-
-def from_source(cfg, cfg_name, section):
-    logging.error(f"Can't install {section}! Fix this by either:")
-    logging.error(f"* Adding package= to [{section}] in {cfg_name}")
-    logging.error("  (if it can be installed from binary packages)")
-    logging.error("* Editing from_source() in testenv/podman_install.py")
-    sys.exit(1)
-
-
 def packages(cfg, cfg_name):
     packages = []

@@ -166,6 +87,8 @@
                 continue
             packages += section_data["package"].split(" ")
         else:
-            from_source(cfg, cfg_name, section)
+            logging.error(f"Missing package= line in [{section}] of 
{cfg_name}!")
+            logging.error("See _testenv/README.md for more information.")
+            sys.exit(1)

     apt_install(packages)

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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4e4d16aa665b1c7d744c97f1699229a6607b4fe1
Gerrit-Change-Number: 43778
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to