diff --git a/Formula/guestfs-tools.rb b/Formula/guestfs-tools.rb new file mode 100644 index 0000000..65e1c40 --- /dev/null +++ b/Formula/guestfs-tools.rb @@ -0,0 +1,61 @@ +# Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause + +class GuestfsTools < Formula + desc "Set of tools for accessing and modifying virtual machine (VM) disk images" + homepage "https://libguestfs.org/" + url "https://github.com/libguestfs/guestfs-tools.git", revision: "daf2b71e0ef18a04928f82688278673ad57d4c4b" + version "1.53.2" + license "GPL-2.0-or-later" + + depends_on "automake" => :build + depends_on "autoconf" => :build + depends_on "libtool" => :build + depends_on "pkg-config" => :build + depends_on "coreutils" => :build + depends_on "gnu-getopt" => :build + depends_on "bison" => :build + depends_on "gpg2" + depends_on "libosinfo" + depends_on "quic/quic/libguestfs" + + patch :DATA + + def install + system "autoreconf", "-i" + system "./configure", *std_configure_args + system "make", "-j#{ENV.make_jobs}" + system "make", "install" + end + + def caveats + <<~EOS + To use virt-builder you need to add the following to your profile: + export VIRT_BUILDER_DIRS="#{HOMEBREW_PREFIX}/etc" + EOS + end +end + +__END__ +diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml +index 343f0bae..d592d498 100644 +--- a/builder/sigchecker.ml ++++ b/builder/sigchecker.ml +@@ -42,7 +42,7 @@ let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile = + gpg gpghome (quote status_file) (quote keyfile) + (if verbose () then "" else " >/dev/null 2>&1") in + let r = shell_command cmd in +- if r <> 0 then ++ if r <> 0 && r <> 2 then + error (f_"could not import public key\n\ + Use the ā€˜-vā€™ option and look for earlier error messages."); + let status = read_whole_file status_file in +@@ -110,7 +110,7 @@ let rec create ~gpg ~gpgkey ~check_signature ~tmpdir = + let cmd = sprintf "%s --homedir %s --list-keys%s" + gpg gpgtmpdir (if verbose () then "" else " >/dev/null 2>&1") in + let r = shell_command cmd in +- if r <> 0 then ++ if r <> 0 && r <> 2 then + error (f_"GPG failure: could not run GPG the first time\n\ + Use the ā€˜-vā€™ option and look for earlier error messages."); + match gpgkey with diff --git a/Formula/libguestfs.rb b/Formula/libguestfs.rb index 76172ac..166b07a 100644 --- a/Formula/libguestfs.rb +++ b/Formula/libguestfs.rb @@ -161,32 +161,35 @@ def caveats guestfs_int_cmd_clear_capture_errors (cmd); diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4 -index c6d33183d..8035a9729 100644 +index c6d33183d..44c64b6d6 100644 --- a/m4/guestfs-c.m4 +++ b/m4/guestfs-c.m4 -@@ -57,7 +57,7 @@ CFLAGS="$CFLAGS -fno-strict-overflow -Wno-strict-overflow" +@@ -55,9 +55,12 @@ AC_SUBST([WERROR_CFLAGS]) + CFLAGS="$CFLAGS -fno-strict-overflow -Wno-strict-overflow" + dnl Work out how to specify the linker script to the linker. ++AS_CASE([$host_os], ++ [darwin*], [MAP_SCRIPT_FLAGS="-Wl,-map"], ++ [MAP_SCRIPT_FLAGS="-Wl,-M"]) VERSION_SCRIPT_FLAGS=-Wl,--version-script= `/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null` || \ - VERSION_SCRIPT_FLAGS="-Wl,-M -Wl," -+ VERSION_SCRIPT_FLAGS="-Wl,-map -Wl," ++ VERSION_SCRIPT_FLAGS="$MAP_SCRIPT_FLAGS -Wl," AC_SUBST(VERSION_SCRIPT_FLAGS) dnl Use -fvisibility=hidden by default in the library. -diff --git a/m4/ocaml.m4 b/m4/ocaml.m4 -index fddd6a0c2..91896f386 100644 ---- a/m4/ocaml.m4 -+++ b/m4/ocaml.m4 -@@ -17,6 +17,9 @@ AC_DEFUN([AC_PROG_OCAML], - OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` - AC_MSG_RESULT([OCaml version is $OCAMLVERSION]) - OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4` -+ if test "x$INSTALL_OCAMLLIB" = "x"; then -+ INSTALL_OCAMLLIB=$OCAMLLIB -+ fi - AC_MSG_RESULT([OCaml library path is $OCAMLLIB]) - - AC_SUBST([OCAMLVERSION]) +diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 +index 25b06408c..6696db5bb 100644 +--- a/m4/guestfs-ocaml.m4 ++++ b/m4/guestfs-ocaml.m4 +@@ -210,3 +210,7 @@ OCAML_WARN_ERROR="-warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3-6 -w -6" + AC_SUBST([OCAML_WARN_ERROR]) + OCAML_FLAGS="-g -annot $safe_string_option" + AC_SUBST([OCAML_FLAGS]) ++ ++if test "x$INSTALL_OCAMLLIB" = "x"; then ++ INSTALL_OCAMLLIB=$OCAMLLIB ++fi diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 63713ee68..f7621a8fa 100644 --- a/ocaml/Makefile.am