113 lines
4.5 KiB
Ruby
113 lines
4.5 KiB
Ruby
class VirtManager < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "App for managing virtual machines"
|
|
homepage "https://virt-manager.org/"
|
|
url "https://virt-manager.org/download/sources/virt-manager/virt-manager-4.1.0.tar.gz"
|
|
sha256 "950681d7b32dc61669278ad94ef31da33109bf6fcf0426ed82dfd7379aa590a2"
|
|
license "GPL-2.0-or-later"
|
|
revision 3
|
|
head "https://github.com/virt-manager/virt-manager.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_ventura: "6ac9d407cca582a4aeaa5f82e23cb5115d05003bb658c4bd5ca89722ee3ecbcb"
|
|
sha256 cellar: :any, arm64_monterey: "5c8a05881b2d8700e85101802e6c907793f00daba10444caad1fc45043deb68f"
|
|
sha256 cellar: :any, arm64_big_sur: "c8a1922dced9bb9862d74b9347bbedccc5f9261c8a7767e48441a9916ff91565"
|
|
sha256 cellar: :any, ventura: "0f87365d83203fb78b6ce962843d68787afbcb0d4c7ec18db60a306a5d0d3f61"
|
|
sha256 cellar: :any, monterey: "460116c676caa375b1ff7f40d6e126273fc080548b99e618175e9643a48d55ec"
|
|
sha256 cellar: :any, big_sur: "f572380b0bc30f4e867c7f41568098d1437cdab76c5775382aa3aa62e4318f14"
|
|
sha256 cellar: :any, catalina: "2b2f1ed405d164f88a82a9d79bdcd8c38ebd0fcf45e9559ee63836a26d1a197e"
|
|
end
|
|
|
|
depends_on "docutils" => :build
|
|
depends_on "intltool" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "adwaita-icon-theme"
|
|
depends_on "cpio"
|
|
depends_on "gtk-vnc"
|
|
depends_on "gtksourceview4"
|
|
depends_on "libosinfo"
|
|
depends_on "libvirt-glib"
|
|
depends_on "libxml2" # can't use from macos, since we need python3 bindings
|
|
depends_on :macos
|
|
depends_on "osinfo-db"
|
|
depends_on "py3cairo"
|
|
depends_on "pygobject3"
|
|
depends_on "python@3.10"
|
|
depends_on "spice-gtk"
|
|
depends_on "vte3"
|
|
|
|
# Resources are for Python `libvirt-python` and `requests` packages
|
|
|
|
resource "certifi" do
|
|
url "https://files.pythonhosted.org/packages/cb/a4/7de7cd59e429bd0ee6521ba58a75adaec136d32f91a761b28a11d8088d44/certifi-2022.9.24.tar.gz"
|
|
sha256 "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"
|
|
end
|
|
|
|
resource "charset-normalizer" do
|
|
url "https://files.pythonhosted.org/packages/fe/77/6d5d367b7cfee812a88573e80bbe25cea2d015ed2c3490e4464951ff3232/charset-normalizer-3.0.0.tar.gz"
|
|
sha256 "b27d10ad15740b45fd55f76e6901a4391e6dca3917ef48ecdcf17edf6e00d770"
|
|
end
|
|
|
|
resource "idna" do
|
|
url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz"
|
|
sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"
|
|
end
|
|
|
|
resource "libvirt-python" do
|
|
url "https://files.pythonhosted.org/packages/0e/b2/abf88509a6763050462b14811d47e912eece981c21e3c6103b7b303645d9/libvirt-python-8.9.0.tar.gz"
|
|
sha256 "2e1cfc3b9bd288b3cac400a6b03593633814236dbd1ecf5a900057bb90181c65"
|
|
end
|
|
|
|
resource "requests" do
|
|
url "https://files.pythonhosted.org/packages/a5/61/a867851fd5ab77277495a8709ddda0861b28163c4613b011bc00228cc724/requests-2.28.1.tar.gz"
|
|
sha256 "7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"
|
|
end
|
|
|
|
resource "urllib3" do
|
|
url "https://files.pythonhosted.org/packages/b2/56/d87d6d3c4121c0bcec116919350ca05dc3afd2eeb7dc88d07e8083f8ea94/urllib3-1.26.12.tar.gz"
|
|
sha256 "3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"
|
|
end
|
|
|
|
def install
|
|
python = "python3.10"
|
|
venv = virtualenv_create(libexec, python)
|
|
venv.pip_install resources
|
|
|
|
args = Language::Python.setup_install_args(prefix, python)
|
|
args.insert((args.index "install"), "--no-update-icon-cache", "--no-compile-schemas")
|
|
|
|
system libexec/"bin/python", "setup.py", "configure", "--prefix=#{prefix}"
|
|
system libexec/"bin/python", *args
|
|
end
|
|
|
|
def post_install
|
|
# manual schema compile step
|
|
system Formula["glib"].opt_bin/"glib-compile-schemas", HOMEBREW_PREFIX/"share/glib-2.0/schemas"
|
|
# manual icon cache update step
|
|
system Formula["gtk+3"].opt_bin/"gtk3-update-icon-cache", HOMEBREW_PREFIX/"share/icons/hicolor"
|
|
end
|
|
|
|
test do
|
|
libvirt_pid = fork do
|
|
exec Formula["libvirt"].opt_sbin/"libvirtd", "-f", Formula["libvirt"].etc/"libvirt/libvirtd.conf"
|
|
end
|
|
|
|
output = testpath/"virt-manager.log"
|
|
virt_manager_pid = fork do
|
|
$stdout.reopen(output)
|
|
$stderr.reopen(output)
|
|
exec bin/"virt-manager", "-c", "test:///default", "--debug"
|
|
end
|
|
sleep 10
|
|
|
|
assert_match "conn=test:///default changed to state=Active", output.read
|
|
ensure
|
|
Process.kill("TERM", libvirt_pid)
|
|
Process.kill("TERM", virt_manager_pid)
|
|
Process.wait(libvirt_pid)
|
|
Process.wait(virt_manager_pid)
|
|
end
|
|
end
|