From: Daniel Golle Date: Sun, 15 Aug 2021 01:14:20 +0000 (+0100) Subject: auc: update to version 0.2.0 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b1d38e7ab3402e66bedc43dfd9d2fb7e41074511;p=feed%2Fpackages.git auc: update to version 0.2.0 * support for ASU server post commit aparcar/asu@bac6de18 Signed-off-by: Daniel Golle --- diff --git a/utils/auc/Makefile b/utils/auc/Makefile index c7badf71f0..c8f1d9187a 100644 --- a/utils/auc/Makefile +++ b/utils/auc/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=auc -PKG_VERSION:=0.1.9 +PKG_VERSION:=0.2.0 PKG_RELEASE:=$(AUTORELEASE) PKG_LICENSE:=GPL-3.0 diff --git a/utils/auc/src/auc.c b/utils/auc/src/auc.c index 00d813b056..8e8ac14f09 100644 --- a/utils/auc/src/auc.c +++ b/utils/auc/src/auc.c @@ -1202,6 +1202,7 @@ static int request_branches(bool only_active) struct blob_attr *tb[__REPLY_MAX]; int rem; char url[256]; + struct blob_attr *data; blobmsg_buf_init(&brbuf); snprintf(url, sizeof(url), "%s/%s/%s%s", serverurl, API_JSON, @@ -1214,10 +1215,16 @@ static int request_branches(bool only_active) blobmsg_parse(reply_policy, __REPLY_MAX, tb, blob_data(brbuf.head), blob_len(brbuf.head)); - if (!tb[REPLY_ARRAY]) + /* newer server API replies OBJECT, older API replies ARRAY... */ + if ((!tb[REPLY_ARRAY] && !tb[REPLY_OBJECT])) return -ENODATA; - blobmsg_for_each_attr(cur, tb[REPLY_ARRAY], rem) + if (tb[REPLY_OBJECT]) + data = tb[REPLY_OBJECT]; + else + data = tb[REPLY_ARRAY]; + + blobmsg_for_each_attr(cur, data, rem) process_branch(cur, only_active); blob_buf_free(&brbuf);