dev-libs/luksmeta: Add from Gentoo

It's from GURU commit 05abdcd720bc767a152082750d9c7a044d638059
This commit is contained in:
Simon Campion 2024-03-13 13:44:04 +01:00
parent f385595ad1
commit 5cc473a5c1
4 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST luksmeta-9.tar.gz 27650 BLAKE2B e55796929410e9a3124c3f28066bac42b46e71df98ab7a1e58c1f973d4fda41d7c8d64b735ae0d1e192054297932951407083f89a7f255c09d22dce370865036 SHA512 874331988fe2648d4924779b348f190ed5c6e4d71da4ad027f176e3f8dcbc78fc26e9f9b8402a97437db5b884db31b72598afc70e025cd8533168a5986417a76

View File

@ -0,0 +1,136 @@
# This patch backports the master branch's test-lm-{big,one,two}.c and test-luksmeta.c
# due to failing tests on v9 tag (see https://bugs.gentoo.org/837308)
diff --git a/test-lm-assumptions.c b/test-lm-assumptions.c
index d9ff20b..b4f293f 100644
--- a/test-lm-assumptions.c
+++ b/test-lm-assumptions.c
@@ -28,7 +28,8 @@ main(int argc, char *argv[])
/* Test the layout state. */
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- END(1024), /* Rest of the file */
+ { 1024, 3072, true }, /* Keyslot Area */
+ { 0, 0 },
}));
unlink(filename);
diff --git a/test-lm-big.c b/test-lm-big.c
index 6098e59..eb94d3b 100644
--- a/test-lm-big.c
+++ b/test-lm-big.c
@@ -111,7 +111,7 @@ main(int argc, char *argv[])
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
{ offset + 4096, 4096 }, /* luksmeta slot 0 */
{ offset + 8192, 4096 }, /* luksmeta slot 0 (cont) */
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
END(offset + 4096), /* Rest of the file */
}));
diff --git a/test-lm-init.c b/test-lm-init.c
index 2a6cb45..b16d597 100644
--- a/test-lm-init.c
+++ b/test-lm-init.c
@@ -57,7 +57,7 @@ main(int argc, char *argv[])
/* Test the layout state. */
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
END(offset + 4096), /* Rest of the file */
}));
@@ -106,7 +106,7 @@ main(int argc, char *argv[])
assert(luksmeta_test(cd) == -ENOENT);
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
END(offset), /* Rest of the file */
}));
diff --git a/test-lm-one.c b/test-lm-one.c
index 8deb70a..18613e0 100644
--- a/test-lm-one.c
+++ b/test-lm-one.c
@@ -49,7 +49,7 @@ main(int argc, char *argv[])
/* Test the layout state. */
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
{ offset + 4096, 4096 }, /* luksmeta slot 0 */
END(offset + 8192), /* Rest of the file */
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
/* Test the layout state. */
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
END(offset + 4096), /* Rest of the file */
}));
diff --git a/test-lm-two.c b/test-lm-two.c
index 78fea5b..9f0b1c5 100644
--- a/test-lm-two.c
+++ b/test-lm-two.c
@@ -53,7 +53,7 @@ main(int argc, char *argv[])
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
{ offset + 4096, 4096 }, /* luksmeta slot 0 */
END(offset + 8192), /* Rest of the file */
@@ -70,7 +70,7 @@ main(int argc, char *argv[])
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
{ offset + 4096, 4096 }, /* luksmeta slot 0 */
{ offset + 8192, 4096 }, /* luksmeta slot 1 */
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
assert(luksmeta_wipe(cd, 0, UUID0) == 0);
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
{ offset + 4096, 4096, true }, /* luksmeta slot 0 */
{ offset + 8192, 4096 }, /* luksmeta slot 1 */
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
assert(luksmeta_wipe(cd, 1, UUID1) == 0);
assert(test_layout((range_t[]) {
{ 0, 1024 }, /* LUKS header */
- { 1024, offset - 1024, true }, /* Keyslot Area */
+ { 1024, 3072, true }, /* Keyslot Area */
{ offset, 4096 }, /* luksmeta header */
END(offset + 4096), /* Rest of the file */
}));
diff --git a/test-luksmeta b/test-luksmeta
index fd17ead..f1e8b2e 100755
--- a/test-luksmeta
+++ b/test-luksmeta
@@ -11,7 +11,7 @@ function onexit() {
trap 'onexit' EXIT
truncate -s 4M $tmp
-echo -n foo | cryptsetup luksFormat $tmp -
+echo -n foo | cryptsetup luksFormat --type luks1 $tmp -
! ./luksmeta test -d $tmp

View File

@ -0,0 +1,38 @@
# Copyright 2022-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DESCRIPTION="LUKSMeta is a simple library for storing metadata in the LUKSv1 header"
HOMEPAGE="https://github.com/latchset/luksmeta"
SRC_URI="https://github.com/latchset/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+man"
DEPEND="sys-fs/cryptsetup"
RDEPEND="${DEPEND}"
BDEPEND="man? ( app-text/asciidoc )
dev-build/libtool"
PATCHES=(
# https://bugs.gentoo.org/837308
"${FILESDIR}/${PN}-tests.patch"
)
src_prepare() {
default
eautoreconf
# Bug https://bugs.gentoo.org/921710
sed -i -e '/^-Werror \\$/d' configure.ac || die
}
src_install() {
default
# Bug https://bugs.gentoo.org/839609
find "${ED}" -name '*.la' -delete || die
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>julien@jroy.ca</email>
<name>Julien Roy</name>
</maintainer>
<upstream>
<remote-id type="github">latchset/luksmeta</remote-id>
</upstream>
</pkgmetadata>