auc: update to version 0.2.0
authorDaniel Golle <daniel@makrotopia.org>
Sun, 15 Aug 2021 01:14:20 +0000 (02:14 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 15 Aug 2021 01:33:53 +0000 (02:33 +0100)
 * support for ASU server post commit aparcar/asu@bac6de18

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/auc/Makefile
utils/auc/src/auc.c

index c7badf71f0ff183c9cf69329268057ac6bccbf0f..c8f1d9187a1dc9b2b060806b9062d4bc4610e3ec 100644 (file)
@@ -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
 
index 00d813b0569a72d394609c0e166f8373e1eb815b..8e8ac14f09483a84c6ed3ac6c15df2b8edaee7e7 100644 (file)
@@ -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);