commit:     2088d3ed01d8b162836ba055c2ad03f87f7502e4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 11 02:20:16 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Feb 11 02:21:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2088d3ed

app-crypt/sequoia-chameleon-gnupg: backport test fix

... but it doesn't get them passing yet. Ideas welcome! They don't pass
for me outside of Portage either, but way more _do_ pass outside of Portage
for me, as opposed to none right now inside.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../sequoia-chameleon-gnupg-0.2.0-tests.patch      | 45 ++++++++++++++++++++++
 .../sequoia-chameleon-gnupg-0.2.0.ebuild           |  9 ++++-
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git 
a/app-crypt/sequoia-chameleon-gnupg/files/sequoia-chameleon-gnupg-0.2.0-tests.patch
 
b/app-crypt/sequoia-chameleon-gnupg/files/sequoia-chameleon-gnupg-0.2.0-tests.patch
new file mode 100644
index 000000000000..8ebd4cf4da25
--- /dev/null
+++ 
b/app-crypt/sequoia-chameleon-gnupg/files/sequoia-chameleon-gnupg-0.2.0-tests.patch
@@ -0,0 +1,45 @@
+https://gitlab.com/sequoia-pgp/sequoia-chameleon-gnupg/-/commit/447e4747089731f322589299d3ff6fd54e56aefb
+
+From 447e4747089731f322589299d3ff6fd54e56aefb Mon Sep 17 00:00:00 2001
+From: Justus Winter <[email protected]>
+Date: Thu, 9 Feb 2023 10:44:26 +0100
+Subject: [PATCH] tests: Normalize underlines.
+
+  - GnuPG emits a header with underlines in key listings that changes
+    with the length of GNUPGHOME.  Now, since the state directories
+    are created within TMPDIR, the length of both GNUPGHOME and the
+    underline changes.  Previously, we normalized GNUPGHOME, but we
+    failed to normalize the underline.
+
+  - Fixes #8.
+--- a/tests/gpg.rs
++++ b/tests/gpg.rs
+@@ -243,12 +243,24 @@ impl Output {
+     }
+ 
+     /// Canonicalizes the paths in the output.
++    ///
++    /// This replaces `homedir` with `"/HOMEDIR"` and `experiment`
++    /// with `"/EXPERIMENT"` in stdout and stderr, and normalizes the
++    /// underline decorating `homedir` in key listings in stdout.
+     fn canonicalize(mut self, homedir: &Path, experiment: &Path) -> Self {
++        const DASHES: &str =
++            "\n------------------------------------------------------------";
++        let d = regex::bytes::Regex::new(
++            &DASHES[..DASHES.len().min(homedir.to_str().unwrap().len() + 1)])
++            .unwrap();
+         let h = regex::bytes::Regex::new(homedir.to_str().unwrap()).unwrap();
+         let e = 
regex::bytes::Regex::new(experiment.to_str().unwrap()).unwrap();
+         self.stdout =
+-            e.replace_all(&h.replace_all(&self.stdout, &b"/HOMEDIR"[..]),
+-                          &b"/EXPERIMENT"[..])
++            e.replace_all(
++                &h.replace_all(
++                    &d.replace_all(&self.stdout, &b"\n--------"[..]),
++                    &b"/HOMEDIR"[..]),
++                &b"/EXPERIMENT"[..])
+             .into();
+         self.stderr =
+             e.replace_all(&h.replace_all(&self.stderr, &b"/HOMEDIR"[..]),
+-- 
+GitLab

diff --git 
a/app-crypt/sequoia-chameleon-gnupg/sequoia-chameleon-gnupg-0.2.0.ebuild 
b/app-crypt/sequoia-chameleon-gnupg/sequoia-chameleon-gnupg-0.2.0.ebuild
index 10afa858dad2..5b7c38538af6 100644
--- a/app-crypt/sequoia-chameleon-gnupg/sequoia-chameleon-gnupg-0.2.0.ebuild
+++ b/app-crypt/sequoia-chameleon-gnupg/sequoia-chameleon-gnupg-0.2.0.ebuild
@@ -307,7 +307,10 @@ LICENSE+="
 "
 SLOT="0"
 KEYWORDS="~amd64"
-# https://gitlab.com/sequoia-pgp/sequoia-chameleon-gnupg/-/issues/8
+# See e.g. https://gitlab.com/sequoia-pgp/sequoia-chameleon-gnupg/-/issues/8
+# Even though that's fixed as of >0.2.0, tests still completely fail inside
+# Portage. Not yet sure why/how. They do better outside, although some fail
+# still then.
 RESTRICT="test"
 
 DEPEND="
@@ -320,6 +323,10 @@ BDEPEND="sys-devel/clang"
 
 QA_FLAGS_IGNORED="usr/bin/gpg-sq usr/bin/gpgv-sq"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-tests.patch
+)
+
 src_test() {
        export GNUPGHOME="${T}"/.gnupg
        export REAL_GPG_BIN="${BROOT}"/usr/bin/gpg

Reply via email to