summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-03-10 22:45:51 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-03-11 00:17:58 +0000
commitccb75178cf6a726896729c6904bd623636aa0b29 (patch)
tree1981d68c6c9f8e822b6f633b4f0f6cb55ed7f2eb
parentd3f2041f4363e76fda57dd6b581eb71cf1a0e114 (diff)
downloadrpcd-ccb75178cf6a726896729c6904bd623636aa0b29.tar.gz
sys: packagelist: drop ABI version from package name
Having the ABI version appended to the package name is not very helpful when checking for updated versions of a package online or requesting a new image for the device from an updater service. In both cases, the ABI version could have been bumped meanwhile and that name is then simply not found. Resolve this by removing the appended ABI version in the output of the rpc-sys packagelist call. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--sys.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys.c b/sys.c
index fecf66c..69daa1b 100644
--- a/sys.c
+++ b/sys.c
@@ -228,6 +228,18 @@ procstr:
continue;
}
+ /* If there is ABIVersion, remove that suffix */
+ if (!strcmp(var, "ABIVersion:")) {
+ if (strlen(pkg) <= strlen(p1))
+ continue;
+ tmp = &pkg[strlen(pkg) - strlen(p1)];
+ if (strncmp(p1, tmp, strlen(p1)))
+ continue;
+
+ *tmp = '\0';
+ continue;
+ }
+
if (!strcmp(var, "Version:")) {
strncpy(ver, p1, sizeof(ver));
continue;