GNU bug report logs - #73260
Add libguestfs

Previous Next

Package: guix-patches;

Reported by: paul <goodoldpaul <at> autistici.org>

Date: Sat, 14 Sep 2024 21:19:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73260 in the body.
You can then email your comments to 73260 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Sat, 14 Sep 2024 21:19:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to paul <goodoldpaul <at> autistici.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 14 Sep 2024 21:19:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: paul <goodoldpaul <at> autistici.org>
To: guix-patches <at> gnu.org
Subject: Add libguestfs
Date: Sat, 14 Sep 2024 23:15:29 +0200
Hi Guix ,

I'm sending a patch series adding libguestfs. Thank you for your work


giacomo





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Sat, 14 Sep 2024 21:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH 2/3] gnu: Add libguestfs-minimal.
Date: Sat, 14 Sep 2024 23:20:57 +0200
* gnu/packages/virtualization.scm (libguestfs-minimal): New variable.
* gnu/packages/patches/libguestfs-syms.patch: Add file.
* gnu/local.mk: Add it.

Change-Id: Ide22707724ecd41145243c9f41adc3f5557c593e
---
 gnu/local.mk                               |   1 +
 gnu/packages/patches/libguestfs-syms.patch |  26 +++++
 gnu/packages/virtualization.scm            | 128 +++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 gnu/packages/patches/libguestfs-syms.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fcdf174099..74d77ea4a7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1597,6 +1597,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.0.patch	\
   %D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.1.patch	\
   %D%/packages/patches/libgeotiff-fix-tests-on-i386.patch	\
+  %D%/packages/patches/libguestfs-syms.patch            	\
   %D%/packages/patches/libobjc2-unbundle-robin-map.patch	\
   %D%/packages/patches/libvirt-add-install-prefix.patch	\
   %D%/packages/patches/libziparchive-add-includes.patch		\
diff --git a/gnu/packages/patches/libguestfs-syms.patch b/gnu/packages/patches/libguestfs-syms.patch
new file mode 100644
index 0000000000..a4308eef5f
--- /dev/null
+++ b/gnu/packages/patches/libguestfs-syms.patch
@@ -0,0 +1,26 @@
+diff -urN a/lib/Makefile.am b/lib/Makefile.am
+--- a/lib/Makefile.am	2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.am	2023-07-20 17:35:47.305793499 +0200
+@@ -160,8 +160,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+-	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+ 
+ if HAVE_FUSE
+ # XXX Unfortunately FUSE_CFLAGS defines _FILE_OFFSET_BITS=64.
+diff -urN a/lib/Makefile.in b/lib/Makefile.in
+--- a/lib/Makefile.in	2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.in	2023-07-20 17:36:05.474213641 +0200
+@@ -1109,8 +1109,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+-	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+ 
+ @HAVE_LIBVIRT_TRUE <at> libvirt_is_version_SOURCES = libvirt-is-version.c
+ @HAVE_LIBVIRT_TRUE <at> libvirt_is_version_LDADD = \
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 60f17ea630..8abc64527b 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -59,6 +59,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages attr)
+  #:use-module (gnu packages augeas)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
@@ -66,11 +67,13 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages bootloaders)
   #:use-module (gnu packages build-tools)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cluster)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages containers)
+  #:use-module (gnu packages cpio)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages cryptsetup)
@@ -83,6 +86,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages figlet)
+  #:use-module (gnu packages file)
   #:use-module (gnu packages firmware)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fonts)
@@ -95,6 +99,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell)
@@ -3020,3 +3025,126 @@ (define-public hivex
 file available through a C API, or through a separate program to export the
 hive as XML.")
     (license license:lgpl2.1)))
+
+(define-public libguestfs-minimal
+  (package
+    (name "libguestfs-minimal")
+    (version "1.53.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://libguestfs.org/download/"
+                                  (version-major+minor version)
+                                  "-stable/libguestfs-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0vssarc3n4kv26fyjmkrrcvh55v41fhycba43pij3rc2izl72s2y"))
+              (patches
+               (search-patches "libguestfs-syms.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "--disable-appliance"
+                   "--disable-daemon"
+                   "--disable-static"
+                   "--with-distro=\"Guix System\"")
+           #:make-flags #~'("REALLY_INSTALL=yes")
+           #:phases
+           #~(let* ((lib/ocaml (string-append #$output "/lib/ocaml")))
+               (modify-phases %standard-phases
+                 (add-after 'unpack 'patch-makefiles
+                   (lambda _
+                     (for-each patch-shebang
+                               (find-files "."))
+                     (for-each (lambda (makefile)
+                                 (substitute* "ocaml/Makefile.am"
+                                   (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                                    lib/ocaml)))
+                               '("ocaml/Makefile.am"
+                                 "ocaml/Makefile.in"))))
+                 (replace 'bootstrap
+                   (lambda _
+                     (invoke "autoreconf" "-vif")))
+                 (replace 'check
+                   (lambda* (#:key tests? make-flags #:allow-other-keys)
+                     (when tests?
+                       (apply invoke `("make" ,@make-flags "check-direct")))))
+                 (add-before 'install 'set-rpath
+                   (lambda _
+                     (for-each
+                      (lambda (sofile)
+                        (invoke "ls" "-la" "ocaml/")
+                        ;; The ‘validate-runpath’ phase fails to find libguestfs.so.0.
+                        (invoke (string-append #$(this-package-native-input "patchelf")
+                                               "/bin/patchelf")
+                                "--add-rpath" (string-append #$output "/lib") sofile))
+                      '("perl/blib/arch/auto/Sys/Guestfs/Guestfs.so"
+                        "ocaml/dllmlguestfs.so"))))
+                 (replace 'install
+                   (lambda* (#:key make-flags #:allow-other-keys)
+                     (mkdir-p "temp-build-dir")
+                     (apply invoke `("make" ,@make-flags "INSTALLDIRS=vendor"
+                                     "install"))))
+                 (add-after 'install 'wrap-binaries
+                   (lambda _
+                     (let ((bin (string-append #$output "/bin")))
+                       (for-each
+                        (lambda (binary)
+                          (use-modules (srfi srfi-1))
+                          (wrap-program binary
+                            `("PERL5LIB" ":" prefix
+                              (,(string-append #$output
+                                               "/lib/perl5/site_perl")))
+                            `("PATH" ":" prefix
+                              ,(search-path-as-list
+                                '("bin")
+                                (map second
+                                     '#$(package-inputs this-package))))))
+                        (find-files bin)))))
+                 (replace 'validate-documentation-location
+                   (lambda _
+                     (let ((man-dir
+                            (string-append #$output "/man"))
+                           (info-dir
+                            (string-append #$output "/info")))
+                       (for-each (lambda (d)
+                                   (invoke "rm" "-rf" d))
+                                 (list man-dir info-dir)))))))))
+    (native-inputs (list autoconf
+                         automake
+                         augeas
+                         bison
+                         cpio
+                         flex
+                         gettext-minimal
+                         gperf
+                         libtool
+                         ocaml
+                         ocaml-findlib
+                         ncurses
+                         patchelf
+                         perl
+                         perl-getopt-long
+                         perl-module-build
+                         pkg-config
+                         po4a
+                         xorriso
+                         xz
+                         zstd))
+    (inputs
+     (list file
+           fuse
+           jansson
+           hivex
+           libtirpc
+           pcre2
+           readline
+           qemu))
+    (home-page "https://libguestfs.org/")
+    (synopsis "Access and modify virtual machine disk images")
+    (description
+     "@code{libguestfs} is a set of tools for accessing and modifying virtual
+machine (VM) disk images.  You can use this for viewing and editing files inside
+guests, scripting changes to VMs, monitoring disk used/free statistics, creating
+guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
+disks, resizing disks, and much more.")
+    (license (list license:gpl2+ license:lgpl2.1+))))
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Sat, 14 Sep 2024 21:22:02 GMT) Full text and rfc822 format available.

Message #11 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH 1/3] gnu: Add hivex.
Date: Sat, 14 Sep 2024 23:20:56 +0200
* gnu/packages/virtualization.scm (hivex): New variable.

Change-Id: I9828d267d5c6f24dc5039ea3b1849248cd9d23fb
---
 gnu/packages/virtualization.scm | 118 ++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index b076d49985..60f17ea630 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -36,6 +36,7 @@
 ;;; Copyright © 2024 Raven Hallsby <karl <at> hallsby.com>
 ;;; Copyright © 2024 jgart <jgart <at> dismail.de>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is <at> lostca.se>
+;;; Copyright © 2024 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,6 +81,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages dns)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages elf)
   #:use-module (gnu packages figlet)
   #:use-module (gnu packages firmware)
   #:use-module (gnu packages flex)
@@ -112,6 +114,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages pciutils)
@@ -2902,3 +2905,118 @@ (define-public riscv-pk
 supervisor execution environment for tethered RISC-V systems.  It is designed
 to host the RISC-V Linux port.")
     (license license:bsd-3)))
+
+(define-public hivex
+  (package
+    (name "hivex")
+    (version "1.3.24")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://libguestfs.org/download/"
+                                  name "/" name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0g0rib62qg81fda8lxsaa7a1ykqy4rl5sq185pdqm9y9xifa8bx5"))))
+    (build-system gnu-build-system)
+    (native-inputs (list automake
+                         autoconf
+                         gettext-minimal
+                         libtool
+                         ocaml
+                         patchelf
+                         pkg-config
+                         perl-io-stringy
+                         python-wrapper
+                         ruby
+                         ruby-rake
+                         ruby-rdoc))
+    (inputs
+     (list bash-minimal
+           libxml2
+           perl
+           readline))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "--disable-static"
+         "--with-readline"
+         "--disable-rpath")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'bootstrap
+            (lambda _
+              (invoke "autoreconf" "-vif")))
+          (add-after 'unpack 'patch-makefiles
+            (lambda _
+              (let* ((current-system (or #$(%current-target-system)
+                                         #$(%current-system)))
+                     (ocamllib
+                      (string-append #$output "/lib/ocaml/"
+                                     #$(package-version
+                                        (this-package-native-input "ocaml")) "/site-lib"))
+                     (python-installdir
+                      (string-append #$output "/lib/python"
+                                     #$(version-major+minor
+                                        (package-version
+                                         (this-package-native-input
+                                          "python-wrapper")))
+                                     "/site-packages"))
+                     (ruby-version
+                      #$(package-version
+                         (this-package-native-input "ruby")))
+                     (ruby-libdir
+                      (string-append #$output
+                                     "/lib/ruby/site_ruby/"
+                                     ruby-version))
+                     (ruby-archdir
+                      (string-append ruby-libdir "/" current-system)))
+                (substitute* "lib/Makefile.am"
+                  (((string-append "\\$\\(VERSION_SCRIPT_FLAGS\\)"
+                                   "\\$\\(srcdir\\)/hivex\\.syms"))
+                   ""))
+                (substitute* "python/Makefile.am"
+                  (("\\$\\(PYTHON_INSTALLDIR\\)")
+                   python-installdir))
+                (substitute* "ocaml/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                   ocamllib))
+                (substitute* "ruby/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
+                   ruby-archdir)
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
+                   ruby-libdir)))))
+          (add-before 'install 'set-rpath
+            (lambda _
+              (for-each
+               (lambda (sofile)
+                 ;; The ‘validate-runpath’ phase fails to find libhivex.so.0.
+                 (invoke (string-append #$(this-package-native-input "patchelf")
+                                        "/bin/patchelf")
+                         "--add-rpath" (string-append #$output "/lib") sofile))
+               '("perl/blib/arch/auto/Win/Hivex/Hivex.so"
+                 "ruby/ext/hivex/_hivex.so"))))
+          (add-after 'install 'wrap-binaries
+            (lambda _
+              (let ((hivexregedit
+                     (string-append #$output "/bin/hivexregedit"))
+                    (hivexml
+                     (string-append #$output "/bin/hivexml")))
+                (wrap-program hivexregedit
+                  `("PERL5LIB" ":" prefix
+                    (,(string-append #$output "/lib/perl5/site_perl")))
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))
+                (wrap-program hivexml
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))))))))
+    (home-page "https://github.com/libguestfs/hivex")
+    (synopsis "Windows registry hive extraction library")
+    (description
+     "This package provides a self-contained library for reading and writing
+Windows Registry \"hive\" binary files.  Unlike many other tools in this area,
+it doesn't use the textual @code{.REG} format for output, because parsing that
+is as much trouble as parsing the original binary format.  Instead it makes the
+file available through a C API, or through a separate program to export the
+hive as XML.")
+    (license license:lgpl2.1)))

base-commit: c572cf81f4b322af4280ac2133889c997e39d247
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Sat, 14 Sep 2024 21:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH 3/3] gnu: Add libguestfs.
Date: Sat, 14 Sep 2024 23:20:58 +0200
* gnu/packages/virtualization.scm (libguestfs): New variable.

Change-Id: I99243550a7a6c9d787fa1a67e54acefd3deeaf1f
---
 gnu/packages/virtualization.scm | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 8abc64527b..ce541ec8a0 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -59,6 +59,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages attr)
+  #:use-module (gnu packages apparmor)
   #:use-module (gnu packages augeas)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
@@ -79,6 +80,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages cyrus-sasl)
+  #:use-module (gnu packages dbm)
   #:use-module (gnu packages debian)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages dns)
@@ -102,6 +104,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages haskell-apps)
   #:use-module (gnu packages haskell-check)
@@ -112,6 +115,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
   #:use-module (gnu packages multiprecision)
@@ -3148,3 +3152,38 @@ (define-public libguestfs-minimal
 guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
 disks, resizing disks, and much more.")
     (license (list license:gpl2+ license:lgpl2.1+))))
+
+(define-public libguestfs
+  (package
+    (inherit libguestfs-minimal)
+    (name "libguestfs")
+    (arguments
+     (substitute-keyword-arguments (package-arguments libguestfs-minimal)
+       ((#:configure-flags flags)
+        #~(cons (string-append "--with-python-installdir="
+                               #$output "/lib/python"
+                               #$(version-major+minor
+                                  (package-version python))
+                               "/site-packages")
+                #$flags))))
+    (native-inputs
+     (modify-inputs (package-native-inputs libguestfs-minimal)
+       (prepend cdrtools
+                gobject-introspection
+                lua
+                `(,openjdk "jdk")
+                python
+                util-linux)))
+    (inputs
+     (modify-inputs (package-inputs libguestfs-minimal)
+       (prepend acl
+                bdb
+                gmp
+                libapparmor
+                libcap
+                libcap-ng
+                libconfig
+                libvirt
+                libxcrypt
+                numactl
+                yajl)))))
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Mon, 16 Sep 2024 14:23:01 GMT) Full text and rfc822 format available.

Message #17 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Jiri Spacek <spacek <at> stokorec.cz>
To: 73260 <at> debbugs.gnu.org
Subject: bug#73260
Date: Mon, 16 Sep 2024 14:15:54 +0200
[Message part 1 (text/plain, inline)]
I've tried your patch off tree (in my own) however the provided patch 
libguestfs-syms.patch does not apply correctly for the version of 
libguestfs-minimal <at> 1.53.6 used:

> applying 
> '/gnu/store/866c9b68vmmyz8vzzk014qdgg13jayfj-libguestfs-syms.patch'...
> patching file lib/Makefile.am
> Hunk #1 FAILED at 160.
> 1 out of 1 hunk FAILED -- saving rejects to file lib/Makefile.am.rej
> patching file lib/Makefile.in
> patch unexpectedly ends in middle of line
> Hunk #1 FAILED at 1109.
> 1 out of 1 hunk FAILED -- saving rejects to file lib/Makefile.in.rej

I've tried newer version of the patch that is a part of 
libguestfs-1.50.1 nixpkg [1] and it applies correctly (but, I'm not sure 
what it does or if it is needed at all in Guix..)

Anyway, thank you for your contribution. This pkg is just what I was 
looking for recently.

Jiri

[1] 
https://raw.githubusercontent.com/NixOS/nixpkgs/025d82d45cf50400f68f06c5d07458f54926956e/pkgs/development/libraries/libguestfs/default.nix
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Mon, 30 Sep 2024 17:05:02 GMT) Full text and rfc822 format available.

Message #20 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 73260 <at> debbugs.gnu.org
Subject: Re: bug#73260: Add libguestfs
Date: Mon, 30 Sep 2024 19:03:59 +0200
Hi,

Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:

> * gnu/packages/virtualization.scm (hivex): New variable.
>
> Change-Id: I9828d267d5c6f24dc5039ea3b1849248cd9d23fb

[...]

> +      #:configure-flags
> +      #~(list
> +         "--disable-static"
> +         "--with-readline"
> +         "--disable-rpath")

Please keep it on one line.

> +      #~(modify-phases %standard-phases
> +          (replace 'bootstrap
> +            (lambda _
> +              (invoke "autoreconf" "-vif")))

I expect this to be unnecessary: isn’t that equivalent to the default
‘bootstrap’ phase?

> +          (add-before 'install 'set-rpath
> +            (lambda _
> +              (for-each
> +               (lambda (sofile)
> +                 ;; The ‘validate-runpath’ phase fails to find libhivex.so.0.
> +                 (invoke (string-append #$(this-package-native-input "patchelf")
> +                                        "/bin/patchelf")
> +                         "--add-rpath" (string-append #$output "/lib") sofile))
> +               '("perl/blib/arch/auto/Win/Hivex/Hivex.so"
> +                 "ruby/ext/hivex/_hivex.so"))))

As a rule of thumb, when building from source, better arrange to pass
the right ‘-Wl,-rpath=…’ flags to the compiler than resorting to
PatchELF (PatchELF is useful when dealing with prebuilt binaries).

In this case, could you tweak the build system to pass
‘-Wl,-rpath=(string-append #$output "/lib")’ when building these two
shared libraries?

> +    (license license:lgpl2.1)))

Please double-check whether it’s really explicitly “v2.1-only”.  By
default, it’s “or any later version”, meaning ‘lgpl2.1+’.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Mon, 30 Sep 2024 17:08:02 GMT) Full text and rfc822 format available.

Message #23 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 73260 <at> debbugs.gnu.org
Subject: Re: bug#73260: Add libguestfs
Date: Mon, 30 Sep 2024 19:07:04 +0200
Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:

> * gnu/packages/virtualization.scm (libguestfs-minimal): New variable.
> * gnu/packages/patches/libguestfs-syms.patch: Add file.
> * gnu/local.mk: Add it.
>
> Change-Id: Ide22707724ecd41145243c9f41adc3f5557c593e

[...]

> +++ b/gnu/packages/patches/libguestfs-syms.patch
> @@ -0,0 +1,26 @@
> +diff -urN a/lib/Makefile.am b/lib/Makefile.am

As suggested by ‘guix lint’ :-), please add a couple of lines at the top
explaining what the patch does and what its upstream status is.


[...]

> +               (modify-phases %standard-phases
> +                 (add-after 'unpack 'patch-makefiles
> +                   (lambda _
> +                     (for-each patch-shebang
> +                               (find-files "."))
> +                     (for-each (lambda (makefile)
> +                                 (substitute* "ocaml/Makefile.am"
> +                                   (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
> +                                    lib/ocaml)))
> +                               '("ocaml/Makefile.am"
> +                                 "ocaml/Makefile.in"))))
> +                 (replace 'bootstrap
> +                   (lambda _
> +                     (invoke "autoreconf" "-vif")))

You can arrange to only modify ‘Makefile.in’, in which case the
‘bootstrap’ phase is unnecessary and autotools can be removed from the
inputs.

> +                        ;; The ‘validate-runpath’ phase fails to find libguestfs.so.0.
> +                        (invoke (string-append #$(this-package-native-input "patchelf")
> +                                               "/bin/patchelf")
> +                                "--add-rpath" (string-append #$output "/lib") sofile))
> +                      '("perl/blib/arch/auto/Sys/Guestfs/Guestfs.so"
> +                        "ocaml/dllmlguestfs.so"))))

Same comment as on the previous patch.  :-)





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Mon, 30 Sep 2024 17:10:02 GMT) Full text and rfc822 format available.

Message #26 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 73260 <at> debbugs.gnu.org
Subject: Re: bug#73260: Add libguestfs
Date: Mon, 30 Sep 2024 19:08:40 +0200
Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:

> * gnu/packages/virtualization.scm (libguestfs): New variable.
>
> Change-Id: I99243550a7a6c9d787fa1a67e54acefd3deeaf1f

[...]

> +(define-public libguestfs
> +  (package
> +    (inherit libguestfs-minimal)

Rather:

  (package/inherit libguestfs-minimal
    …)

so that the ‘replacement’ field is inherited too, should it ever be used
in the future.

Could you send updated patches?

Thanks for the great work!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Fri, 04 Oct 2024 22:32:02 GMT) Full text and rfc822 format available.

Message #29 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: paul <goodoldpaul <at> autistici.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 73260 <at> debbugs.gnu.org
Subject: Re: bug#73260: Add libguestfs
Date: Sat, 5 Oct 2024 00:31:09 +0200
Hi Ludo’ ,

I should have addressed your comments, I'm sending a v2 patchset.

Thank you for your help,





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Fri, 04 Oct 2024 22:33:01 GMT) Full text and rfc822 format available.

Message #32 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH v2 1/3] gnu: Add hivex.
Date: Sat,  5 Oct 2024 00:31:42 +0200
* gnu/packages/virtualization.scm (hivex): New variable.

Change-Id: I9828d267d5c6f24dc5039ea3b1849248cd9d23fb
---
 gnu/packages/virtualization.scm | 111 ++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 59137eb2d4..4ad94ea8e5 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -37,6 +37,7 @@
 ;;; Copyright © 2024 jgart <jgart <at> dismail.de>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is <at> lostca.se>
 ;;; Copyright © 2024 Jakob Kirsch <jakob.kirsch <at> web.de>
+;;; Copyright © 2024 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -114,6 +115,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages pciutils)
@@ -2900,3 +2902,112 @@ (define-public riscv-pk
 supervisor execution environment for tethered RISC-V systems.  It is designed
 to host the RISC-V Linux port.")
     (license license:bsd-3)))
+
+(define-public hivex
+  (package
+    (name "hivex")
+    (version "1.3.24")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://libguestfs.org/download/"
+                                  name "/" name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0g0rib62qg81fda8lxsaa7a1ykqy4rl5sq185pdqm9y9xifa8bx5"))))
+    (build-system gnu-build-system)
+    (native-inputs (list automake
+                         autoconf
+                         gettext-minimal
+                         libtool
+                         ocaml
+                         pkg-config
+                         perl-io-stringy
+                         python-wrapper
+                         ruby
+                         ruby-rake
+                         ruby-rdoc))
+    (inputs
+     (list bash-minimal
+           libxml2
+           perl
+           readline))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "--disable-static" "--with-readline" "--disable-rpath"
+              (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-makefiles
+            (lambda _
+              (let* ((current-system (or #$(%current-target-system)
+                                         #$(%current-system)))
+                     (ocamllib
+                      (string-append #$output "/lib/ocaml/"
+                                     #$(package-version
+                                        (this-package-native-input "ocaml")) "/site-lib"))
+                     (python-installdir
+                      (string-append #$output "/lib/python"
+                                     #$(version-major+minor
+                                        (package-version
+                                         (this-package-native-input
+                                          "python-wrapper")))
+                                     "/site-packages"))
+                     (ruby-version
+                      #$(package-version
+                         (this-package-native-input "ruby")))
+                     (ruby-libdir
+                      (string-append #$output
+                                     "/lib/ruby/site_ruby/"
+                                     ruby-version))
+                     (ruby-archdir
+                      (string-append ruby-libdir "/" current-system)))
+                (substitute* "lib/Makefile.am"
+                  (((string-append "\\$\\(VERSION_SCRIPT_FLAGS\\)"
+                                   "\\$\\(srcdir\\)/hivex\\.syms"))
+                   ""))
+                (substitute* "python/Makefile.am"
+                  (("\\$\\(PYTHON_INSTALLDIR\\)")
+                   python-installdir))
+                (substitute* "ocaml/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                   ocamllib))
+                (substitute* "ruby/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
+                   ruby-archdir)
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
+                   ruby-libdir))
+                ;; The ‘validate-runpath’ phase fails to find libhivex.so.0.
+                (substitute* "perl/Makefile.PL.in"
+                  (("CCFLAGS => \\$Config\\{ccflags\\} \\. ' @CFLAGS@',")
+                   (string-append "CCFLAGS => $Config{ccflags} . ' @CFLAGS@',
+    LDDLFLAGS => $Config{lddlflags} . ' -Wl,-rpath," #$output "/lib',")))
+                (substitute* "ruby/ext/hivex/extconf.rb"
+                  (("create_header")
+                   (string-append "
+$LDFLAGS += \" -Wl,-rpath=" #$output "/lib \"
+create_header"))))))
+          (add-after 'install 'wrap-binaries
+            (lambda _
+              (let ((hivexregedit
+                     (string-append #$output "/bin/hivexregedit"))
+                    (hivexml
+                     (string-append #$output "/bin/hivexml")))
+                (wrap-program hivexregedit
+                  `("PERL5LIB" ":" prefix
+                    (,(string-append #$output "/lib/perl5/site_perl")))
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))
+                (wrap-program hivexml
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))))))))
+    (home-page "https://github.com/libguestfs/hivex")
+    (synopsis "Windows registry hive extraction library")
+    (description
+     "This package provides a self-contained library for reading and writing
+Windows Registry \"hive\" binary files.  Unlike many other tools in this area,
+it doesn't use the textual @code{.REG} format for output, because parsing that
+is as much trouble as parsing the original binary format.  Instead it makes the
+file available through a C API, or through a separate program to export the
+hive as XML.")
+    (license license:lgpl2.1)))

base-commit: 7e63a35ff265f5cb6efa8bbe0bbf62bb9c102cf0
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Fri, 04 Oct 2024 22:33:02 GMT) Full text and rfc822 format available.

Message #35 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH v2 3/3] gnu: Add libguestfs.
Date: Sat,  5 Oct 2024 00:31:44 +0200
* gnu/packages/virtualization.scm (libguestfs): New variable.

Change-Id: I99243550a7a6c9d787fa1a67e54acefd3deeaf1f
---
 gnu/packages/virtualization.scm | 90 +++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 4d3d7502f1..bfca5885c6 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -61,6 +61,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages apparmor)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages attr)
+  #:use-module (gnu packages apparmor)
   #:use-module (gnu packages augeas)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
@@ -81,6 +82,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages cyrus-sasl)
+  #:use-module (gnu packages dbm)
   #:use-module (gnu packages debian)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages dns)
@@ -103,6 +105,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages haskell-apps)
   #:use-module (gnu packages haskell-check)
@@ -113,6 +116,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
   #:use-module (gnu packages multiprecision)
@@ -3138,3 +3142,89 @@ (define-public libguestfs-minimal
 guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
 disks, resizing disks, and much more.")
     (license (list license:gpl2+ license:lgpl2.1+))))
+
+(define-public libguestfs
+  (package/inherit libguestfs-minimal
+    (name "libguestfs")
+    (arguments
+     (substitute-keyword-arguments (package-arguments libguestfs-minimal)
+       ((#:configure-flags flags)
+        #~(append
+           (filter
+            (lambda (flag)
+              (not (string-prefix? "LDFLAGS" flag)))
+            #$flags)
+           (list
+            "--enable-vala=yes"
+            (string-append "--with-python-installdir="
+                           #$output "/lib/python"
+                           #$(version-major+minor
+                              (package-version python))
+                           "/site-packages")
+            (string-append "LDFLAGS=-Wl,-rpath," %output "/lib"))))
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'patch-makefiles 'patch-additional-makefiles
+              (lambda _
+                (let* ((current-system (or #$(%current-target-system)
+                                           #$(%current-system)))
+                       (lib (string-append #$output "/lib"))
+                       (share (string-append #$output "/share"))
+                       (completions
+                        (string-append share "/bash-completion/completions"))
+                       (lib/lua (string-append lib "/lua"))
+                       (lib/ocaml (string-append lib "/ocaml"))
+                       (ruby-version
+                        #$(package-version
+                           (this-package-native-input "ruby")))
+                       (ruby-libdir
+                        (string-append lib
+                                       "/ruby/site_ruby/"
+                                       ruby-version))
+                       (ruby-archdir
+                        (string-append ruby-libdir "/" current-system)))
+                  (substitute* "m4/guestfs-bash-completion.m4"
+                    (("`pkg-config --variable=completionsdir bash-completion`")
+                     completions))
+                  (substitute* "ocaml/Makefile.am"
+                    (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                     lib/ocaml))
+                  (substitute* "lua/Makefile.am"
+                    (("\\$\\(DESTDIR\\)\\$\\(lualibdir\\)")
+                     lib/lua))
+                  (substitute* "ruby/Makefile.am"
+                    (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
+                     ruby-archdir)
+                    (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
+                     ruby-libdir))
+                  ;; The ‘validate-runpath’ phase fails to find libguestfs.so.0.
+                  (substitute* "ruby/ext/guestfs/extconf.rb.in"
+                    (("create_header")
+                     (string-append "
+$LDFLAGS += \" -Wl,-rpath=" #$output "/lib \"
+create_header"))))))))))
+    (native-inputs
+     (modify-inputs (package-native-inputs libguestfs-minimal)
+       (prepend autoconf
+                automake
+                bash-completion
+                cdrtools
+                gobject-introspection
+                python
+                ruby
+                util-linux
+                vala)))
+    (inputs
+     (modify-inputs (package-inputs libguestfs-minimal)
+       (prepend acl
+                bdb
+                fuse
+                gmp
+                libapparmor
+                libcap
+                libcap-ng
+                libconfig
+                libvirt
+                libxcrypt
+                numactl
+                yajl)))))
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#73260; Package guix-patches. (Fri, 04 Oct 2024 22:33:02 GMT) Full text and rfc822 format available.

Message #38 received at 73260 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 73260 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH v2 2/3] gnu: Add libguestfs-minimal.
Date: Sat,  5 Oct 2024 00:31:43 +0200
* gnu/packages/virtualization.scm (libguestfs-minimal): New variable.
* gnu/packages/patches/libguestfs-syms.patch: Add file.
* gnu/local.mk: Add it.

Change-Id: Ide22707724ecd41145243c9f41adc3f5557c593e
---
 gnu/local.mk                               |   1 +
 gnu/packages/patches/libguestfs-syms.patch |  44 +++++++
 gnu/packages/virtualization.scm            | 127 +++++++++++++++++++++
 3 files changed, 172 insertions(+)
 create mode 100644 gnu/packages/patches/libguestfs-syms.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 49660d4b3e..6503b0cb7a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1607,6 +1607,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.0.patch	\
   %D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.1.patch	\
   %D%/packages/patches/libgeotiff-fix-tests-on-i386.patch	\
+  %D%/packages/patches/libguestfs-syms.patch            	\
   %D%/packages/patches/libobjc2-unbundle-robin-map.patch	\
   %D%/packages/patches/libvirt-add-install-prefix.patch	\
   %D%/packages/patches/libziparchive-add-includes.patch		\
diff --git a/gnu/packages/patches/libguestfs-syms.patch b/gnu/packages/patches/libguestfs-syms.patch
new file mode 100644
index 0000000000..ad7453ea3c
--- /dev/null
+++ b/gnu/packages/patches/libguestfs-syms.patch
@@ -0,0 +1,44 @@
+diff -urN a/lib/Makefile.am b/lib/Makefile.am
+
+Without this patch the build phase fails during linking with:
+
+ld:./libguestfs.syms: file format not recognized; treating as linker script
+ld:./libguestfs.syms:23: syntax error
+collect2: error: ld returned 1 exit status
+make[3]: *** [Makefile:1252: libguestfs.la] Error 1
+make[3]: *** Waiting for unfinished jobs....
+Wide character in print at /tmp/guix-build-libguestfs-1.53.6.drv-0/libguestfs-1.50.1/podwrapper.pl line 633.
+touch stamp-guestfs.pod
+make[3]: Leaving directory '/tmp/guix-build-libguestfs-1.53.6.drv-0/libguestfs-1.50.1/lib'
+make[2]: *** [Makefile:1161: all] Error 2
+make[2]: Leaving directory '/tmp/guix-build-libguestfs-1.53.6.drv-0/libguestfs-1.50.1/lib'
+make[1]: *** [Makefile:1083: all-recursive] Error 1
+make[1]: Leaving directory '/tmp/guix-build-libguestfs-1.53.6.drv-0/libguestfs-1.50.1'
+make: *** [Makefile:989: all] Error 2
+error: in phase 'build': uncaught exception:
+
+--- a/lib/Makefile.am	2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.am	2023-07-20 17:35:47.305793499 +0200
+@@ -160,8 +160,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+-	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+ 
+ if HAVE_FUSE
+ # XXX Unfortunately FUSE_CFLAGS defines _FILE_OFFSET_BITS=64.
+diff -urN a/lib/Makefile.in b/lib/Makefile.in
+--- a/lib/Makefile.in	2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.in	2023-07-20 17:36:05.474213641 +0200
+@@ -1109,8 +1109,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+-	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+ 
+ @HAVE_LIBVIRT_TRUE <at> libvirt_is_version_SOURCES = libvirt-is-version.c
+ @HAVE_LIBVIRT_TRUE <at> libvirt_is_version_LDADD = \
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 4ad94ea8e5..4d3d7502f1 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -61,6 +61,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages apparmor)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages attr)
+  #:use-module (gnu packages augeas)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
@@ -68,11 +69,13 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages bootloaders)
   #:use-module (gnu packages build-tools)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cluster)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages containers)
+  #:use-module (gnu packages cpio)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages cryptsetup)
@@ -84,6 +87,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages figlet)
+  #:use-module (gnu packages file)
   #:use-module (gnu packages firmware)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fonts)
@@ -96,6 +100,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell)
@@ -3011,3 +3016,125 @@ (define-public hivex
 file available through a C API, or through a separate program to export the
 hive as XML.")
     (license license:lgpl2.1)))
+
+(define-public libguestfs-minimal
+  (package
+    (name "libguestfs-minimal")
+    (version "1.53.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://libguestfs.org/download/"
+                                  (version-major+minor version)
+                                  "-stable/libguestfs-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0vssarc3n4kv26fyjmkrrcvh55v41fhycba43pij3rc2izl72s2y"))
+              (patches
+               (search-patches "libguestfs-syms.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "--disable-appliance"
+                   "--disable-daemon"
+                   "--disable-static"
+                   "--disable-erlang"
+                   "--disable-golang"
+                   "--disable-haskell"
+                   "--disable-java"
+                   "--disable-lua"
+                   ;; FIXME: Perl bindings have wrong rpath and break the
+                   ;; validate-runpath phase.  Temporarily disable them until
+                   ;; a way is found to correctly patch perl/Build.PL.in.
+                   "--disable-perl"
+                   "--disable-php"
+                   "--with-distro=\"Guix System\""
+                   "--with-readline"
+                   (string-append "LDFLAGS=-Wl,-rpath," %output "/lib"))
+           #:make-flags #~`("REALLY_INSTALL=yes")
+           #:phases
+           #~(let* ((lib (string-append #$output "/lib"))
+                    (lib/ocaml (string-append lib "/ocaml")))
+               (modify-phases %standard-phases
+                 (add-after 'unpack 'patch-makefiles
+                   (lambda _
+                     (for-each patch-shebang
+                               (find-files "."))
+                     (substitute* "ocaml/Makefile.in"
+                       (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                        lib/ocaml))
+                     ;; FIXME: Perl bindings have broken runpath,
+                     ;; this substitution doesn't seem to work.
+                     (substitute* "perl/Build.PL.in"
+                       (("extra_linker_flags => \\[")
+                        (string-append "extra_linker_flags => [
+        '-L" #$output "/lib',")))))
+                 (replace 'check
+                   (lambda* (#:key tests? make-flags #:allow-other-keys)
+                     (when tests?
+                       (apply invoke `("make" ,@make-flags "check-direct")))))
+                 (replace 'install
+                   (lambda* (#:key make-flags #:allow-other-keys)
+                     (mkdir-p "temp-build-dir")
+                     (apply invoke `("make" ,@make-flags "INSTALLDIRS=vendor"
+                                     "install"))))
+                 (add-after 'install 'wrap-binaries
+                   (lambda _
+                     (let ((bin (string-append #$output "/bin")))
+                       (for-each
+                        (lambda (binary)
+                          (use-modules (srfi srfi-1))
+                          (wrap-program binary
+                            `("PERL5LIB" ":" prefix
+                              (,(string-append #$output
+                                               "/lib/perl5/site_perl")))
+                            `("PATH" ":" prefix
+                              ,(search-path-as-list
+                                '("bin")
+                                (map second
+                                     '#$(package-inputs this-package))))))
+                        (find-files bin)))))
+                 (replace 'validate-documentation-location
+                   (lambda _
+                     (let ((man-dir
+                            (string-append #$output "/man"))
+                           (info-dir
+                            (string-append #$output "/info")))
+                       (for-each (lambda (d)
+                                   (invoke "rm" "-rf" d))
+                                 (list man-dir info-dir)))))))))
+    (native-inputs (list augeas
+                         bison
+                         cpio
+                         flex
+                         gettext-minimal
+                         gperf
+                         libtool
+                         ocaml
+                         ocaml-findlib
+                         ncurses
+                         perl
+                         perl-getopt-long
+                         perl-module-build
+                         pkg-config
+                         po4a
+                         xorriso
+                         xz
+                         zstd))
+    (inputs
+     (list file
+           fuse
+           jansson
+           hivex
+           libtirpc
+           pcre2
+           readline
+           qemu))
+    (home-page "https://libguestfs.org/")
+    (synopsis "Access and modify virtual machine disk images")
+    (description
+     "@code{libguestfs} is a set of tools for accessing and modifying virtual
+machine (VM) disk images.  You can use this for viewing and editing files inside
+guests, scripting changes to VMs, monitoring disk used/free statistics, creating
+guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
+disks, resizing disks, and much more.")
+    (license (list license:gpl2+ license:lgpl2.1+))))
-- 
2.46.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 07 Oct 2024 10:41:02 GMT) Full text and rfc822 format available.

Notification sent to paul <goodoldpaul <at> autistici.org>:
bug acknowledged by developer. (Mon, 07 Oct 2024 10:41:02 GMT) Full text and rfc822 format available.

Message #43 received at 73260-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 73260-done <at> debbugs.gnu.org
Subject: Re: bug#73260: Add libguestfs
Date: Mon, 07 Oct 2024 12:40:26 +0200
Hi Giacomo,

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Nov 2024 12:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 230 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.