diff options
| author | vin <git@vineetk.net> | 2025-11-16 00:19:37 -0500 |
|---|---|---|
| committer | vin <git@vineetk.net> | 2025-11-16 00:23:46 -0500 |
| commit | fd8654fd2c47ba33ac7123e3cea0d733a5076888 (patch) | |
| tree | 63410e48f94f6ac2643e1d967d84e7f66f1c59b6 /notmuch | |
| parent | 399a88f2c02d6d8ff5e37febb2f676a2e845ca9f (diff) | |
add minimal gmime3 and gpg-less notmuch
Diffstat (limited to 'notmuch')
| -rw-r--r-- | notmuch/.footprint | 9 | ||||
| -rw-r--r-- | notmuch/.md5sum | 2 | ||||
| -rw-r--r-- | notmuch/Pkgfile | 29 | ||||
| -rw-r--r-- | notmuch/gpgless_configure.diff | 234 |
4 files changed, 274 insertions, 0 deletions
diff --git a/notmuch/.footprint b/notmuch/.footprint new file mode 100644 index 0000000..e9b246b --- /dev/null +++ b/notmuch/.footprint | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | drwxr-xr-x root/root usr/ | ||
| 2 | drwxr-xr-x root/root usr/bin/ | ||
| 3 | -rwxr-xr-x root/root usr/bin/notmuch | ||
| 4 | drwxr-xr-x root/root usr/include/ | ||
| 5 | -rw-r--r-- root/root usr/include/notmuch.h | ||
| 6 | drwxr-xr-x root/root usr/lib/ | ||
| 7 | lrwxrwxrwx root/root usr/lib/libnotmuch.so -> libnotmuch.so.5.6.0 | ||
| 8 | lrwxrwxrwx root/root usr/lib/libnotmuch.so.5 -> libnotmuch.so.5.6.0 | ||
| 9 | -rw-r--r-- root/root usr/lib/libnotmuch.so.5.6.0 | ||
diff --git a/notmuch/.md5sum b/notmuch/.md5sum new file mode 100644 index 0000000..d4409c9 --- /dev/null +++ b/notmuch/.md5sum | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | 1d59a34a265c867a816171d50e801139 gpgless_configure.diff | ||
| 2 | edce1607f13ad8cb9ea6409b8e04c4d6 notmuch-0.39.tar.xz | ||
diff --git a/notmuch/Pkgfile b/notmuch/Pkgfile new file mode 100644 index 0000000..5076152 --- /dev/null +++ b/notmuch/Pkgfile | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | # Description: a fast, global-search and tag-based email system | ||
| 2 | # URL: https://notmuchmail.org/ | ||
| 3 | # Maintainer: Shokara Kou, kou at 13f0 dot net | ||
| 4 | # Packager: Tim Biermann, tbier at posteo dot de | ||
| 5 | # Depends on: gmime3 talloc xapian-core | ||
| 6 | # Optional: emacs | ||
| 7 | |||
| 8 | name=notmuch | ||
| 9 | version=0.39 | ||
| 10 | release=1 | ||
| 11 | source=(https://notmuchmail.org/releases/$name-$version.tar.xz | ||
| 12 | gpgless_configure.diff) | ||
| 13 | |||
| 14 | build() { | ||
| 15 | cd $name-$version | ||
| 16 | |||
| 17 | patch -Np1 <$SRC/gpgless_configure.diff | ||
| 18 | ./configure \ | ||
| 19 | --prefix=/usr \ | ||
| 20 | --sysconfdir=/etc \ | ||
| 21 | --includedir=/usr/include \ | ||
| 22 | --with-emacs \ | ||
| 23 | --without-bash-completion \ | ||
| 24 | --without-zsh-completion | ||
| 25 | |||
| 26 | prt-get isinst emacs >/dev/null 2>&1 && IS_EMACS=1 || IS_EMACS=0 | ||
| 27 | make DESTDIR=$PKG LIBDIR_IN_LDCONFIG=0 WITH_EMACS=$IS_EMACS install | ||
| 28 | install -Dm755 notmuch-shared $PKG/usr/bin/notmuch | ||
| 29 | } | ||
diff --git a/notmuch/gpgless_configure.diff b/notmuch/gpgless_configure.diff new file mode 100644 index 0000000..eedb5eb --- /dev/null +++ b/notmuch/gpgless_configure.diff | |||
| @@ -0,0 +1,234 @@ | |||
| 1 | --- a/configure 2025-11-15 20:31:24.176390211 -0500 | ||
| 2 | +++ b/configure 2025-11-15 20:34:24.654376850 -0500 | ||
| 3 | @@ -501,231 +501,6 @@ | ||
| 4 | have_gmime=1 | ||
| 5 | gmime_cflags=$(pkg-config --cflags gmime-3.0) | ||
| 6 | gmime_ldflags=$(pkg-config --libs gmime-3.0) | ||
| 7 | - | ||
| 8 | - printf "Checking for GMime session key extraction support... " | ||
| 9 | - | ||
| 10 | - cat > _check_session_keys.c <<EOF | ||
| 11 | -#include <gmime/gmime.h> | ||
| 12 | -#include <stdio.h> | ||
| 13 | - | ||
| 14 | -int main () { | ||
| 15 | - GError *error = NULL; | ||
| 16 | - GMimeParser *parser = NULL; | ||
| 17 | - GMimeMultipartEncrypted *body = NULL; | ||
| 18 | - GMimeDecryptResult *decrypt_result = NULL; | ||
| 19 | - GMimeObject *output = NULL; | ||
| 20 | - | ||
| 21 | - g_mime_init (); | ||
| 22 | - parser = g_mime_parser_new (); | ||
| 23 | - g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/basic-encrypted.eml", "r", &error)); | ||
| 24 | - if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n"); | ||
| 25 | - | ||
| 26 | - body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); | ||
| 27 | - if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n"); | ||
| 28 | - | ||
| 29 | - output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error); | ||
| 30 | - if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n"); | ||
| 31 | - | ||
| 32 | - if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n"); | ||
| 33 | - if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n"); | ||
| 34 | - | ||
| 35 | - printf ("%s\n", decrypt_result->session_key); | ||
| 36 | - return 0; | ||
| 37 | -} | ||
| 38 | -EOF | ||
| 39 | - if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then | ||
| 40 | - printf 'No.\nCould not make tempdir for testing session-key support.\n' | ||
| 41 | - errors=$((errors + 1)) | ||
| 42 | - elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \ | ||
| 43 | - && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/openpgp4-secret-key.asc \ | ||
| 44 | - && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \ | ||
| 45 | - && [ $SESSION_KEY = 9:496A0B6D15A5E7BA762FB8E5FE6DEE421D4D9BBFCEAD1CDD0CCF636D07ADE621 ] | ||
| 46 | - then | ||
| 47 | - printf "OK.\n" | ||
| 48 | - else | ||
| 49 | - cat <<EOF | ||
| 50 | -No. | ||
| 51 | -*** Error: Could not extract session keys from encrypted message. | ||
| 52 | - | ||
| 53 | -This is likely due to your GMime having been built against a old | ||
| 54 | -version of GPGME. | ||
| 55 | - | ||
| 56 | -Please try to rebuild your version of GMime against a more recent | ||
| 57 | -version of GPGME (at least GPGME 1.8.0). | ||
| 58 | -EOF | ||
| 59 | - if GPGME_VERS="$(pkg-config --modversion gpgme || gpgme-config --version)"; then | ||
| 60 | - printf 'Your current GPGME development version is: %s\n' "$GPGME_VERS" | ||
| 61 | - else | ||
| 62 | - printf 'You do not have the GPGME development libraries installed.\n' | ||
| 63 | - fi | ||
| 64 | - errors=$((errors + 1)) | ||
| 65 | - fi | ||
| 66 | - if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then | ||
| 67 | - rm -rf "$TEMP_GPG" | ||
| 68 | - fi | ||
| 69 | - | ||
| 70 | - cat > _check_gmime_cert.c <<EOF | ||
| 71 | -#include <stdio.h> | ||
| 72 | -#include <gmime/gmime.h> | ||
| 73 | - | ||
| 74 | -int main () { | ||
| 75 | - GError *error = NULL; | ||
| 76 | - GMimeParser *parser = NULL; | ||
| 77 | - GMimeApplicationPkcs7Mime *body = NULL; | ||
| 78 | - GMimeSignatureList *sig_list = NULL; | ||
| 79 | - GMimeSignature *sig = NULL; | ||
| 80 | - GMimeCertificate *cert = NULL; | ||
| 81 | - GMimeObject *output = NULL; | ||
| 82 | - int len; | ||
| 83 | - | ||
| 84 | - g_mime_init (); | ||
| 85 | - parser = g_mime_parser_new (); | ||
| 86 | - g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/pkcs7/smime-onepart-signed.eml", "r", &error)); | ||
| 87 | - if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n"); | ||
| 88 | - | ||
| 89 | - body = GMIME_APPLICATION_PKCS7_MIME(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); | ||
| 90 | - if (body == NULL) return !! fprintf (stderr, "did not find a application/pkcs7 message\n"); | ||
| 91 | - | ||
| 92 | - sig_list = g_mime_application_pkcs7_mime_verify (body, GMIME_VERIFY_NONE, &output, &error); | ||
| 93 | - if (error || output == NULL) return !! fprintf (stderr, "verify failed\n"); | ||
| 94 | - | ||
| 95 | - if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n"); | ||
| 96 | - len = g_mime_signature_list_length (sig_list); | ||
| 97 | - if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len); | ||
| 98 | - sig = g_mime_signature_list_get_signature (sig_list, 0); | ||
| 99 | - if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n"); | ||
| 100 | - cert = g_mime_signature_get_certificate (sig); | ||
| 101 | - if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n"); | ||
| 102 | -#ifdef CHECK_VALIDITY | ||
| 103 | - GMimeValidity validity = g_mime_certificate_get_id_validity (cert); | ||
| 104 | - if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL); | ||
| 105 | -#endif | ||
| 106 | -#ifdef CHECK_EMAIL | ||
| 107 | - const char *email = g_mime_certificate_get_email (cert); | ||
| 108 | - if (! email) return !! fprintf (stderr, "no email returned"); | ||
| 109 | - if (email[0] == '<') return 2; | ||
| 110 | -#endif | ||
| 111 | - return 0; | ||
| 112 | -} | ||
| 113 | -EOF | ||
| 114 | - | ||
| 115 | - # see https://github.com/jstedfast/gmime/pull/90 | ||
| 116 | - # should be fixed in GMime in 3.2.7, but some distros might patch | ||
| 117 | - printf "Checking for GMime X.509 certificate validity... " | ||
| 118 | - | ||
| 119 | - if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then | ||
| 120 | - printf 'No.\nCould not make tempdir for testing X.509 certificate validity support.\n' | ||
| 121 | - errors=$((errors + 1)) | ||
| 122 | - elif ${CC} -DCHECK_VALIDITY ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_x509_validity \ | ||
| 123 | - && echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \ | ||
| 124 | - && echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$TEMP_GPG/trustlist.txt" \ | ||
| 125 | - && GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < "$srcdir"/test/smime/ca.crt | ||
| 126 | - then | ||
| 127 | - if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then | ||
| 128 | - gmime_x509_cert_validity=1 | ||
| 129 | - printf "Yes.\n" | ||
| 130 | - else | ||
| 131 | - gmime_x509_cert_validity=0 | ||
| 132 | - printf "No.\n" | ||
| 133 | - if pkg-config --exists "gmime-3.0 >= 3.2.7"; then | ||
| 134 | - cat <<EOF | ||
| 135 | -*** Error: GMime fails to calculate X.509 certificate validity, and | ||
| 136 | -is later than 3.2.7, which should have fixed this issue. | ||
| 137 | - | ||
| 138 | -Please follow up on https://github.com/jstedfast/gmime/pull/90 with | ||
| 139 | -more details. | ||
| 140 | -EOF | ||
| 141 | - errors=$((errors + 1)) | ||
| 142 | - fi | ||
| 143 | - fi | ||
| 144 | - printf "Checking whether GMime emits email addresses with angle brackets... " | ||
| 145 | - if ${CC} -DCHECK_EMAIL ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_email && | ||
| 146 | - GNUPGHOME=${TEMP_GPG} ./_check_email; then | ||
| 147 | - gmime_emits_angle_brackets=0 | ||
| 148 | - printf "No.\n" | ||
| 149 | - else | ||
| 150 | - gmime_emits_angle_brackets=1 | ||
| 151 | - printf "Yes.\n" | ||
| 152 | - fi | ||
| 153 | - else | ||
| 154 | - printf 'No.\nFailed to set up gpgsm for testing X.509 certificate validity support.\n' | ||
| 155 | - errors=$((errors + 1)) | ||
| 156 | - fi | ||
| 157 | - if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then | ||
| 158 | - rm -rf "$TEMP_GPG" | ||
| 159 | - fi | ||
| 160 | - | ||
| 161 | - # see https://dev.gnupg.org/T3464 | ||
| 162 | - # there are problems verifying signatures when decrypting with session keys with GPGME 1.13.0 and 1.13.1 | ||
| 163 | - printf "Checking signature verification when decrypting using session keys... " | ||
| 164 | - | ||
| 165 | - cat > _verify_sig_with_session_key.c <<EOF | ||
| 166 | -#include <stdio.h> | ||
| 167 | -#include <gmime/gmime.h> | ||
| 168 | - | ||
| 169 | -int main () { | ||
| 170 | - GError *error = NULL; | ||
| 171 | - GMimeParser *parser = NULL; | ||
| 172 | - GMimeMultipartEncrypted *body = NULL; | ||
| 173 | - GMimeDecryptResult *result = NULL; | ||
| 174 | - GMimeSignatureList *sig_list = NULL; | ||
| 175 | - GMimeSignature *sig = NULL; | ||
| 176 | - GMimeObject *output = NULL; | ||
| 177 | - GMimeSignatureStatus status; | ||
| 178 | - int len; | ||
| 179 | - | ||
| 180 | - g_mime_init (); | ||
| 181 | - parser = g_mime_parser_new (); | ||
| 182 | - g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/encrypted-signed.eml", "r", &error)); | ||
| 183 | - if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n"); | ||
| 184 | - | ||
| 185 | - body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); | ||
| 186 | - if (body == NULL) return !! fprintf (stderr, "did not find a multipart/encrypted message\n"); | ||
| 187 | - | ||
| 188 | - output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_NONE, "9:9E1CDF53BBF794EA34F894B5B68E1E56FB015EA69F81D2A5EAB7F96C7B65783E", &result, &error); | ||
| 189 | - if (error || output == NULL) return !! fprintf (stderr, "decrypt failed\n"); | ||
| 190 | - | ||
| 191 | - sig_list = g_mime_decrypt_result_get_signatures (result); | ||
| 192 | - if (sig_list == NULL) return !! fprintf (stderr, "sig_list is NULL\n"); | ||
| 193 | - | ||
| 194 | - if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n"); | ||
| 195 | - len = g_mime_signature_list_length (sig_list); | ||
| 196 | - if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len); | ||
| 197 | - sig = g_mime_signature_list_get_signature (sig_list, 0); | ||
| 198 | - if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n"); | ||
| 199 | - status = g_mime_signature_get_status (sig); | ||
| 200 | - if (status & GMIME_SIGNATURE_STATUS_KEY_MISSING) return !! fprintf (stderr, "signature status contains KEY_MISSING (see https://dev.gnupg.org/T3464)\n"); | ||
| 201 | - | ||
| 202 | - return 0; | ||
| 203 | -} | ||
| 204 | -EOF | ||
| 205 | - if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then | ||
| 206 | - printf 'No.\nCould not make tempdir for testing signature verification when decrypting with session keys.\n' | ||
| 207 | - errors=$((errors + 1)) | ||
| 208 | - elif ${CC} ${CFLAGS} ${gmime_cflags} _verify_sig_with_session_key.c ${gmime_ldflags} -o _verify_sig_with_session_key \ | ||
| 209 | - && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/openpgp4-secret-key.asc \ | ||
| 210 | - && rm -f ${TEMP_GPG}/private-keys-v1.d/*.key | ||
| 211 | - then | ||
| 212 | - if GNUPGHOME=${TEMP_GPG} ./_verify_sig_with_session_key; then | ||
| 213 | - gmime_verify_with_session_key=1 | ||
| 214 | - printf "Yes.\n" | ||
| 215 | - else | ||
| 216 | - gmime_verify_with_session_key=0 | ||
| 217 | - printf "No.\n" | ||
| 218 | - cat <<EOF | ||
| 219 | -*** Error: GMime fails to verify signatures when decrypting with a session key. | ||
| 220 | - | ||
| 221 | -This is most likely due to a buggy version of GPGME, which should be fixed in 1.13.2 or later. | ||
| 222 | -See https://dev.gnupg.org/T3464 for more details. | ||
| 223 | -EOF | ||
| 224 | - fi | ||
| 225 | - else | ||
| 226 | - printf 'No.\nFailed to set up gpg for testing signature verification while decrypting with a session key.\n' | ||
| 227 | - errors=$((errors + 1)) | ||
| 228 | - fi | ||
| 229 | - if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then | ||
| 230 | - rm -rf "$TEMP_GPG" | ||
| 231 | - fi | ||
| 232 | else | ||
| 233 | have_gmime=0 | ||
| 234 | printf "No.\n" | ||
