osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40948?usp=email )
Change subject: testenv: enable_binary_repo: configure apt pin ......................................................................
testenv: enable_binary_repo: configure apt pin
Add an apt-pin to ensure packages from the Osmocom repositories get preferred over Debian's packages. I just ran into this with osmo-mgw, where we have 1.4.0 in osmocom:latest and Debian 13 has 1.14.0+dfsg1-2, which counts as higher version. This results in the wrong package being selected, and also in an error later on when trying to install related debug packages from our repository:
The following packages have unmet dependencies: osmo-mgw-dbgsym : Depends: osmo-mgw (= 1.14.0) but 1.14.0+dfsg1-2 is to be installed
Change-Id: I3a45de277bbd5299c8b840680b56b52a8731caa4 --- M _testenv/testenv/podman.py 1 file changed, 9 insertions(+), 2 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, approved
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py index bc45b3a..678a0c1 100644 --- a/_testenv/testenv/podman.py +++ b/_testenv/testenv/podman.py @@ -301,16 +301,23 @@
def enable_binary_repo(): + # Add the binary repository config = "deb [signed-by=/obs.key]" config += " https://downloads.osmocom.org/packages/" config += testenv.args.binary_repo.replace(":", ":/") config += "/" config += testenv.distros_repodirs[distro] config += "/ ./" - path = "/etc/apt/sources.list.d/osmocom.list" - exec_cmd(["sh", "-c", f"echo {shlex.quote(config)} > {path}"]) + + # Add an apt-pin to prefer its packages + config = "Package: *\n" + config += 'Pin: origin "downloads.osmocom.org"\n' + config += "Pin-Priority: 1100\n" + path = "/etc/apt/preferences.d/osmocom-apt-pin" + exec_cmd(["sh", "-c", f"echo {shlex.quote(config)} > {path}"]) + exec_cmd(["apt-get", "-q", "update"])