[arch-commits] Commit in cryptsetup/trunk (PKGBUILD json-c-0.14.patch)
Evangelos Foutras
foutrelis at archlinux.org
Sat Apr 25 14:17:23 UTC 2020
Date: Saturday, April 25, 2020 @ 14:17:23
Author: foutrelis
Revision: 381556
upgpkg: cryptsetup 2.3.1-2: json-c 0.14 rebuild
Added:
cryptsetup/trunk/json-c-0.14.patch
Modified:
cryptsetup/trunk/PKGBUILD
-------------------+
PKGBUILD | 13 ++-
json-c-0.14.patch | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 184 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2020-04-25 13:20:13 UTC (rev 381555)
+++ PKGBUILD 2020-04-25 14:17:23 UTC (rev 381556)
@@ -3,7 +3,7 @@
pkgname=cryptsetup
pkgver=2.3.1
-pkgrel=1
+pkgrel=2
pkgdesc='Userspace setup tool for transparent encryption of block devices using dm-crypt'
arch=(x86_64)
license=('GPL')
@@ -15,13 +15,20 @@
source=("https://www.kernel.org/pub/linux/utils/cryptsetup/v${pkgver%.*}/${pkgname}-${pkgver}.tar."{xz,sign}
'hooks-encrypt'
'install-encrypt'
- 'install-sd-encrypt')
+ 'install-sd-encrypt'
+ 'json-c-0.14.patch')
sha256sums=('92aba4d559a2cf7043faed92e0f22c5addea36bd63f8c039ba5a8f3a159fe7d2'
'SKIP'
'416aa179ce3c6a7a5eee0861f1f0a4fafac91b69e84a2aae82b6e5a6140e31e2'
'd325dc239ecc9a5324407b0782da6df2573e8491251836d6c4e65fa61339ce57'
- '31d816b3650a57512a5f9b52c1995fa65a161faa8b37975d07c9a1b8e1a119db')
+ '31d816b3650a57512a5f9b52c1995fa65a161faa8b37975d07c9a1b8e1a119db'
+ 'bbf6abba86d4c76307734e95593a5ba3647e1d80d51e521f7e542c92a3d89408')
+prepare() {
+ cd "${srcdir}"/$pkgname-${pkgver}
+ patch -Np1 -i ../json-c-0.14.patch
+}
+
build() {
cd "${srcdir}"/$pkgname-${pkgver}
Added: json-c-0.14.patch
===================================================================
--- json-c-0.14.patch (rev 0)
+++ json-c-0.14.patch 2020-04-25 14:17:23 UTC (rev 381556)
@@ -0,0 +1,174 @@
+From 604abec333a0efb44fd8bc610aa0b1151dd0f612 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82 at fedoraproject.org>
+Date: Mon, 13 Apr 2020 11:48:17 +0200
+Subject: [PATCH] Add support for upcoming json-c 0.14.0.
+
+ * TRUE/FALSE are not defined anymore. 1 and 0 are used instead.
+ * json_object_get_uint64() and json_object_new_uint64() are part
+ of the upstream API now.
+---
+ lib/luks2/luks2_internal.h | 4 +++-
+ lib/luks2/luks2_json_metadata.c | 38 +++++++++++++++++----------------
+ 2 files changed, 23 insertions(+), 19 deletions(-)
+
+diff --git a/lib/luks2/luks2_internal.h b/lib/luks2/luks2_internal.h
+index b9fec6b5..939101d6 100644
+--- a/lib/luks2/luks2_internal.h
++++ b/lib/luks2/luks2_internal.h
+@@ -58,9 +58,11 @@ json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr);
+ void hexprint_base64(struct crypt_device *cd, json_object *jobj,
+ const char *sep, const char *line_sep);
+
++#if !(defined JSON_C_VERSION_NUM && JSON_C_VERSION_NUM >= ((13 << 8) | 99))
+ uint64_t json_object_get_uint64(json_object *jobj);
+-uint32_t json_object_get_uint32(json_object *jobj);
+ json_object *json_object_new_uint64(uint64_t value);
++#endif
++uint32_t json_object_get_uint32(json_object *jobj);
+
+ int json_object_object_add_by_uint(json_object *jobj, unsigned key, json_object *jobj_val);
+ void json_object_object_del_by_uint(json_object *jobj, unsigned key);
+diff --git a/lib/luks2/luks2_json_metadata.c b/lib/luks2/luks2_json_metadata.c
+index 781280c2..712c2bbd 100644
+--- a/lib/luks2/luks2_json_metadata.c
++++ b/lib/luks2/luks2_json_metadata.c
+@@ -234,13 +234,14 @@ static json_bool json_str_to_uint64(json_object *jobj, uint64_t *value)
+ tmp = strtoull(json_object_get_string(jobj), &endptr, 10);
+ if (*endptr || errno) {
+ *value = 0;
+- return FALSE;
++ return 0;
+ }
+
+ *value = tmp;
+- return TRUE;
++ return 1;
+ }
+
++#if !(defined JSON_C_VERSION_NUM && JSON_C_VERSION_NUM >= ((13 << 8) | 99))
+ uint64_t json_object_get_uint64(json_object *jobj)
+ {
+ uint64_t r;
+@@ -262,6 +263,7 @@ json_object *json_object_new_uint64(uint64_t value)
+ jobj = json_object_new_string(num);
+ return jobj;
+ }
++#endif
+
+ /*
+ * Validate helpers
+@@ -273,9 +275,9 @@ static json_bool numbered(struct crypt_device *cd, const char *name, const char
+ for (i = 0; key[i]; i++)
+ if (!isdigit(key[i])) {
+ log_dbg(cd, "%s \"%s\" is not in numbered form.", name, key);
+- return FALSE;
++ return 0;
+ }
+- return TRUE;
++ return 1;
+ }
+
+ json_object *json_contains(struct crypt_device *cd, json_object *jobj, const char *name,
+@@ -300,7 +302,7 @@ json_bool validate_json_uint32(json_object *jobj)
+ errno = 0;
+ tmp = json_object_get_int64(jobj);
+
+- return (errno || tmp < 0 || tmp > UINT32_MAX) ? FALSE : TRUE;
++ return (errno || tmp < 0 || tmp > UINT32_MAX) ? 0 : 1;
+ }
+
+ static json_bool validate_keyslots_array(struct crypt_device *cd,
+@@ -313,17 +315,17 @@ static json_bool validate_keyslots_array(struct crypt_device *cd,
+ jobj = json_object_array_get_idx(jarr, i);
+ if (!json_object_is_type(jobj, json_type_string)) {
+ log_dbg(cd, "Illegal value type in keyslots array at index %d.", i);
+- return FALSE;
++ return 0;
+ }
+
+ if (!json_contains(cd, jobj_keys, "", "Keyslots section",
+ json_object_get_string(jobj), json_type_object))
+- return FALSE;
++ return 0;
+
+ i++;
+ }
+
+- return TRUE;
++ return 1;
+ }
+
+ static json_bool validate_segments_array(struct crypt_device *cd,
+@@ -336,17 +338,17 @@ static json_bool validate_segments_array(struct crypt_device *cd,
+ jobj = json_object_array_get_idx(jarr, i);
+ if (!json_object_is_type(jobj, json_type_string)) {
+ log_dbg(cd, "Illegal value type in segments array at index %d.", i);
+- return FALSE;
++ return 0;
+ }
+
+ if (!json_contains(cd, jobj_segments, "", "Segments section",
+ json_object_get_string(jobj), json_type_object))
+- return FALSE;
++ return 0;
+
+ i++;
+ }
+
+- return TRUE;
++ return 1;
+ }
+
+ static json_bool segment_has_digest(const char *segment_name, json_object *jobj_digests)
+@@ -357,10 +359,10 @@ static json_bool segment_has_digest(const char *segment_name, json_object *jobj_
+ UNUSED(key);
+ json_object_object_get_ex(val, "segments", &jobj_segments);
+ if (LUKS2_array_jobj(jobj_segments, segment_name))
+- return TRUE;
++ return 1;
+ }
+
+- return FALSE;
++ return 0;
+ }
+
+ static json_bool validate_intervals(struct crypt_device *cd,
+@@ -372,18 +374,18 @@ static json_bool validate_intervals(struct crypt_device *cd,
+ while (i < length) {
+ if (ix[i].offset < 2 * metadata_size) {
+ log_dbg(cd, "Illegal area offset: %" PRIu64 ".", ix[i].offset);
+- return FALSE;
++ return 0;
+ }
+
+ if (!ix[i].length) {
+ log_dbg(cd, "Area length must be greater than zero.");
+- return FALSE;
++ return 0;
+ }
+
+ if ((ix[i].offset + ix[i].length) > keyslots_area_end) {
+ log_dbg(cd, "Area [%" PRIu64 ", %" PRIu64 "] overflows binary keyslots area (ends at offset: %" PRIu64 ").",
+ ix[i].offset, ix[i].offset + ix[i].length, keyslots_area_end);
+- return FALSE;
++ return 0;
+ }
+
+ for (j = 0; j < length; j++) {
+@@ -393,14 +395,14 @@ static json_bool validate_intervals(struct crypt_device *cd,
+ log_dbg(cd, "Overlapping areas [%" PRIu64 ",%" PRIu64 "] and [%" PRIu64 ",%" PRIu64 "].",
+ ix[i].offset, ix[i].offset + ix[i].length,
+ ix[j].offset, ix[j].offset + ix[j].length);
+- return FALSE;
++ return 0;
+ }
+ }
+
+ i++;
+ }
+
+- return TRUE;
++ return 1;
+ }
+
+ static int LUKS2_keyslot_validate(struct crypt_device *cd, json_object *hdr_jobj, json_object *hdr_keyslot, const char *key)
More information about the arch-commits
mailing list