From 93e42c7c1ff6270d3bcc910792179c1aece7a04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 25 Mar 2021 21:21:01 +0700 Subject: [PATCH] growlight: fix build with doctest 2.4.6 --- srcpkgs/growlight/patches/doctest-2.4.6.patch | 74 +++++++++++++++++++ srcpkgs/growlight/template | 1 + 2 files changed, 75 insertions(+) create mode 100644 srcpkgs/growlight/patches/doctest-2.4.6.patch diff --git a/srcpkgs/growlight/patches/doctest-2.4.6.patch b/srcpkgs/growlight/patches/doctest-2.4.6.patch new file mode 100644 index 0000000000..c307ea9d5e --- /dev/null +++ b/srcpkgs/growlight/patches/doctest-2.4.6.patch @@ -0,0 +1,74 @@ +Index: growlight-1.2.31/tests/gpt.cpp +=================================================================== +--- growlight-1.2.31.orig/tests/gpt.cpp ++++ growlight-1.2.31/tests/gpt.cpp +@@ -6,6 +6,9 @@ + + #define UUID "\x5E\x86\x90\xEF\xD0\x30\x03\x46\x99\x3D\x54\x6E\xB0\xE7\x1B\x0D" + ++template ++T xnormalise(T value) { return value; } ++ + TEST_CASE("GPT") { + + // First eight bytes must be "EFI PART" +@@ -19,14 +22,14 @@ TEST_CASE("GPT") { + SUBCASE("Revision") { + gpt_header head; + CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, nullptr)); +- CHECK(0x00010000 == head.revision); ++ CHECK(0x00010000 == xnormalise(head.revision)); + } + + // Bytes 0xc--0xf must be >= 92, should be the logical block size + SUBCASE("HeaderSize") { + gpt_header head; + CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, nullptr)); +- CHECK(92 == head.headsize); ++ CHECK(92 == xnormalise(head.headsize)); + } + + // Bytes 0x18--0x1f are the sector of the GPT primary, usually 1 +@@ -34,8 +37,8 @@ TEST_CASE("GPT") { + SUBCASE("GPTLBAs") { + gpt_header head; + CHECK(0 == initialize_gpt(&head, 512, 100000, 34, nullptr)); +- CHECK(1 == head.lba); +- CHECK(100000 == head.backuplba); ++ CHECK(1 == xnormalise(head.lba)); ++ CHECK(100000 == xnormalise(head.backuplba)); + } + + // Verify the 16-byte UUID is as specified +@@ -61,17 +64,17 @@ TEST_CASE("GPT") { + gpt_header head; + CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, UUID)); + // partition entry size must be a positive multiple of 128 (usually 128) +- CHECK(0 < head.partsize); ++ CHECK(0 < xnormalise(head.partsize)); + CHECK(0 == (head.partsize % 128)); + // number of partition entries, usually 128 (MINIMUM_GPT_ENTRIES) +- CHECK(128 <= head.partcount); ++ CHECK(128 <= xnormalise(head.partcount)); + auto entries = new gpt_entry[head.partcount]; + memset(entries, 0, sizeof(*entries) * head.partcount); + CHECK(0 == update_crc(&head, entries)); + // FIXME fix on big-endian! +- WARN(2006165414 == head.crc); +- CHECK(0 == head.reserved); +- CHECK(2874462854 == head.partcrc); ++ WARN(2006165414 == xnormalise(head.crc)); ++ CHECK(0 == xnormalise(head.reserved)); ++ CHECK(2874462854 == xnormalise(head.partcrc)); + delete[] entries; + } + +@@ -85,7 +88,7 @@ TEST_CASE("GPT") { + memset(sector, 0xff, sizeof(sector)); + gpt_header* head = reinterpret_cast(sector); + CHECK(0 == initialize_gpt(head, sizeof(sector), 4194287, 34, nullptr)); +- CHECK(92 == head->headsize); ++ CHECK(92 == xnormalise(head->headsize)); + for(size_t idx = 92 ; idx < sizeof(sector) ; ++idx){ + CHECK(0 == sector[idx]); + } diff --git a/srcpkgs/growlight/template b/srcpkgs/growlight/template index a3f358a2a4..f47402c512 100644 --- a/srcpkgs/growlight/template +++ b/srcpkgs/growlight/template @@ -15,6 +15,7 @@ license="GPL-3.0-or-later" homepage="https://nick-black.com/dankwiki/index.php/Growlight" distfiles="https://github.com/dankamongmen/growlight/archive/v${version}.tar.gz" checksum=25cf643d99be88d299756ccb2933868641abecbc26793f5d87cfae93a461e2d6 +patch_args=-Np1 build_options="man zfs"