X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flp_json.c;fp=src%2Flp_json.c;h=2279220b76d10d122814a97d3b57b68f9eb6af5a;hb=f5fbf6bcfcac7e2b6df90e00f618c642539d013d;hp=1c31ccb6c2fe96338d4332878c149bc2c6e73049;hpb=9412dc53bab346c119e4d1502e65cd7c68487d30;p=ppastats.git diff --git a/src/lp_json.c b/src/lp_json.c index 1c31ccb..2279220 100644 --- a/src/lp_json.c +++ b/src/lp_json.c @@ -25,6 +25,7 @@ #include #include "lp_json.h" +#include "lp_ws.h" struct binary_package_publishing_history * json_object_to_binary_package_publishing_history(json_object *o) @@ -33,6 +34,7 @@ json_object_to_binary_package_publishing_history(json_object *o) const char *binary_package_version; const char *distro_arch_series_link; const char *self_link; + int architecture_specific; binary_package_name = json_object_get_string (json_object_object_get(o, "binary_package_name")); @@ -46,10 +48,17 @@ json_object_to_binary_package_publishing_history(json_object *o) self_link = json_object_get_string (json_object_object_get(o, "self_link")); + if (json_object_get_boolean + (json_object_object_get(o, "architecture_specific"))) + architecture_specific = 1; + else + architecture_specific = 0; + return binary_package_publishing_history_new(binary_package_name, binary_package_version, distro_arch_series_link, - self_link); + self_link, + architecture_specific); } struct distro_arch_series *json_object_to_distro_arch_series(json_object *o) @@ -113,8 +122,10 @@ struct binary_package_publishing_history * * json_object_to_binary_package_publishing_history_list(json_object *o) { json_object *o_entries; - int i, n; + int i, n, i2; struct binary_package_publishing_history **entries; + struct binary_package_publishing_history *h; + const struct distro_arch_series *distro; o_entries = json_object_object_get(o, "entries"); @@ -126,11 +137,24 @@ json_object_to_binary_package_publishing_history_list(json_object *o) entries = malloc (sizeof(struct binary_package_publishing_history *)*(n+1)); - for (i = 0; i < n; i++) { - entries[i] = json_object_to_binary_package_publishing_history + for (i = 0, i2 = 0; i < n; i++) { + h = json_object_to_binary_package_publishing_history (json_object_array_get_idx(o_entries, i)); + + if (!h->architecture_specific) { + distro = get_distro_arch_series + (h->distro_arch_series_link); + + if (!distro->is_nominated_arch_indep) { + binary_package_publishing_history_free(h); + continue ; + } + } + + entries[i2] = h; + i2++; } - entries[n] = NULL; + entries[i2] = NULL; return entries; }