diff options
author | Christian Franke <nobody@nowhere.ws> | 2019-07-11 12:49:05 +0200 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-07-11 18:15:01 -0300 |
commit | e85b85773ea6450a6c008a8258b5d6a910b62391 (patch) | |
tree | 0aea51eff1e6b5d2b49397981c0e01abe3fbf420 /testing/libyang | |
parent | b883ce448342ad0820a0e04f58b1c64b8d21c20f (diff) | |
download | aports-e85b85773ea6450a6c008a8258b5d6a910b62391.tar.bz2 aports-e85b85773ea6450a6c008a8258b5d6a910b62391.tar.xz |
testing/libyang: update to 1.0-r3
Both of the fixes which were necessary for 1.0-r2 have made it into
the 1.0-r3 release, so we can drop them here.
Diffstat (limited to 'testing/libyang')
-rw-r--r-- | testing/libyang/09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch | 154 | ||||
-rw-r--r-- | testing/libyang/5b3c324097fa3e122edb774213aeafd6eba137f9.patch | 136 | ||||
-rw-r--r-- | testing/libyang/APKBUILD | 11 |
3 files changed, 3 insertions, 298 deletions
diff --git a/testing/libyang/09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch b/testing/libyang/09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch deleted file mode 100644 index b6c54e5110..0000000000 --- a/testing/libyang/09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 09e7159e4f91a39f3d19ba6590d558ab027a8a84 Mon Sep 17 00:00:00 2001 -From: Michal Vasko <mvasko@cesnet.cz> -Date: Tue, 9 Apr 2019 12:19:54 +0200 -Subject: [PATCH] lyb BUGFIX big endian platforms fixes - -Refs #749 ---- - src/parser_lyb.c | 41 +++++++++++++++++++---------------------- - src/printer_lyb.c | 14 ++------------ - 2 files changed, 21 insertions(+), 34 deletions(-) - -diff --git a/src/parser_lyb.c b/src/parser_lyb.c -index 8baeabbf..3de1bb17 100644 ---- a/src/parser_lyb.c -+++ b/src/parser_lyb.c -@@ -120,32 +120,29 @@ lyb_read(const char *data, uint8_t *buf, size_t count, struct lyb_state *lybs) - } - - static int --lyb_read_number(uint64_t *num, size_t num_size, size_t bytes, const char *data, struct lyb_state *lybs) -+lyb_read_number(void *num, size_t num_size, size_t bytes, const char *data, struct lyb_state *lybs) - { - int r, ret = 0; -- size_t i; -- uint8_t byte; -- -- for (i = 0; i < bytes; ++i) { -- ret += (r = lyb_read(data, &byte, 1, lybs)); -- LYB_HAVE_READ_RETURN(r, data, -1); -+ uint64_t buf = 0; - -- *(((uint8_t *)num) + i) = byte; -- } -+ ret += (r = lyb_read(data, (uint8_t *)&buf, bytes, lybs)); -+ LYB_HAVE_READ_RETURN(r, data, -1); - - /* correct byte order */ -+ buf = le64toh(buf); -+ - switch (num_size) { - case 1: -- /* no need to do anything */ -+ *((uint8_t *)num) = buf; - break; - case 2: -- *num = le16toh(*num); -+ *((uint16_t *)num) = buf; - break; - case 4: -- *num = le32toh(*num); -+ *((uint32_t *)num) = buf; - break; - case 8: -- *num = le64toh(*num); -+ *((uint64_t *)num) = buf; - break; - default: - LOGINT(lybs->ctx); -@@ -182,7 +179,7 @@ lyb_read_string(const char *data, char **str, int with_length, struct lyb_state - size_t len = 0, cur_len; - - if (with_length) { -- ret += (r = lyb_read_number((uint64_t *)&len, sizeof len, 2, data, lybs)); -+ ret += (r = lyb_read_number(&len, sizeof len, 2, data, lybs)); - LYB_HAVE_READ_GOTO(r, data, error); - } else { - /* read until the end of this subtree */ -@@ -269,7 +266,7 @@ lyb_parse_model(const char *data, const struct lys_module **mod, struct lyb_stat - LYB_HAVE_READ_GOTO(r, data, error); - - /* revision */ -- ret += (r = lyb_read(data, (uint8_t *)&rev, 2, lybs)); -+ ret += (r = lyb_read_number(&rev, sizeof rev, 2, data, lybs)); - LYB_HAVE_READ_GOTO(r, data, error); - - if (rev) { -@@ -470,20 +467,20 @@ lyb_parse_val_1(struct lys_type *type, LY_DATA_TYPE value_type, uint8_t value_fl - break; - case LY_TYPE_INT8: - case LY_TYPE_UINT8: -- ret = lyb_read_number((uint64_t *)&value->uint8, sizeof value->uint8, 1, data, lybs); -+ ret = lyb_read_number(&value->uint8, sizeof value->uint8, 1, data, lybs); - break; - case LY_TYPE_INT16: - case LY_TYPE_UINT16: -- ret = lyb_read_number((uint64_t *)&value->uint16, sizeof value->uint16, 2, data, lybs); -+ ret = lyb_read_number(&value->uint16, sizeof value->uint16, 2, data, lybs); - break; - case LY_TYPE_INT32: - case LY_TYPE_UINT32: -- ret = lyb_read_number((uint64_t *)&value->uint32, sizeof value->uint32, 4, data, lybs); -+ ret = lyb_read_number(&value->uint32, sizeof value->uint32, 4, data, lybs); - break; - case LY_TYPE_DEC64: - case LY_TYPE_INT64: - case LY_TYPE_UINT64: -- ret = lyb_read_number((uint64_t *)&value->uint64, sizeof value->uint64, 8, data, lybs); -+ ret = lyb_read_number(&value->uint64, sizeof value->uint64, 8, data, lybs); - break; - default: - return -1; -@@ -1164,7 +1161,7 @@ lyb_parse_data_models(const char *data, struct lyb_state *lybs) - int i, r, ret = 0; - - /* read model count */ -- ret += (r = lyb_read_number((uint64_t *)&lybs->mod_count, sizeof lybs->mod_count, 2, data, lybs)); -+ ret += (r = lyb_read_number(&lybs->mod_count, sizeof lybs->mod_count, 2, data, lybs)); - LYB_HAVE_READ_RETURN(r, data, -1); - - lybs->models = malloc(lybs->mod_count * sizeof *lybs->models); -@@ -1349,14 +1346,14 @@ lyd_lyb_data_length(const char *data) - LYB_HAVE_READ_GOTO(r, data, finish); - - /* read model count */ -- ret += (r = lyb_read_number((uint64_t *)&lybs.mod_count, sizeof lybs.mod_count, 2, data, &lybs)); -+ ret += (r = lyb_read_number(&lybs.mod_count, sizeof lybs.mod_count, 2, data, &lybs)); - LYB_HAVE_READ_GOTO(r, data, finish); - - /* read all models */ - for (i = 0; i < lybs.mod_count; ++i) { - /* module name length */ - len = 0; -- ret += (r = lyb_read_number((uint64_t *)&len, sizeof len, 2, data, &lybs)); -+ ret += (r = lyb_read_number(&len, sizeof len, 2, data, &lybs)); - LYB_HAVE_READ_GOTO(r, data, finish); - - /* model name */ -diff --git a/src/printer_lyb.c b/src/printer_lyb.c -index 5a3deda5..928332af 100644 ---- a/src/printer_lyb.c -+++ b/src/printer_lyb.c -@@ -480,20 +480,10 @@ lyb_write_start_subtree(struct lyout *out, struct lyb_state *lybs) - static int - lyb_write_number(uint64_t num, size_t bytes, struct lyout *out, struct lyb_state *lybs) - { -- int ret = 0; -- size_t i; -- uint8_t byte; -- -+ /* correct byte order */ - num = htole64(num); -- for (i = 0; i < bytes; ++i) { -- byte = *(((uint8_t *)&num) + i); -- ret += lyb_write(out, &byte, 1, lybs); -- if (ret < 0) { -- break; -- } -- } - -- return ret; -+ return lyb_write(out, (uint8_t *)&num, bytes, lybs); - } - - static int diff --git a/testing/libyang/5b3c324097fa3e122edb774213aeafd6eba137f9.patch b/testing/libyang/5b3c324097fa3e122edb774213aeafd6eba137f9.patch deleted file mode 100644 index a589521c77..0000000000 --- a/testing/libyang/5b3c324097fa3e122edb774213aeafd6eba137f9.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 5b3c324097fa3e122edb774213aeafd6eba137f9 Mon Sep 17 00:00:00 2001 -From: Michal Vasko <mvasko@cesnet.cz> -Date: Mon, 8 Apr 2019 13:45:21 +0200 -Subject: [PATCH] lyb parser BUGFIX correct byte order for all numbers - -Fixes #747 ---- - src/parser_lyb.c | 50 ++++++++++++++++++++++++++++++------------------ - 1 file changed, 31 insertions(+), 19 deletions(-) - -diff --git a/src/parser_lyb.c b/src/parser_lyb.c -index 628fba91..8baeabbf 100644 ---- a/src/parser_lyb.c -+++ b/src/parser_lyb.c -@@ -120,7 +120,7 @@ lyb_read(const char *data, uint8_t *buf, size_t count, struct lyb_state *lybs) - } - - static int --lyb_read_number(uint64_t *num, size_t bytes, const char *data, struct lyb_state *lybs) -+lyb_read_number(uint64_t *num, size_t num_size, size_t bytes, const char *data, struct lyb_state *lybs) - { - int r, ret = 0; - size_t i; -@@ -133,15 +133,32 @@ lyb_read_number(uint64_t *num, size_t bytes, const char *data, struct lyb_state - *(((uint8_t *)num) + i) = byte; - } - -+ /* correct byte order */ -+ switch (num_size) { -+ case 1: -+ /* no need to do anything */ -+ break; -+ case 2: -+ *num = le16toh(*num); -+ break; -+ case 4: -+ *num = le32toh(*num); -+ break; -+ case 8: -+ *num = le64toh(*num); -+ break; -+ default: -+ LOGINT(lybs->ctx); -+ return -1; -+ } -+ - return ret; - } - - static int - lyb_read_enum(uint64_t *enum_idx, uint32_t count, const char *data, struct lyb_state *lybs) - { -- int ret = 0; - size_t bytes; -- uint64_t tmp_enum = 0; - - if (count < (1 << 8)) { - bytes = 1; -@@ -153,11 +170,9 @@ lyb_read_enum(uint64_t *enum_idx, uint32_t count, const char *data, struct lyb_s - bytes = 4; - } - -- /* The enum is always read into a uint64_t buffer */ -- ret = lyb_read_number(&tmp_enum, bytes, data, lybs); -- *enum_idx = le64toh(tmp_enum); -- -- return ret; -+ /* enum is always read into a uint64_t buffer */ -+ *enum_idx = 0; -+ return lyb_read_number(enum_idx, sizeof *enum_idx, bytes, data, lybs); - } - - static int -@@ -167,7 +182,7 @@ lyb_read_string(const char *data, char **str, int with_length, struct lyb_state - size_t len = 0, cur_len; - - if (with_length) { -- ret += (r = lyb_read_number((uint64_t *)&len, 2, data, lybs)); -+ ret += (r = lyb_read_number((uint64_t *)&len, sizeof len, 2, data, lybs)); - LYB_HAVE_READ_GOTO(r, data, error); - } else { - /* read until the end of this subtree */ -@@ -455,23 +470,20 @@ lyb_parse_val_1(struct lys_type *type, LY_DATA_TYPE value_type, uint8_t value_fl - break; - case LY_TYPE_INT8: - case LY_TYPE_UINT8: -- ret = lyb_read_number((uint64_t *)&value->uint8, 1, data, lybs); -+ ret = lyb_read_number((uint64_t *)&value->uint8, sizeof value->uint8, 1, data, lybs); - break; - case LY_TYPE_INT16: - case LY_TYPE_UINT16: -- ret = lyb_read_number((uint64_t *)&value->uint16, 2, data, lybs); -- value->uint16 = le16toh(value->uint16); -+ ret = lyb_read_number((uint64_t *)&value->uint16, sizeof value->uint16, 2, data, lybs); - break; - case LY_TYPE_INT32: - case LY_TYPE_UINT32: -- ret = lyb_read_number((uint64_t *)&value->uint32, 4, data, lybs); -- value->uint32 = le32toh(value->uint32); -+ ret = lyb_read_number((uint64_t *)&value->uint32, sizeof value->uint32, 4, data, lybs); - break; - case LY_TYPE_DEC64: - case LY_TYPE_INT64: - case LY_TYPE_UINT64: -- ret = lyb_read_number((uint64_t *)&value->uint64, 8, data, lybs); -- value->uint64 = le64toh(value->uint64); -+ ret = lyb_read_number((uint64_t *)&value->uint64, sizeof value->uint64, 8, data, lybs); - break; - default: - return -1; -@@ -1152,7 +1164,7 @@ lyb_parse_data_models(const char *data, struct lyb_state *lybs) - int i, r, ret = 0; - - /* read model count */ -- ret += (r = lyb_read_number((uint64_t *)&lybs->mod_count, 2, data, lybs)); -+ ret += (r = lyb_read_number((uint64_t *)&lybs->mod_count, sizeof lybs->mod_count, 2, data, lybs)); - LYB_HAVE_READ_RETURN(r, data, -1); - - lybs->models = malloc(lybs->mod_count * sizeof *lybs->models); -@@ -1337,14 +1349,14 @@ lyd_lyb_data_length(const char *data) - LYB_HAVE_READ_GOTO(r, data, finish); - - /* read model count */ -- ret += (r = lyb_read_number((uint64_t *)&lybs.mod_count, 2, data, &lybs)); -+ ret += (r = lyb_read_number((uint64_t *)&lybs.mod_count, sizeof lybs.mod_count, 2, data, &lybs)); - LYB_HAVE_READ_GOTO(r, data, finish); - - /* read all models */ - for (i = 0; i < lybs.mod_count; ++i) { - /* module name length */ - len = 0; -- ret += (r = lyb_read_number((uint64_t *)&len, 2, data, &lybs)); -+ ret += (r = lyb_read_number((uint64_t *)&len, sizeof len, 2, data, &lybs)); - LYB_HAVE_READ_GOTO(r, data, finish); - - /* model name */ diff --git a/testing/libyang/APKBUILD b/testing/libyang/APKBUILD index 097daebd22..2a835b7921 100644 --- a/testing/libyang/APKBUILD +++ b/testing/libyang/APKBUILD @@ -1,7 +1,7 @@ # Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net> # Maintainer: Christian Franke <nobody@nowhere.ws> pkgname=libyang -pkgver=1.0_p2 +pkgver=1.0_p3 _realver=${pkgver/_p/-r} pkgrel=1 pkgdesc="YANG data modelling language parser and toolkit" @@ -12,10 +12,7 @@ depends="" makedepends="bison cmake cmocka-dev flex pcre-dev" install="" subpackages="$pkgname-dev $pkgname-doc" -source="${pkgname}-${pkgver}.tar.gz::https://github.com/CESNET/$pkgname/archive/v$_realver.tar.gz - 5b3c324097fa3e122edb774213aeafd6eba137f9.patch - 09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch - " +source="${pkgname}-${pkgver}.tar.gz::https://github.com/CESNET/$pkgname/archive/v$_realver.tar.gz" builddir="$srcdir/$pkgname-$_realver/build" prepare() { @@ -48,6 +45,4 @@ package() { make DESTDIR="$pkgdir" install } -sha512sums="1ed184b43b2163fe15bb13e683083a142f8624430b00a6f491d58a52ce4bde5603c1a0b5aac6cd314de1b5c9c608bee0ad7a1409c7be14836debe4c348b7a915 libyang-1.0_p2.tar.gz -6878f0ba6994242ea89b48d2a4cc24a64c368cc597de5ef7f8d8d30c531eb18ac39b5c6ecb3c19e73f30b9f62a854c9c7be03d748f338386781d343f432faf88 5b3c324097fa3e122edb774213aeafd6eba137f9.patch -90af183226d757085d728db8ef6e2c5070885519e6eba17a38b4cb6343518030e52d154b0ff45fa9d95373e173b97bb3d9edb701ccede7e2ef0573b75083880c 09e7159e4f91a39f3d19ba6590d558ab027a8a84.patch" +sha512sums="02573db0085c9d15b49f38d1f4eea311ea91c20b4c45c33194bbcd0e2e7f00a286dd7053919138a543744913387c8c47f5024740d70477f40d700ca9d3f5bbd6 libyang-1.0_p3.tar.gz" |