Subject: [alpine-aports] [PATCH] testing/knot: upgrade to 2.0.1

From: Dennis Przytarski <[email-masked]>
Date: Tue, 20 Oct 2015 21:42:14 +0000

---
 testing/knot/APKBUILD                |  21 ++-
 testing/knot/dnssec-timestamps.patch | 307 -----------------------------------
 testing/knot/wire-ctx.patch          |  20 +++
 3 files changed, 30 insertions(+), 318 deletions(-)
 delete mode 100644 testing/knot/dnssec-timestamps.patch
 create mode 100644 testing/knot/wire-ctx.patch

diff --git a/testing/knot/APKBUILD b/testing/knot/APKBUILD
index 8cab834..3d4604f 100644
--- a/testing/knot/APKBUILD
+++ b/testing/knot/APKBUILD
@@ -2,8 +2,8 @@
 # Contributor: Dennis Przytarski <[email-masked]>
 # Maintainer: Francesco Colista <[email-masked]>
 pkgname=knot
-pkgver=2.0.0
-pkgrel=2
+pkgver=2.0.1
+pkgrel=0
 pkgdesc="An high-performance authoritative-only DNS server"
 url="https://www.knot-dns.cz"
 arch="all"
@@ -12,7 +12,7 @@ options=""
 depends=""
 depends_dev="gnutls-dev jansson-dev libcap-ng-dev 
 	libidn-dev openssl-dev userspace-rcu-dev zlib-dev"
-makedepends="$depends_dev automake autoconf m4 bison flex perl libtool"
+makedepends="$depends_dev m4 bison flex perl libtool"
 install="$pkgname.pre-install $pkgname.post-install"
 pkgusers="knot"
 pkggroups="knot"
@@ -20,7 +20,7 @@ subpackages="$pkgname-dev $pkgname-doc"
 source="https://secure.nic.cz/files/knot-dns/${pkgname}-${pkgver}.tar.xz
 	knotd.confd
 	knotd.initd
-	dnssec-timestamps.patch"
+	wire-ctx.patch"
 _builddir="$srcdir"/$pkgname-$pkgver
 
 prepare() {
@@ -35,7 +35,6 @@ prepare() {
 
 build() {
 	cd "$_builddir"
-	autoreconf -if
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
@@ -61,15 +60,15 @@ package() {
 	chmod 750 "${pkgdir}"/var/run/$pkgname
 }
 
-md5sums="5d74b864640c32af3e125995a560fb38  knot-2.0.0.tar.xz
+md5sums="96c128b890767bdb2f61e6d47e6622e5  knot-2.0.1.tar.xz
 66f3111080662280d95bc928d6ca92d5  knotd.confd
 5bdbc22866a28caae068e65d53916915  knotd.initd
-9f43e63b3aa28e89ae6dc76a9c271bba  dnssec-timestamps.patch"
-sha256sums="28b2277647f618ea7edba741fd6685a8b1fc17d3a178b48f4ca7f2a43359998f  knot-2.0.0.tar.xz
+7cb1a48510736d38ff960af8cb602c1f  wire-ctx.patch"
+sha256sums="183bac1f23cb3996731c8161889ff5c1e2f99b9a6d8690390a2a23af433d6ce6  knot-2.0.1.tar.xz
 ff384d428c9e67139ed21b0c78eabf6a26d96f31775f6143ce0c4f9c4f6beaf3  knotd.confd
 c7690f1c4f748f436faa9e305ecbbb3d05e5cc50493eb10ca92bc73365578428  knotd.initd
-dc5f77bfba14a5d3c49a962fa3ae0b8db8422c97e09c53c253acba2ead6dfcdb  dnssec-timestamps.patch"
-sha512sums="52482132759294a41ad91c2f4f13ee985b79776f7f90a02e79ed96f2a1925872c5c6dc38f04a96144b4b21994d336850b718f2c834f09d03f3049a75dc5b1a5d  knot-2.0.0.tar.xz
+1b7a3bf4b14133ccbe8a034ced47aeb2af1987b26b372d50c3aeb5702bc2235b  wire-ctx.patch"
+sha512sums="b74069a6da4eb0f456a3bd38318712f467f736af1712a14772f7e539b009c02f8e447c2fcd21f5005a2a4906466294ab6b46e7782aac3b88619063aed14cddb5  knot-2.0.1.tar.xz
 471d3c639a8235ba09491c99d36c0a4f1074d6055ccfd3807be02a30d3ed5bbe69a84f0414ea7810db6bbc1e38f5837108e5744fc59f949ed78a262a7de4597e  knotd.confd
 b6cd5b52ba65f9726164b21003fe0a0fc54f4f51aa7bbbcfd5b83aa4466e5224567a26c9c8ede13ac6a8090706e975e3220456112b20eb45304c9d92be7fb3d3  knotd.initd
-c00fdd36930261f86db7ef71c32e1ba310bff2fdc6f797c8bcc8b91dbfe1576e0802915d18ee76e1ce707e48a0bae473b79d478914aa4102d916689459491003  dnssec-timestamps.patch"
+563e202aff1a32116e51496dbb451e8fd47c289f6dbb935630e0f3a664c4c1ebf6d9733f1a5fed1f62cd7e6b152ebaf103b60ca5d535c5c3b006549c54016953  wire-ctx.patch"
diff --git a/testing/knot/dnssec-timestamps.patch b/testing/knot/dnssec-timestamps.patch
deleted file mode 100644
index d774eff..0000000
--- a/testing/knot/dnssec-timestamps.patch
+++ /dev/null
@@ -1,307 +0,0 @@
-diff --git a/src/dnssec/Makefile.am b/src/dnssec/Makefile.am
-index 46b4377..f6398a6 100644
---- a/src/dnssec/Makefile.am
-+++ b/src/dnssec/Makefile.am
-@@ -38,6 +38,8 @@ libshared_la_SOURCES = \
- 	shared/pem.h \
- 	shared/shared.h \
- 	shared/strtonum.h \
-+	shared/timestamp.c \
-+	shared/timestamp.h \
- 	shared/wire.h
- 
- libdnssec_la_CPPFLAGS = \
-diff --git a/src/dnssec/lib/kasp/dir/json.c b/src/dnssec/lib/kasp/dir/json.c
-index 333374a..a7f3aa9 100644
---- a/src/dnssec/lib/kasp/dir/json.c
-+++ b/src/dnssec/lib/kasp/dir/json.c
-@@ -23,9 +23,7 @@
- #include "key.h"
- #include "shared.h"
- #include "strtonum.h"
--
--// ISO 8610
--#define TIME_FORMAT "%Y-%m-%dT%H:%M:%S%z"
-+#include "timestamp.h"
- 
- int decode_ignore(_unused_ const json_t *value, _unused_ void *result)
- {
-@@ -279,14 +277,10 @@ int decode_time(const json_t *value, void *result)
- 	}
- 
- 	const char *time_str = json_string_value(value);
--	struct tm tm = { 0 };
--	char *end = strptime(time_str, TIME_FORMAT, &tm);
--	if (end == NULL || *end != '\0') {
-+	if (!timestamp_read(time_str, time_ptr)) {
- 		return DNSSEC_CONFIG_MALFORMED;
- 	}
- 
--	*time_ptr = timegm(&tm);
--
- 	return DNSSEC_EOK;
- }
- 
-@@ -302,14 +296,8 @@ int encode_time(const void *value, json_t **result)
- 		return DNSSEC_EOK;
- 	}
- 
--	struct tm tm = { 0 };
--	if (!gmtime_r(time_ptr, &tm)) {
--		return DNSSEC_CONFIG_MALFORMED;
--	}
--
- 	char buffer[128] = { 0 };
--	int written = strftime(buffer, sizeof(buffer), TIME_FORMAT, &tm);
--	if (written == 0) {
-+	if (!timestamp_write(buffer, sizeof(buffer), *time_ptr)) {
- 		return DNSSEC_CONFIG_MALFORMED;
- 	}
- 
-diff --git a/src/dnssec/shared/timestamp.c b/src/dnssec/shared/timestamp.c
-new file mode 100644
-index 0000000..37279a8
---- /dev/null
-+++ b/src/dnssec/shared/timestamp.c
-@@ -0,0 +1,96 @@
-+/*  Copyright (C) 2015 CZ.NIC, z.s.p.o. <[email-masked]>
-+
-+    This program is free software: you can redistribute it and/or modify
-+    it under the terms of the GNU General Public License as published by
-+    the Free Software Foundation, either version 3 of the License, or
-+    (at your option) any later version.
-+
-+    This program is distributed in the hope that it will be useful,
-+    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+    GNU General Public License for more details.
-+
-+    You should have received a copy of the GNU General Public License
-+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+*/
-+
-+#include <assert.h>
-+#include <stdbool.h>
-+#include <time.h>
-+
-+#include "shared.h"
-+
-+/*
-+ * POSIX strftime supports '%z', strptime doesn't.
-+ */
-+#define TIME_FORMAT "%Y-%m-%dT%H:%M:%S"
-+
-+/*!
-+ * Read time zone offset in +hhmm or -hhmm format.
-+ *
-+ * Format written by '%z' specifier in \ref strftime.
-+ */
-+static bool read_timezone(const char *buffer, int *offset)
-+{
-+	assert(buffer);
-+
-+	if (strlen(buffer) != 5) {
-+		return false;
-+	}
-+
-+	char sign;
-+	unsigned hours, mins;
-+	if (sscanf(buffer, "%c%2u%2u", &sign, &hours, &mins) != 3) {
-+		return false;
-+	}
-+
-+	if (sign != '+' && sign != '-') {
-+		return false;
-+	}
-+
-+	if (hours > 23 || mins > 59) {
-+		return false;
-+	}
-+
-+	*offset = (sign == '+' ? 1 : -1) * (hours * 3600 + mins * 60);
-+
-+	return true;
-+}
-+
-+_public_
-+bool timestamp_write(char *buffer, size_t size, time_t timestamp)
-+{
-+	if (!buffer) {
-+		return false;
-+	}
-+
-+	struct tm tm = { 0 };
-+	if (!gmtime_r(&timestamp, &tm)) {
-+		return false;
-+	}
-+
-+	return strftime(buffer, size, TIME_FORMAT "+0000", &tm) != 0;
-+}
-+
-+_public_
-+bool timestamp_read(const char *buffer, time_t *timestamp_ptr)
-+{
-+	if (!buffer || !timestamp_ptr) {
-+		return false;
-+	}
-+
-+	struct tm tm = { 0 };
-+	const char *timezone = strptime(buffer, TIME_FORMAT, &tm);
-+	if (timezone == NULL) {
-+		return false;
-+	}
-+
-+	int gmtoff = 0;
-+	if (!read_timezone(timezone, &gmtoff)) {
-+		return false;
-+	}
-+
-+	*timestamp_ptr = timegm(&tm) - gmtoff;
-+
-+	return true;
-+}
-diff --git a/src/dnssec/shared/timestamp.h b/src/dnssec/shared/timestamp.h
-new file mode 100644
-index 0000000..2cec029
---- /dev/null
-+++ b/src/dnssec/shared/timestamp.h
-@@ -0,0 +1,46 @@
-+/*  Copyright (C) 2015 CZ.NIC, z.s.p.o. <[email-masked]>
-+
-+    This program is free software: you can redistribute it and/or modify
-+    it under the terms of the GNU General Public License as published by
-+    the Free Software Foundation, either version 3 of the License, or
-+    (at your option) any later version.
-+
-+    This program is distributed in the hope that it will be useful,
-+    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+    GNU General Public License for more details.
-+
-+    You should have received a copy of the GNU General Public License
-+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+*/
-+
-+#pragma once
-+
-+#include <stdbool.h>
-+#include <time.h>
-+
-+/*
-+ * The ISO 8610 'YYYY-MM-DDThh:mm:ss+zzzz' format is used.
-+ */
-+
-+/*!
-+ * Write time stamp into a string buffer.
-+ *
-+ * \param buffer     Buffer to write time stamp into.
-+ * \param size       Size of the output buffer.
-+ * \param timestamp  Time stamp value to be written.
-+ *
-+ * \return Time stamp was written successfully.
-+ *
-+ */
-+bool timestamp_write(char *buffer, size_t size, time_t timestamp);
-+
-+/*!
-+ * Read a time stamp from a string buffer.
-+ *
-+ * \param[in]  buffer     Buffer to read time stamp from.
-+ * \param[out] timestamp  Read time stamp value.
-+ *
-+ * \return Time stamp was read successfully.
-+ */
-+bool timestamp_read(const char *buffer, time_t *timestamp);
-diff --git a/src/dnssec/tests/Makefile.am b/src/dnssec/tests/Makefile.am
-index 0d81130..3677eb5 100644
---- a/src/dnssec/tests/Makefile.am
-+++ b/src/dnssec/tests/Makefile.am
-@@ -43,6 +43,7 @@ check_PROGRAMS = \
- 	shared_bignum	\
- 	shared_dname	\
- 	shared_strtonum	\
-+	shared_timestamp \
- 	shared_wire	\
- 	tsig
- 
-diff --git a/src/dnssec/tests/shared_timestamp.c b/src/dnssec/tests/shared_timestamp.c
-new file mode 100644
-index 0000000..6024c80
---- /dev/null
-+++ b/src/dnssec/tests/shared_timestamp.c
-@@ -0,0 +1,75 @@
-+/*  Copyright (C) 2015 CZ.NIC, z.s.p.o. <[email-masked]>
-+
-+    This program is free software: you can redistribute it and/or modify
-+    it under the terms of the GNU General Public License as published by
-+    the Free Software Foundation, either version 3 of the License, or
-+    (at your option) any later version.
-+
-+    This program is distributed in the hope that it will be useful,
-+    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+    GNU General Public License for more details.
-+
-+    You should have received a copy of the GNU General Public License
-+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+*/
-+
-+#include <string.h>
-+#include <tap/basic.h>
-+
-+#include "timestamp.h"
-+
-+int main(int argc, char *argv[])
-+{
-+	plan_lazy();
-+
-+	char buffer[128] = { 0 };
-+
-+	ok(timestamp_write(NULL, 0, 0) == false,
-+	   "timestamp_write: no buffer");
-+	ok(timestamp_write(buffer, 10, 0) == false,
-+	   "timestamp_write: small buffer");
-+	ok(timestamp_write(buffer, sizeof(buffer), 0) &&
-+	   strcmp(buffer, "1970-01-01T00:00:00+0000") == 0,
-+	   "timestamp_write: epoch begin");
-+	ok(timestamp_write(buffer, sizeof(buffer), 1439554225) &&
-+	   strcmp(buffer, "2015-08-14T12:10:25+0000") == 0,
-+	   "timestamp_write: date in past");
-+	ok(timestamp_write(buffer, sizeof(buffer), 2147483646) &&
-+	   strcmp(buffer, "2038-01-19T03:14:06+0000") == 0,
-+	   "timestamp_write: date in future (likely)");
-+
-+	time_t ts = 0;
-+
-+	ok(timestamp_read(NULL, &ts) == false,
-+	   "timestamp_read: no buffer");
-+	ok(timestamp_read("", NULL) == false,
-+	   "timestamp_read: no output");
-+	ok(timestamp_read("", &ts) == false,
-+	   "timestamp_read: empty input");
-+	ok(timestamp_read("1970-01-01T00:00:00", &ts) == false,
-+	   "timestamp_read: missing time zone");
-+	ok(timestamp_read("1970-01-01T00:00:00+000", &ts) == false,
-+	   "timestamp_read: malformed time zone");
-+	ok(timestamp_read("1970-01-01T00:00:00+2400", &ts) == false,
-+	   "timestamp_read: malformed time zone hours");
-+	ok(timestamp_read("1970-01-01T00:00:00+0090", &ts) == false,
-+	   "timestamp_read: malformed time zone minuts");
-+	ok(timestamp_read("1970-01-01T00:00:01+0000", &ts) && ts == 1,
-+	   "timestamp_read: first second since epoch");
-+	ok(timestamp_read("2009-02-13T23:31:31+0000", &ts) && ts == 1234567891,
-+	   "timestamp_read: date in past");
-+	ok(timestamp_read("2034-05-05T01:24:20+0000", &ts) && ts == 2030405060,
-+	   "timestamp_read: date in future (likely)");
-+
-+	ok(timestamp_read("2015-08-14T14:25:46+0200", &ts) &&
-+	   timestamp_write(buffer, sizeof(buffer), ts) &&
-+	   strcmp(buffer, "2015-08-14T12:25:46+0000") == 0,
-+	   "timestamp convert time zone (east)");
-+	ok(timestamp_read("2015-08-14T10:19:17-0230", &ts) &&
-+	   timestamp_write(buffer, sizeof(buffer), ts) &&
-+	   strcmp(buffer, "2015-08-14T12:49:17+0000") == 0,
-+	   "timestamp convert time zone (west)");
-+
-+	return 0;
-+}
diff --git a/testing/knot/wire-ctx.patch b/testing/knot/wire-ctx.patch
new file mode 100644
index 0000000..1dc276d
--- /dev/null
+++ b/testing/knot/wire-ctx.patch
@@ -0,0 +1,20 @@
+diff --git a/src/libknot/internal/wire_ctx.h b/src/libknot/internal/wire_ctx.h
+index ae15390..a96250f 100644
+--- a/src/libknot/internal/wire_ctx.h
++++ b/src/libknot/internal/wire_ctx.h
+@@ -18,11 +18,14 @@
+ 
+ #include <assert.h>
+ #include <stdbool.h>
++#include <stddef.h>
++#include <stdint.h>
+ #include <string.h>
++#include <sys/types.h>
+ 
+-#include "libknot/rdata.h"
+ #include "libknot/internal/endian.h"
+ #include "libknot/internal/errcode.h"
++#include "libknot/rdata.h"
+ 
+ /*!
+  * \brief Struct to keep the wire context.
-- 
2.4.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---