124 lines
4.9 KiB
Ruby
124 lines
4.9 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.0.0.tar.gz"
|
|
sha256 "515aaa2021a4bf352b0573098fe6958319b1ba8ec508ea37e064803f97f17086"
|
|
license "GPL-2.0-or-later"
|
|
head "https://github.com/virt-manager/virt-manager.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "76cb1ea36b592fd72e34a8ad9fe3321a274743c9c28f8eec4104367339a9e9f8"
|
|
sha256 cellar: :any, arm64_big_sur: "845721080bf5aac2d52e1664ca7029b95dde4ac53cd8da89181dad14b170fe4c"
|
|
sha256 cellar: :any, monterey: "0acb75ff2736767a3f6d8624b2be4ef6ca05a9887b7d83ef8065222301029fea"
|
|
sha256 cellar: :any, big_sur: "6636accdad0ba50846db76c09bd79dfc33c022aee30c6f9a333f88b81fedc788"
|
|
sha256 cellar: :any, catalina: "9a46cafc595ea56468c7b690f78ac12a4426f20ba02b772b88212c48bad19f32"
|
|
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.9"
|
|
depends_on "spice-gtk"
|
|
depends_on "vte3"
|
|
|
|
resource "certifi" do
|
|
url "https://files.pythonhosted.org/packages/6c/ae/d26450834f0acc9e3d1f74508da6df1551ceab6c2ce0766a593362d6d57f/certifi-2021.10.8.tar.gz"
|
|
sha256 "78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"
|
|
end
|
|
|
|
resource "chardet" do
|
|
url "https://files.pythonhosted.org/packages/ee/2d/9cdc2b527e127b4c9db64b86647d567985940ac3698eeabc7ffaccb4ea61/chardet-4.0.0.tar.gz"
|
|
sha256 "0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"
|
|
end
|
|
|
|
resource "docutils" do
|
|
url "https://files.pythonhosted.org/packages/57/b1/b880503681ea1b64df05106fc7e3c4e3801736cf63deffc6fa7fc5404cf5/docutils-0.18.1.tar.gz"
|
|
sha256 "679987caf361a7539d76e584cbeddc311e3aee937877c87346f31debc63e9d06"
|
|
end
|
|
|
|
resource "idna" do
|
|
url "https://files.pythonhosted.org/packages/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
|
|
sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
|
|
end
|
|
|
|
resource "libvirt-python" do
|
|
url "https://files.pythonhosted.org/packages/2a/74/919462bed158ccc2a8061f31d82c157740c2e597ff50490526336e8aa688/libvirt-python-8.1.0.tar.gz"
|
|
sha256 "a21ecfab6d29ac1bdd1bfd4aa3ef58447f9f70919aefecd03774613f65914e43"
|
|
end
|
|
|
|
resource "requests" do
|
|
url "https://files.pythonhosted.org/packages/60/f3/26ff3767f099b73e0efa138a9998da67890793bfa475d8278f84a30fec77/requests-2.27.1.tar.gz"
|
|
sha256 "68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"
|
|
end
|
|
|
|
resource "urllib3" do
|
|
url "https://files.pythonhosted.org/packages/1b/a5/4eab74853625505725cefdf168f48661b2cd04e7843ab836f3f63abf81da/urllib3-1.26.9.tar.gz"
|
|
sha256 "aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
|
|
end
|
|
|
|
def install
|
|
venv = virtualenv_create(libexec, "python3")
|
|
venv.pip_install resources
|
|
|
|
# virt-manager uses distutils, doesn't like --single-version-externally-managed
|
|
system libexec/"bin/python", "setup.py",
|
|
"configure",
|
|
"--prefix=#{libexec}"
|
|
system libexec/"bin/python", "setup.py",
|
|
"--no-user-cfg",
|
|
"--no-update-icon-cache",
|
|
"--no-compile-schemas",
|
|
"install"
|
|
|
|
# install virt-manager commands with PATH set to Python virtualenv environment
|
|
bin.install libexec.glob("bin/virt-*")
|
|
bin.env_script_all_files(libexec/"bin", PATH: "#{libexec}/bin:$PATH")
|
|
|
|
share.install libexec/"share/man"
|
|
share.install libexec/"share/glib-2.0"
|
|
share.install libexec/"share/icons"
|
|
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
|