homebrew-core/Formula/mu.rb

96 lines
3.5 KiB
Ruby

# NOTE: Odd release numbers indicate unstable releases.
# Please only submit PRs for [x.even.x] version numbers:
# https://github.com/djcb/mu/commit/23f4a64bdcdee3f9956a39b9a5a4fd0c5c2370ba
class Mu < Formula
desc "Tool for searching e-mail messages stored in the maildir-format"
homepage "https://www.djcbsoftware.nl/code/mu/"
url "https://github.com/djcb/mu/releases/download/v1.8.11/mu-1.8.11.tar.xz"
sha256 "d4c1cf6dd76c97dcd53e1468d9ff82dc1e10203be607ad3249ba7ac417603439"
license "GPL-3.0-or-later"
head "https://github.com/djcb/mu.git", branch: "master"
# We restrict matching to versions with an even-numbered minor version number,
# as an odd-numbered minor version number indicates a development version:
# https://github.com/djcb/mu/commit/23f4a64bdcdee3f9956a39b9a5a4fd0c5c2370ba
livecheck do
url :stable
regex(/^v?(\d+\.\d*[02468](?:\.\d+)*)$/i)
end
bottle do
sha256 arm64_monterey: "bbc266238e8061043ccf69e82dcd90880d8c0d9d55025fc081740dfea0d6a040"
sha256 arm64_big_sur: "9cf3b1c22ca2f4e4b535a32f8a30984d9152a8c9326fd53eb313c6877eafe8d3"
sha256 monterey: "ef2ddfa9cd75867a96292d47a927f8803ecc3f8ff96435c0552860d8145fcd42"
sha256 big_sur: "620c1ea085a7bca6465600acae29dd883583063cf7725285eacd5aa30f84021b"
sha256 catalina: "3955dc7e82b0ae049dee978d88a70c333126779558693660a984196f12f91479"
sha256 x86_64_linux: "d8d52b8463529423d827f184d6d084c1490450e43488ba5040cc40d972fd9ecb"
end
depends_on "emacs" => :build
depends_on "libgpg-error" => :build
depends_on "libtool" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "glib"
depends_on "gmime"
depends_on "xapian"
on_system :linux, macos: :ventura_or_newer do
depends_on "texinfo" => :build
end
conflicts_with "mu-repo", because: "both install `mu` binaries"
fails_with gcc: "5"
def install
mkdir "build" do
system "meson", *std_meson_args, "-Dlispdir=#{elisp}", ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
# Regression test for:
# https://github.com/djcb/mu/issues/397
# https://github.com/djcb/mu/issues/380
# https://github.com/djcb/mu/issues/332
test do
mkdir (testpath/"cur")
(testpath/"cur/1234567890.11111_1.host1!2,S").write <<~EOS
From: "Road Runner" <fasterthanyou@example.com>
To: "Wile E. Coyote" <wile@example.com>
Date: Mon, 4 Aug 2008 11:40:49 +0200
Message-id: <1111111111@example.com>
Beep beep!
EOS
(testpath/"cur/0987654321.22222_2.host2!2,S").write <<~EOS
From: "Wile E. Coyote" <wile@example.com>
To: "Road Runner" <fasterthanyou@example.com>
Date: Mon, 4 Aug 2008 12:40:49 +0200
Message-id: <2222222222@example.com>
References: <1111111111@example.com>
This used to happen outdoors. It was more fun then.
EOS
system "#{bin}/mu", "init", "--muhome=#{testpath}", "--maildir=#{testpath}"
system "#{bin}/mu", "index", "--muhome=#{testpath}"
mu_find = "#{bin}/mu find --muhome=#{testpath} "
find_message = "#{mu_find} msgid:2222222222@example.com"
find_message_and_related = "#{mu_find} --include-related msgid:2222222222@example.com"
assert_equal 1, shell_output(find_message).lines.count
assert_equal 2, shell_output(find_message_and_related).lines.count, <<~EOS
You tripped over https://github.com/djcb/mu/issues/380
--related doesn't work. Everything else should
EOS
end
end