113 lines
4.4 KiB
Ruby
113 lines
4.4 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
|
|
rebuild 2
|
|
sha256 cellar: :any, arm64_ventura: "7efcee6673cb651ddfa14098dae935a6354832dcb878551127c7f4b089414960"
|
|
sha256 cellar: :any, arm64_monterey: "d124494001e6bbe1bca7cc92e2613683f3abd04777ebfb2c2c09eb094a32dd0f"
|
|
sha256 cellar: :any, arm64_big_sur: "fcbf43252d0725e5161e26ccc588a76563f39bb4389aa5a06544c45187a7110a"
|
|
sha256 cellar: :any, ventura: "c5357cb29c18118b370b5b72750bdc9f7e05d91fd46adf59385791448d6d5c6e"
|
|
sha256 cellar: :any, monterey: "af95f618cb10b92f775f5cc44ea97cbbebc549591cc6d0d85d6fffca4a1e4504"
|
|
sha256 cellar: :any, big_sur: "efad14930b9b70527ff25ca784f59797f75bb8877784595f4b1d8b62e0634ae6"
|
|
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.11"
|
|
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/37/f7/2b1b0ec44fdc30a3d31dfebe52226be9ddc40cd6c0f34ffc8923ba423b69/certifi-2022.12.7.tar.gz"
|
|
sha256 "35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"
|
|
end
|
|
|
|
resource "charset-normalizer" do
|
|
url "https://files.pythonhosted.org/packages/a1/34/44964211e5410b051e4b8d2869c470ae8a68ae274953b1c7de6d98bbcf94/charset-normalizer-2.1.1.tar.gz"
|
|
sha256 "5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"
|
|
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/ce/2a/2a41b4818f28fc4e8fca8e33f14ca52db5e35aae295e439ac03ceb6b4765/libvirt-python-8.10.0.tar.gz"
|
|
sha256 "fc30f136abe0b8228029a90814c8f44ac2947433c12f211363051c57df2d5401"
|
|
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/c2/51/32da03cf19d17d46cce5c731967bf58de9bd71db3a379932f53b094deda4/urllib3-1.26.13.tar.gz"
|
|
sha256 "c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"
|
|
end
|
|
|
|
def install
|
|
python = "python3.11"
|
|
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
|