homebrew-core/Formula/mu.rb

97 lines
3.6 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.13/mu-1.8.13.tar.xz"
sha256 "20d69c1a918c1e48e6dbf5375d87ef3ed358bb6b3b7d0a120e93a88b16d5a026"
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_ventura: "90fd3e0bf68e9d068837ec62e9c7995820b4d5efdd9c97fe57f0d93f4bcdd91a"
sha256 arm64_monterey: "4912edec797751cbcc299c803cc923f9dc43a98c0bebfde4bbda06cd7c11178c"
sha256 arm64_big_sur: "c2f7c55d2d21d0afeb64d1a17e9ad52c3b0dd57790329a401168335c9b1875ab"
sha256 ventura: "c59786b25c71cc1a0e6a12cb27cc1921076aa5f4a98a623dbbf5f697284105cf"
sha256 monterey: "4a6917251e981252fc3d93251811b8c345da6daa769aba17b625b5d78a6cc9b1"
sha256 big_sur: "6aedc6e3fd0cd6dfc1972dc2290decda236c8ec29b935854269e759653fa0c1b"
sha256 x86_64_linux: "e553af9084e9b538e88094978a245b5feaa8414f451de41e3e6edf855e66dc37"
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