summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fahlgren2025-09-29 20:19:44 +0000
committerEric Fahlgren2025-09-29 20:54:07 +0000
commitd4fa147470aab6aee4b23ef6327201c6be069ab1 (patch)
tree12fd364912f9b64d84fb55aa10e40f6a533b3d82
parent1905e096a8b722e67733cd4088026f571b27e521 (diff)
downloadrpcd-d4fa147470aab6aee4b23ef6327201c6be069ab1.tar.gz
rpc-sys: packagelist: handle ABI versions in apk world properly
It was originally assumed that all entries in '/etc/apk/world' would have ABI-versioned package names. This turns out to be false, and apk happily adds package names with or without the ABI version suffix. This causes the output from 'ubus call rpc-sys packagelist' to exclude some packages from the user-installed package list, thus causing them to disappear when doing an ASU build. Fix it by checking both versioned and unversioned package names. Link: https://forum.openwrt.org/t/owut-openwrt-upgrade-tool/200035/744 Fixes: https://github.com/efahl/owut/issues/49 Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
-rw-r--r--sys.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys.c b/sys.c
index 75fae48..fd7ad3b 100644
--- a/sys.c
+++ b/sys.c
@@ -318,10 +318,16 @@ rpc_sys_packagelist(struct ubus_context *ctx, struct ubus_object *obj,
break;
default:
if (is_blank(line)) {
- if (pkg[0] && ver[0] && is_all_or_world(pkg, world)) {
- if (abi[0])
+ if (pkg[0] && ver[0]) {
+ /* Need to check both ABI-versioned and non-versioned pkg */
+ bool keep = is_all_or_world(pkg, world);
+ if (abi[0]) {
pkg[strlen(pkg)-strlen(abi)] = '\0';
- blobmsg_add_string(&buf, pkg, ver);
+ if (!keep)
+ keep = is_all_or_world(pkg, world);
+ }
+ if (keep)
+ blobmsg_add_string(&buf, pkg, ver);
}
abi[0] = pkg[0] = ver[0] = '\0';
}