Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e79cd1fc8 | ||
|
|
304f404567 |
No files matched your search
@@ -7,6 +7,14 @@ recorded here; their history is the git log.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [4.36.1] - 2026-11-12
|
||||
|
||||
### Fixed
|
||||
- The host status no longer reports an Oracle Linux host's UEK kernels as an interrupted
|
||||
dnf transaction. The installonly packages are now also the ones the host's libdnf was
|
||||
built with, read from its Python binding: Oracle adds `kernel-uek` and its parts there,
|
||||
and their packages provide nothing of upstream's defaults (#107).
|
||||
|
||||
## [4.36.0] - 2026-11-11
|
||||
|
||||
### Added
|
||||
|
||||
@@ -13,9 +13,13 @@ what ``dnf check --duplicates`` and ``package-cleanup --dupes`` report. Packages
|
||||
dnf installs side by side on purpose do not count: its default ``installonlypkgs``
|
||||
(``kernel``, ``installonlypkg(kernel)`` and the rest), plus any the host adds in
|
||||
``dnf.conf``, asked of rpm by what they provide; and ``gpg-pubkey``, one entry
|
||||
per imported key. Also interrupted is a transaction that never ended: dnf 4's
|
||||
history (libdnf's ``trans`` table) holds its row with ``state`` 0 until
|
||||
``finish()`` writes 1 (done) or 2 (error), so the newest row at 0 is one cut off;
|
||||
per imported key. The defaults are the ones the host's libdnf was built with, asked
|
||||
of its Python binding, as a distribution may add its own: Oracle Linux adds
|
||||
``kernel-uek`` and its parts, whose packages provide nothing of upstream's list.
|
||||
Upstream's list is the floor where libdnf cannot be asked (dnf 5, yum). Also
|
||||
interrupted is a transaction that never ended: dnf 4's history (libdnf's ``trans``
|
||||
table) holds its row with ``state`` 0 until ``finish()`` writes 1 (done) or 2
|
||||
(error), so the newest row at 0 is one cut off;
|
||||
yum leaves a ``transaction-all.*`` journal in ``/var/lib/yum``, which
|
||||
``yum-complete-transaction`` reads (one renamed ``.disabled`` is given up). The
|
||||
history is read with Python's sqlite3 module in read-only mode, as a stock EL host
|
||||
@@ -81,6 +85,13 @@ _DNF_HISTORY_PY = (
|
||||
"r = c.execute('SELECT id, state FROM trans ORDER BY id DESC LIMIT 1').fetchone(); "
|
||||
"r and print(*r)"
|
||||
)
|
||||
#: The ``installonlypkgs`` the host's libdnf (dnf 4) was built with, space-separated;
|
||||
#: nothing where there is no libdnf. ``ConfigMain`` is held in a name: an option
|
||||
#: taken from a temporary one outlives it, and reading it then crashes Python.
|
||||
_LIBDNF_INSTALLONLY_PY = (
|
||||
"import libdnf.conf; c = libdnf.conf.ConfigMain(); "
|
||||
"print(c.installonlypkgs().getValueString().replace(',', ' '))"
|
||||
)
|
||||
|
||||
_RUNNING_PART = (
|
||||
"echo '[pm-running]'; cat /proc/[0-9]*/comm 2>/dev/null | grep -xE '"
|
||||
@@ -90,7 +101,10 @@ _RUNNING_PART = (
|
||||
_RPM_PART = (
|
||||
"if command -v rpm >/dev/null 2>&1 && { command -v dnf || command -v yum; } >/dev/null 2>&1; "
|
||||
"then echo '[rpm-frontend]'; { command -v dnf || command -v yum; } | sed 's#.*/##'; "
|
||||
"rpmpy=; for p in /usr/libexec/platform-python python3; do "
|
||||
"if command -v $p >/dev/null 2>&1; then rpmpy=$p; break; fi; done; "
|
||||
f"echo '[rpm-installonly]'; io=\"{' '.join(_INSTALLONLY)} "
|
||||
f'$([ -n "$rpmpy" ] && $rpmpy -c "{_LIBDNF_INSTALLONLY_PY}" 2>/dev/null) '
|
||||
f"$(sed -n 's/^[[:space:]]*installonlypkgs[[:space:]]*=//p' {_DNF_CONF} 2>/dev/null "
|
||||
"| tr ',' ' ')\"; rpm -q --whatprovides $io --qf '%{NAME}\\n' 2>/dev/null "
|
||||
"| grep -v ' ' | sort -u; "
|
||||
@@ -98,9 +112,8 @@ _RPM_PART = (
|
||||
"| grep -v '^gpg-pubkey ' | sort | uniq -d | head -n 50; "
|
||||
f"echo '[yum-journal]'; ls -1 {YUM_DIR} 2>/dev/null | grep '^transaction-all\\.' "
|
||||
"| head -n 20; "
|
||||
"echo '[dnf-history]'; for py in /usr/libexec/platform-python python3; do "
|
||||
f'if command -v $py >/dev/null 2>&1; then $py -c "{_DNF_HISTORY_PY}" 2>/dev/null; '
|
||||
"break; fi; done; fi; "
|
||||
"echo '[dnf-history]'; "
|
||||
f'[ -n "$rpmpy" ] && $rpmpy -c "{_DNF_HISTORY_PY}" 2>/dev/null; fi; '
|
||||
)
|
||||
_APK_PART = (
|
||||
f"if command -v apk >/dev/null 2>&1 && [ -r {APK_INSTALLED} ]; then echo '[apk-audit]'; "
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "napalm-device-types"
|
||||
version = "4.36.0"
|
||||
version = "4.36.1"
|
||||
description = "Abstract device-type base classes for NAPALM drivers"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
@@ -598,8 +598,8 @@ class TestInterruptedRpm:
|
||||
The outputs are shaped after the documented formats -- ``rpm -qa --qf``,
|
||||
libdnf's ``trans`` table (``state`` 0 = UNKNOWN until ``finish()`` sets DONE
|
||||
1 or ERROR 2), yum's ``transaction-all.*`` journal that
|
||||
``yum-complete-transaction`` reads -- and still have to be checked against a
|
||||
real Oracle Linux 9 host.
|
||||
``yum-complete-transaction`` reads. Checked against Oracle Linux 9 (build-arm-01,
|
||||
2026-11-12): its UEK kernels are installonly only by libdnf's built-in defaults.
|
||||
"""
|
||||
|
||||
INSTALLONLY = ("kernel-core", "kernel-modules", "kernel-uek-core")
|
||||
@@ -804,6 +804,29 @@ case "$*" in
|
||||
esac
|
||||
"""
|
||||
|
||||
#: An rpm on an Oracle Linux host: its UEK kernel ``vendor-kernel`` provides nothing
|
||||
#: of dnf's upstream defaults and sits in the database three times, like glibc twice.
|
||||
_RPM_VENDOR_KERNEL_STUB = """#!/bin/sh
|
||||
case "$*" in
|
||||
*--whatprovides*) for a; do [ "$a" = vendor-kernel ] && echo vendor-kernel; done
|
||||
echo 'no package provides kernel-PAE' ;;
|
||||
-qa*) printf '%s\\n' 'vendor-kernel aarch64' 'vendor-kernel aarch64' 'vendor-kernel aarch64' \\
|
||||
'glibc aarch64' 'glibc aarch64' ;;
|
||||
esac
|
||||
"""
|
||||
|
||||
#: libdnf's Python binding, as far as the command asks it: the installonlypkgs a
|
||||
#: distribution built into its libdnf -- here one more than upstream's.
|
||||
_LIBDNF_CONF = """class _Option:
|
||||
def getValueString(self):
|
||||
return "kernel, installonlypkg(kernel), vendor-kernel"
|
||||
|
||||
|
||||
class ConfigMain:
|
||||
def installonlypkgs(self):
|
||||
return _Option()
|
||||
"""
|
||||
|
||||
#: /lib/apk/db/installed shaped after apk-tools' database.c: busybox's script failed.
|
||||
_APK_DB = """C:Q1abc=
|
||||
P:alpine-baselayout
|
||||
@@ -886,6 +909,23 @@ class TestThePackageManagerCommandOnARealShell:
|
||||
assert status["package_manager"] == "dnf"
|
||||
assert status["interrupted_packages"] == [{"name": "glibc", "state": "duplicate"}]
|
||||
|
||||
def test_the_installonly_packages_libdnf_was_built_with(self, tmp_path, shell):
|
||||
"""Oracle builds kernel-uek into libdnf's defaults; its UEK packages provide
|
||||
nothing of upstream's, so only libdnf itself tells (#107)."""
|
||||
_skip_busybox_rpm(shell)
|
||||
env = _stubs(tmp_path, "rpm", "dnf")
|
||||
(tmp_path / "bin" / "rpm").write_text(_RPM_VENDOR_KERNEL_STUB)
|
||||
libdnf = tmp_path / "py" / "libdnf"
|
||||
libdnf.mkdir(parents=True)
|
||||
(libdnf / "__init__.py").write_text("")
|
||||
(libdnf / "conf.py").write_text(_LIBDNF_CONF)
|
||||
env["PYTHONPATH"] = str(tmp_path / "py")
|
||||
out = _run(PACKAGE_MANAGERS_COMMAND, env, shell)
|
||||
|
||||
status = parse_host_status(out)
|
||||
|
||||
assert status["interrupted_packages"] == [{"name": "glibc", "state": "duplicate"}]
|
||||
|
||||
def test_dnfs_last_transaction_that_never_ended(self, tmp_path, shell):
|
||||
_skip_busybox_rpm(shell)
|
||||
history = tmp_path / "history.sqlite"
|
||||
|
||||
Reference in new issue
Block a user