osmith submitted this change.
testenv: add --install-package
Add an option to quickly install packages in the container. This is
useful when making a new SUT run with osmo-ttcn3-hacks and figuring out
which packages need to be installed to make the build pass (without
rebuilding the whole container for each missing dependency). It can also
be used to quickly install additional debugging tools (strace, valgrind,
etc.). A cache for the deb files is already getting mounted inside the
container.
Change-Id: Ie54817e6c0334a224a612521beb378537c10d39d
---
M _testenv/testenv/__init__.py
M _testenv/testenv/podman.py
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index 44259c2..8a3b728 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -210,6 +210,14 @@
action="store_true",
help="run an interactive shell before stopping daemons/container",
)
+ group.add_argument(
+ "-I",
+ "--install-package",
+ dest="install_packages",
+ action="append",
+ metavar="PACKAGE",
+ help="temporarily install a debian package in the container",
+ )
group = sub_run.add_argument_group("output options")
group.add_argument(
@@ -272,6 +280,9 @@
if args.kernel == "debian" and not args.podman:
raise NoTraceException("--kernel-debian requires --podman")
+ if args.install_packages and not args.podman:
+ raise NoTraceException("--install-packages requires --podman")
+
if args.kernel == "custom" and not os.path.exists(custom_kernel_path):
logging.critical(
"See _testenv/README.md for more information on downloading a pre-built kernel or building your own kernel."
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 678a0c1..2013699 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -285,6 +285,9 @@
if not os.path.exists(pkgcache):
exec_cmd(["apt-get", "-q", "update"])
+ if testenv.args.install_packages:
+ exec_cmd(["apt-get", "install", "-y", "--no-install-recommends"] + testenv.args.install_packages)
+
def check_titan_version():
version, _ = testenv.testenv_cfg.get_titan_version_first_cfg()
To view, visit change 41215. To unsubscribe, or for help writing mail filters, visit settings.