homebrew-core/Formula/mercurial.rb

86 lines
3.1 KiB
Ruby

# No head build supported; if you need head builds of Mercurial, do so outside
# of Homebrew.
class Mercurial < Formula
desc "Scalable distributed version control system"
homepage "https://mercurial-scm.org/"
url "https://www.mercurial-scm.org/release/mercurial-6.1.4.tar.gz"
sha256 "f361f9802b36e357ac019ceb712ca11de8332b07deadeed8dfa904f05bf7ca78"
license "GPL-2.0-or-later"
livecheck do
url "https://www.mercurial-scm.org/release/"
regex(/href=.*?mercurial[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "737ceba26e04326ea6b70c06d5ff14400c3cb7af5dd123d2445e7a816d47f0db"
sha256 arm64_big_sur: "36452fa78b494b30f71cb1799ec4c3c612f7f6d2e2e89721f12f037128ca4b6f"
sha256 monterey: "7f7d98d3e6f77fd87d64b496bcbc8ee942ad0264cea915ad5ddc307149953a84"
sha256 big_sur: "e0b72286e4578b8a0775026e38a630597acdae17ca3da34fc725e97554d65877"
sha256 catalina: "8a14ec66a7c520775e1e93d9097bf45a1707daf5cb10d39dd41693f3be71616e"
sha256 x86_64_linux: "28ae090d3c606c984cc35a5ef1ed23889a6f3f1a0638a38bdc283a80afb3bf88"
end
depends_on "python@3.10"
def install
ENV["HGPYTHON3"] = "1"
# FIXME: python@3.10 formula's "prefix scheme" patch tries to install into
# HOMEBREW_PREFIX/{lib,bin}, which fails due to sandbox. As workaround,
# manually set the installation paths to behave like prior python versions.
site_packages = prefix/Language::Python.site_packages("python3")
inreplace "Makefile",
"--prefix=\"$(PREFIX)\"",
"\\0 --install-lib=\"#{site_packages}\" --install-scripts=\"#{prefix}/bin\""
system "make", "PREFIX=#{prefix}",
"PYTHON=#{which("python3")}",
"install-bin"
# Install chg (see https://www.mercurial-scm.org/wiki/CHg)
cd "contrib/chg" do
system "make", "PREFIX=#{prefix}",
"PYTHON=#{which("python3")}",
"HGPATH=#{bin}/hg", "HG=#{bin}/hg"
bin.install "chg"
end
# Configure a nicer default pager
(buildpath/"hgrc").write <<~EOS
[pager]
pager = less -FRX
EOS
(etc/"mercurial").install "hgrc"
# Install man pages, which come pre-built in source releases
man1.install "doc/hg.1"
man5.install "doc/hgignore.5", "doc/hgrc.5"
# install the completion scripts
bash_completion.install "contrib/bash_completion" => "hg-completion.bash"
zsh_completion.install "contrib/zsh_completion" => "_hg"
end
def caveats
return unless (opt_bin/"hg").exist?
cacerts_configured = `#{opt_bin}/hg config web.cacerts`.strip
return if cacerts_configured.empty?
<<~EOS
Homebrew has detected that Mercurial is configured to use a certificate
bundle file as its trust store for TLS connections instead of using the
default OpenSSL store. If you have trouble connecting to remote
repositories, consider unsetting the `web.cacerts` property. You can
determine where the property is being set by running:
hg config --debug web.cacerts
EOS
end
test do
system "#{bin}/hg", "init"
end
end