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.14/mu-1.8.14.tar.xz"
sha256 "1a9c5e15b5e8b67622f7e58dfadd453abf232c0b715bd5f89b955e704455219c"
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: "a7374671eb123ef221ad1df86dba8b3fd9ad7d10e048f439245b88240ae15676"
sha256 arm64_monterey: "aff9b01cee886de6fbe057aa2fe33aead281911496a65f58e254586f04766912"
sha256 arm64_big_sur: "88e297752713b5922ee0d4fe819677bbf2c1d787cf27ec90bbdfbeca7d402e6a"
sha256 ventura: "ffcd38352e528ccae36b058d630a79e0240626a8d76ee3535bbdefbd90b69306"
sha256 monterey: "5abf4fafe115819cf9a22bac48b7307157561c06e237d389af2bdd590e06dff4"
sha256 big_sur: "252ae563cb147d3cbcdfb3cb4ba84b2febb0a4ebefd567ae449f2215a31fed5c"
sha256 x86_64_linux: "07366478a9a8b5c3f328e73837f1c7dcf213a73a5c28ebd74d316378b6747dc2"
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