install_package() and uninstall_package() decide success by the package manager's exit status alone. The command is sent with the _RC_MARKER suffix the driver already uses for manage_service() and apply_updates(), and the result goes through the same _status_result() helper: status 0 is a success, any other status (or no status at all) a failure, with the cleaned output kept as output (or a message naming the status when the output is empty).
Why
Both methods searched the output for "error:", "failed", "not found" and "unknown package". opkg's dependency failure (Collected errors: / Cannot install package …) contains none of them and came back as a success, so a failed ensure_package("lldpd") read as done; a successful install of a package or file whose name contains "failed" came back as a failure.
Tests
Fixtures only. New tests/unit/test_packages.py, written first and failing on main: an opkg dependency failure with status 255 is no success; an apk install naming failed-login-notify with status 0 is a success; a marker behind a progress bar is still read; no status / a non-zero status without output are failures; opkg remove refused and apk del done. Full suite 230 passed, coverage 70 % (floor 65), ruff format/check clean, mypy clean.
## What
`install_package()` and `uninstall_package()` decide success by the package manager's exit status alone. The command is sent with the `_RC_MARKER` suffix the driver already uses for `manage_service()` and `apply_updates()`, and the result goes through the same `_status_result()` helper: status 0 is a success, any other status (or no status at all) a failure, with the cleaned output kept as `output` (or a message naming the status when the output is empty).
## Why
Both methods searched the output for "error:", "failed", "not found" and "unknown package". opkg's dependency failure (`Collected errors:` / `Cannot install package …`) contains none of them and came back as a success, so a failed `ensure_package("lldpd")` read as done; a successful install of a package or file whose name contains "failed" came back as a failure.
## Tests
Fixtures only. New `tests/unit/test_packages.py`, written first and failing on main: an opkg dependency failure with status 255 is no success; an apk install naming `failed-login-notify` with status 0 is a success; a marker behind a progress bar is still read; no status / a non-zero status without output are failures; `opkg remove` refused and `apk del` done. Full suite 230 passed, coverage 70 % (floor 65), ruff format/check clean, mypy clean.
Closes #28
install_package and uninstall_package searched the output for keywords.
opkg's dependency failure ("Collected errors:") contains none of them and
read as success; a successful install naming a "failed" file read as a
failure. Append the exit-status marker and let the status alone decide.
Closes#28
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
install_package()anduninstall_package()decide success by the package manager's exit status alone. The command is sent with the_RC_MARKERsuffix the driver already uses formanage_service()andapply_updates(), and the result goes through the same_status_result()helper: status 0 is a success, any other status (or no status at all) a failure, with the cleaned output kept asoutput(or a message naming the status when the output is empty).Why
Both methods searched the output for "error:", "failed", "not found" and "unknown package". opkg's dependency failure (
Collected errors:/Cannot install package …) contains none of them and came back as a success, so a failedensure_package("lldpd")read as done; a successful install of a package or file whose name contains "failed" came back as a failure.Tests
Fixtures only. New
tests/unit/test_packages.py, written first and failing on main: an opkg dependency failure with status 255 is no success; an apk install namingfailed-login-notifywith status 0 is a success; a marker behind a progress bar is still read; no status / a non-zero status without output are failures;opkg removerefused andapk deldone. Full suite 230 passed, coverage 70 % (floor 65), ruff format/check clean, mypy clean.Closes #28
install_package and uninstall_package searched the output for keywords. opkg's dependency failure ("Collected errors:") contains none of them and read as success; a successful install naming a "failed" file read as a failure. Append the exit-status marker and let the status alone decide. Closes #28