Merge pull request #222716 from NixOS/neomutt-update

neomutt: 20220429 -> 20230407
This commit is contained in:
Ryan Lahfa 2023-04-26 19:44:41 +02:00 committed by GitHub
commit 3ffcae9af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 21 deletions

View File

@ -1,29 +1,37 @@
{ lib, stdenv, fetchFromGitHub, gettext, makeWrapper, tcl, which
, ncurses, perl , cyrus_sasl, gss, gpgme, libkrb5, libidn, libxml2, notmuch, openssl
, lmdb, libxslt, docbook_xsl, docbook_xml_dtd_42, w3m, mailcap, sqlite, zlib
, zstd, enableZstd ? true, enableMixmaster ? false
, lua, lmdb, libxslt, docbook_xsl, docbook_xml_dtd_42, w3m, mailcap, sqlite, zlib, lndir
, pkg-config, zstd, enableZstd ? true, enableMixmaster ? false, enableLua ? false
, withContrib ? true
}:
stdenv.mkDerivation rec {
version = "20220429";
version = "20230407";
pname = "neomutt";
src = fetchFromGitHub {
owner = "neomutt";
repo = "neomutt";
rev = version;
sha256 = "sha256-LBY7WtmEMg/PcMS/Tc5XEYunIWjoI4IQfUJURKgy1YA=";
sha256 = "sha256-cTZua1AbLMjkMhlUk2aMttj6HdwpJYnRYPuvukSxfwc=";
};
patches = [
# https://github.com/neomutt/neomutt/issues/3773#issuecomment-1493295144
./fix-open-very-large-mailbox.patch
];
buildInputs = [
cyrus_sasl gss gpgme libkrb5 libidn ncurses
notmuch openssl perl lmdb
mailcap sqlite
]
++ lib.optional enableZstd zstd;
++ lib.optional enableZstd zstd
++ lib.optional enableLua lua;
nativeBuildInputs = [
docbook_xsl docbook_xml_dtd_42 gettext libxml2 libxslt.bin makeWrapper tcl which zlib w3m
pkg-config
];
enableParallelBuilding = true;
@ -46,10 +54,6 @@ stdenv.mkDerivation rec {
--replace /etc/mime.types ${mailcap}/etc/mime.types
'';
preBuild = ''
export HOME=$(mktemp -d)
'';
configureFlags = [
"--enable-autocrypt"
"--gpgme"
@ -66,32 +70,41 @@ stdenv.mkDerivation rec {
"--zlib"
]
++ lib.optional enableZstd "--zstd"
++ lib.optional enableLua "--lua"
++ lib.optional enableMixmaster "--mixmaster";
# Fix missing libidn in mutt;
# this fix is ugly since it links all binaries in mutt against libidn
# like pgpring, pgpewrap, ...
NIX_LDFLAGS = "-lidn";
postInstall = ''
wrapProgram "$out/bin/neomutt" --prefix PATH : "$out/libexec/neomutt"
'';
''
# https://github.com/neomutt/neomutt-contrib
# Contains vim-keys, keybindings presets and more.
+ lib.optionalString withContrib "${lib.getExe lndir} ${passthru.contrib} $out/share/doc/neomutt";
doCheck = true;
preCheck = ''
cp -r ${fetchFromGitHub {
owner = "neomutt";
repo = "neomutt-test-files";
rev = "8629adab700a75c54e8e28bf05ad092503a98f75";
sha256 = "1ci04nqkab9mh60zzm66sd6mhsr6lya8wp92njpbvafc86vvwdlr";
}} $(pwd)/test-files
cp -r ${passthru.test-files} $(pwd)/test-files
chmod -R +w test-files
(cd test-files && ./setup.sh)
export NEOMUTT_TEST_DIR=$(pwd)/test-files
'';
passthru = {
test-files = fetchFromGitHub {
owner = "neomutt";
repo = "neomutt-test-files";
rev = "1569b826a56c39fd09f7c6dd5fc1163ff5a356a2";
sha256 = "sha256-MaH2zEH1Wq3C0lFxpEJ+b/A+k2aKY/sr1EtSPAuRPp8=";
};
contrib = fetchFromGitHub {
owner = "neomutt";
repo = "neomutt-contrib";
rev = "8e97688693ca47ea1055f3d15055a4f4ecc5c832";
sha256 = "sha256-tx5Y819rNDxOpjg3B/Y2lPcqJDArAxVwjbYarVmJ79k=";
};
};
checkTarget = "test";
postCheck = "unset NEOMUTT_TEST_DIR";

View File

@ -0,0 +1,51 @@
diff --git a/mutt_mailbox.c b/mutt_mailbox.c
index 5581a8187..22f0ca21a 100644
--- a/mutt_mailbox.c
+++ b/mutt_mailbox.c
@@ -160,6 +160,9 @@ int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
st_ctx.st_dev = 0;
st_ctx.st_ino = 0;
+ if (kInMboxOpen)
+ return 0;
+
#ifdef USE_IMAP
if (flags & MUTT_MAILBOX_CHECK_FORCE)
mutt_update_num_postponed();
diff --git a/mx.c b/mx.c
index 4bf5af141..a4e9f83f5 100644
--- a/mx.c
+++ b/mx.c
@@ -295,6 +295,8 @@ bool mx_mbox_ac_link(struct Mailbox *m)
return true;
}
+int kInMboxOpen = 0;
+
/**
* mx_mbox_open - Open a mailbox and parse it
* @param m Mailbox to open
@@ -386,8 +388,10 @@ bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
m->msg_tagged = 0;
m->vcount = 0;
+ kInMboxOpen = 1;
enum MxOpenReturns rc = m->mx_ops->mbox_open(m);
m->opened++;
+ kInMboxOpen = 0;
if ((rc == MX_OPEN_OK) || (rc == MX_OPEN_ABORT))
{
diff --git a/mx.h b/mx.h
index 741431570..43e40bf32 100644
--- a/mx.h
+++ b/mx.h
@@ -38,6 +38,8 @@ extern const struct MxOps *mx_ops[];
extern struct EnumDef MboxTypeDef;
+extern int kInMboxOpen;
+
typedef uint8_t MsgOpenFlags; ///< Flags for mx_msg_open_new(), e.g. #MUTT_ADD_FROM
#define MUTT_MSG_NO_FLAGS 0 ///< No flags are set
#define MUTT_ADD_FROM (1 << 0) ///< add a From_ line