unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#44040] libguestfs + ocaml-hivex help wanted
@ 2020-10-16 19:43 Morgan Smith
  2020-10-16 20:00 ` [bug#44040] [PATCH 1/2] gnu: Add ocaml-hivex Morgan.J.Smith
  2020-10-16 20:00 ` [bug#44040] [PATCH 2/2] gnu: Add libguestfs Morgan.J.Smith
  0 siblings, 2 replies; 4+ messages in thread
From: Morgan Smith @ 2020-10-16 19:43 UTC (permalink / raw)
  To: 44040


[-- Attachment #1.1.1: Type: text/plain, Size: 381 bytes --]

So I've sunk a lot of time into this package but I actually don't need
it anymore. My use-case is gone. Also I don't have a lot of time these
days. It does build and some of the tests pass, but It's untested since
I don't have a use case.

Basically I'm just posting this here so someone else can finish it. I
don't want to touch this anymore. Sorry for only going half way

[-- Attachment #1.1.2: OpenPGP_0x52D93416EEAA45A6.asc --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44040] [PATCH 1/2] gnu: Add ocaml-hivex.
  2020-10-16 19:43 [bug#44040] libguestfs + ocaml-hivex help wanted Morgan Smith
@ 2020-10-16 20:00 ` Morgan.J.Smith
  2020-10-16 20:00 ` [bug#44040] [PATCH 2/2] gnu: Add libguestfs Morgan.J.Smith
  1 sibling, 0 replies; 4+ messages in thread
From: Morgan.J.Smith @ 2020-10-16 20:00 UTC (permalink / raw)
  To: 44040; +Cc: Morgan Smith

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/ocaml.scm (ocaml-hivex): New variable.
---
 gnu/packages/ocaml.scm | 104 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 4cc530509a..88c7f3c1d3 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,6 +48,8 @@
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gperf)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
@@ -68,6 +71,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web-browsers)
   #:use-module (gnu packages xml)
@@ -2831,6 +2835,106 @@ writing to these structures, and they are accessed via the Bigarray module.")
     (description "Hex is a minimal library providing hexadecimal converters.")
     (license license:isc)))
 
+(define-public ocaml-hivex
+  (package
+    (name "ocaml-hivex")
+    ;; Make sure to update the gnulib input to the commit upstream uses when
+    ;; updating this package
+    (version "1.3.19")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/libguestfs/hivex")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1gw59ac6z4fbg0flajnsh6d25h75pnk4605d5rw9rv0bvhfvway5"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(;; XXX: I'm not sure why runpath validation doesn't work
+       #:validate-runpath? #f
+       #:configure-flags
+       (list (string-append "CONFIG_SHELL="
+                            (assoc-ref %build-inputs "bash") "/bin/bash")
+             (string-append "SHELL="
+                            (assoc-ref %build-inputs "bash") "/bin/bash"))
+       #:test-target "check"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unpack-gnulib
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((gnulib (assoc-ref inputs "gnulib")))
+               ;; Upstream gnulib is cloned into this directory as a submodule
+               (copy-recursively gnulib ".gnulib")
+               #t)))
+         ;; Autogen calls bootstrap and then generates a configure script
+         (add-before 'configure 'autogen
+           (lambda _
+             (chmod "configure.ac" #o644)
+             (invoke "./autogen.sh")
+             #t))
+         (add-before 'autogen 'fix-bootstrap
+           (lambda _
+             ;; Stop bootstrap from cloning gnulib
+             (substitute* "bootstrap"
+               (("^git.*$") ""))
+             #t))
+         (add-before 'autogen 'fix-autogen.sh
+           (lambda _
+             (substitute* "autogen.sh"
+               ;; Forces bootstrap to run
+               (("git submodule status") "echo false")
+               ;; Don't run configure yet
+               (("^.*configure.*$") "echo\n"))
+             #t))
+         (add-after 'autogen 'patch-configure-and-build-aux
+           (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+             (patch-shebang "configure")
+             ;; Hard code paths to ld and file in the configure script
+             (substitute* "configure"
+               (("/usr/bin/ld")
+                (string-append (assoc-ref inputs "ld-wrapper") "/bin/ld"))
+               (("/usr/bin/file")
+                (string-append (assoc-ref inputs "file") "/bin/file")))
+             #t))
+         (add-before 'install 'patch-ocaml-installdir
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               ;; Force ocaml installdir to be correct
+               (substitute* "ocaml/Makefile"
+                 (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                  (string-append
+                   out "/lib/ocaml/site-lib"))))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gperg" ,gperf)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)
+       ("gnulib"
+        ;; This is the commit upstream uses
+        ,(let ((commit "5e50baa16ef90204d9048a9e2f23c5a538955121"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url "git://git.savannah.gnu.org/gnulib.git")
+                   (commit commit)))
+             (sha256
+              (base32 "0clx0gq6mmm4dkzp5pqh02cbzggnc3ba491qb79brpxcrjri1pnd"))
+             (file-name (git-file-name "gnulib" commit)))))))
+    (inputs
+     `(("perl" ,perl)
+       ("sed" ,sed)
+       ("gettext" ,gettext-minimal)))
+    (home-page "https://github.com/libguestfs/hivex")
+    (synopsis "Library for reading and writing Windows Registry \"hive\"
+binary files")
+    (description "This library reads Windows NT registry files (ie. not
+Windows 3.1 or Windows 95/98/ME).")
+    (license license:lgpl2.1)))
+
 (define-public ocaml4.07-ezjsonm
   (package
     (name "ocaml4.07-ezjsonm")
-- 
2.28.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44040] [PATCH 2/2] gnu: Add libguestfs.
  2020-10-16 19:43 [bug#44040] libguestfs + ocaml-hivex help wanted Morgan Smith
  2020-10-16 20:00 ` [bug#44040] [PATCH 1/2] gnu: Add ocaml-hivex Morgan.J.Smith
@ 2020-10-16 20:00 ` Morgan.J.Smith
  2020-10-28 17:19   ` Joshua Branson via Guix-patches via
  1 sibling, 1 reply; 4+ messages in thread
From: Morgan.J.Smith @ 2020-10-16 20:00 UTC (permalink / raw)
  To: 44040; +Cc: Morgan Smith

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/virtualization.scm (libguestfs): New variable.
---
 gnu/packages/virtualization.scm | 103 ++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index ac062dfa15..d958d99330 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,13 +38,16 @@
   #: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)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpio)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages cyrus-sasl)
@@ -63,6 +67,7 @@
   #: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)
@@ -79,8 +84,10 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages polkit)
@@ -2032,3 +2039,99 @@ administrators and developers in managing the database.")
 libosinfo library.  It provides information about guest operating systems for
 use with virtualization provisioning tools")
     (license license:lgpl2.0+)))
+
+(define-public libguestfs
+  (package
+    (name "libguestfs")
+    (version "1.42.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://download.libguestfs.org/"
+                    (version-major+minor version)
+                    "-stable/libguestfs-"
+                    version
+                    ".tar.gz"))
+              (sha256
+               (base32
+                "097hfi53w5lhf3im9l1lrymzv07ksyi1zcmg8bqrg9daycn1kvjg"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(;; XXX: I'm not sure why runpath validation doesn't work
+       #:validate-runpath? #f
+       ;; XXX: It's possible to get at least some of the tests to work
+       #:tests? #f
+       #:configure-flags (list "--disable-gnulib-tests"
+                               "--disable-daemon"
+                               "--disable-appliance"
+                               "--with-distro=none"
+                               "--disable-static")
+       ;; Installation is discouraged because users might want to have multiple
+       ;; versions installed at once. For that reason we have to specify
+       ;; "REALLY_INSTALL=yes" to install
+       #:make-flags (list "REALLY_INSTALL=yes")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Our ncurses package doesn't have a binary called
+             ;; "ncurses6-config". It probably should though
+             (substitute* "configure"
+               (("ncurses6-config")
+                "ncursesw6-config"))
+             ;; Hard code paths to ld and file in the configure script
+             (substitute* "configure"
+               (("/usr/bin/ld")
+                (string-append (assoc-ref inputs "ld-wrapper") "/bin/ld"))
+               (("/usr/bin/file")
+                (string-append (assoc-ref inputs "file") "/bin/file")))
+             #t))
+         (add-before 'check 'fix-tests
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((bash (string-append (assoc-ref inputs "bash") "/bin/bash")))
+               (setenv "SHELL" bash))
+             #t))
+         (add-before 'install 'patch-ocaml-installdir
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               ;; Force ocaml installdir to be correct
+               (substitute* "ocaml/Makefile"
+                 (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                  (string-append
+                   out "/lib/ocaml/site-lib"))))
+             #t)))))
+    (native-inputs
+     `(("bison" ,bison)
+       ("curl" ,curl)
+       ("flex" ,flex)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("augeas" ,augeas)
+       ("cdrkit-libre" ,cdrkit-libre)
+       ("cpio" ,cpio)
+       ("fuse" ,fuse)
+       ("gperf" ,gperf)
+       ("gperf" ,gperf)
+       ("jansson" ,jansson)
+       ("libselinux" ,libselinux)
+       ("libtirpc" ,libtirpc)
+       ("libvirt" ,libvirt)
+       ("libxml2" ,libxml2)
+       ("util-linux" ,util-linux) ; getopt
+       ("ncurses" ,ncurses)
+       ("ocaml" ,ocaml)
+       ("ocaml-findlib" ,ocaml-findlib)
+       ("ocaml-hivex" ,ocaml-hivex)
+       ("pcre" ,pcre)
+       ("perl" ,perl)
+       ("qemu" ,qemu)))
+    (home-page "https://libguestfs.org/")
+    (synopsis "Tools for accessing and modifying virtual machine (VM) disk
+images")
+    (description "libguestfs is a C library and a set of tools for accessing
+and modifying virtual disk images used in platform virtualization.  The tools
+can be used for viewing and editing virtual machines (VMs) managed by libvirt
+and files inside VMs, scripting changes to VMs, and creating VMs.")
+    ;; The library files are released under LGPLv2.1 or later.
+    ;; The programs ;; are released under GPLv2+.
+    (license (list license:lgpl2.1+ license:gpl2+))))
-- 
2.28.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44040] [PATCH 2/2] gnu: Add libguestfs.
  2020-10-16 20:00 ` [bug#44040] [PATCH 2/2] gnu: Add libguestfs Morgan.J.Smith
@ 2020-10-28 17:19   ` Joshua Branson via Guix-patches via
  0 siblings, 0 replies; 4+ messages in thread
From: Joshua Branson via Guix-patches via @ 2020-10-28 17:19 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44040


Also libguestfs may be helpful for the Hurd filesystem translators:

https://www.gnu.org/software/hurd/hurd/translator/libguestfs.html

-- 
Joshua Branson
Sent from Emacs and Gnus
https://gnucode.me
https://video.hardlimit.com/accounts/joshua_branson/video-channels
"You can have whatever you want, as long as you help enough other people get what they want." - Zig Ziglar




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-28 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 19:43 [bug#44040] libguestfs + ocaml-hivex help wanted Morgan Smith
2020-10-16 20:00 ` [bug#44040] [PATCH 1/2] gnu: Add ocaml-hivex Morgan.J.Smith
2020-10-16 20:00 ` [bug#44040] [PATCH 2/2] gnu: Add libguestfs Morgan.J.Smith
2020-10-28 17:19   ` Joshua Branson via Guix-patches via

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git