unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#28913] gnu: Add criu
@ 2017-10-18 19:09 Ricardo Wurmus
  2017-10-21  0:55 ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2017-10-18 19:09 UTC (permalink / raw)
  To: 28913

This patch set adds libnet and criu.  Criu supposedly allows one to dump
a process’s memory image to disk and recover it even after a reboot.  It
uses the kernel’s snapshot facility (which is not enabled in our kernel
packages) to achieve this.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* [bug#28913] [PATCH 1/2] gnu: Add libnet.
  2017-10-18 19:09 [bug#28913] gnu: Add criu Ricardo Wurmus
@ 2017-10-21  0:55 ` Ricardo Wurmus
  2017-10-21  0:55   ` [bug#28913] [PATCH 2/2] gnu: Add criu Ricardo Wurmus
  2017-10-22 22:38   ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2017-10-21  0:55 UTC (permalink / raw)
  To: 28913; +Cc: Ricardo Wurmus

* gnu/packages/networking.scm (libnet): New variable.
---
 gnu/packages/networking.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 633b8ca43..115e58660 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -48,6 +48,7 @@
   #:use-module (gnu packages adns)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages code)
@@ -55,6 +56,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dejagnu)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -1494,3 +1496,39 @@ interface and a programmable text output for scripting.")
     ;; Update the license field when upstream responds.
     (license (list license:bsd-2
                    license:expat))))
+
+(define-public libnet
+  (package
+    (name "libnet")
+    (version "1.1.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/sam-github/libnet/"
+                                  "archive/libnet-" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0l4gbzzvr199fzczzricjz7b825i7dlk6sgl5p5alnkcagmq0xys"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda _ (chdir "libnet") #t))
+         (add-after 'chdir 'bootstrap
+           (lambda _ (zero? (system* "autoreconf" "-vif"))))
+         (add-before 'build 'build-doc
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (zero? (apply system* "make" "-C" "doc" "doc"
+                           make-flags)))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("doxygen" ,doxygen)))
+    (home-page "https://sourceforge.net/projects/libnet-dev/")
+    (synopsis "Framework for low-level network packet construction")
+    (description
+     "Libnet provides a fairly portable framework for network packet
+construction and injection.")
+    (license license:bsd-2)))
-- 
2.14.1

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

* [bug#28913] [PATCH 2/2] gnu: Add criu.
  2017-10-21  0:55 ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ricardo Wurmus
@ 2017-10-21  0:55   ` Ricardo Wurmus
  2017-10-22 22:39     ` Ludovic Courtès
  2017-10-22 22:38   ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2017-10-21  0:55 UTC (permalink / raw)
  To: 28913; +Cc: Ricardo Wurmus

* gnu/packages/virtualization.scm (criu): New variable.
---
 gnu/packages/virtualization.scm | 101 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 99 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 4e384e79a..9ff1b9814 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -31,6 +31,8 @@
   #:use-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages dns)
+  #:use-module (gnu packages docbook)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -39,9 +41,11 @@
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages networking)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages polkit)
+  #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages selinux)
   #:use-module (gnu packages sdl)
@@ -54,7 +58,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix download)
-  #:use-module ((guix licenses) #:select (gpl2 gpl2+ lgpl2.1+))
+  #:use-module ((guix licenses) #:select (gpl2 gpl2+ lgpl2.1 lgpl2.1+))
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1))
@@ -558,3 +562,96 @@ virtual machines through libvirt.  It primarily targets KVM VMs, but also
 manages Xen and LXC (Linux containers).  It presents a summary view of running
 domains, their live performance and resource utilization statistics.")
     (license gpl2+)))
+
+(define-public criu
+  (package
+    (name "criu")
+    (version "3.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.openvz.org/criu/criu-"
+                                  version ".tar.bz2"))
+              (sha256
+               (base32
+                "1w0ybla7ac0ql0jzh0vxdf2w9amqp88jcg0na3b33r3hq8acry6x"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:tests? #f ; tests require mounting as root
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             (string-append "LIBDIR=" (assoc-ref %outputs "out")
+                            "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The includes for libnl are located in a sub-directory.
+             (setenv "C_INCLUDE_PATH"
+                     (string-append (assoc-ref inputs "libnl")
+                                    "/include/libnl3:"
+                                    (getenv "C_INCLUDE_PATH")))
+             ;; Prevent xmlto from failing the install phase.
+             (substitute* "Documentation/Makefile"
+               (("XMLTO.*:=.*")
+                (string-append "XMLTO:="
+                               (assoc-ref inputs "xmlto")
+                               "/bin/xmlto"
+                               " --skip-validation "
+                               " -x "
+                               (assoc-ref inputs "docbook-xsl")
+                               "/xml/xsl/docbook-xsl-"
+                               ,(package-version docbook-xsl)
+                               "/manpages/docbook.xsl")))
+             #t))
+         (add-before 'build 'fix-symlink
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The file 'images/google/protobuf/descriptor.proto' points to
+             ;; /usr/include/..., which obviously does not exist.
+             (let* ((file "google/protobuf/descriptor.proto")
+                    (target (string-append "images/" file))
+                    (source (string-append (assoc-ref inputs "protobuf")
+                                           "/include/" file)))
+               (delete-file target)
+               (symlink source target)
+               #t)))
+         (add-after 'install 'wrap
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Make sure 'crit' runs with the correct PYTHONPATH.
+             (let* ((out (assoc-ref outputs "out"))
+                    (path (string-append out
+                                         "/lib/python"
+                                         (string-take (string-take-right
+                                                       (assoc-ref inputs "python") 5) 3)
+                                         "/site-packages:"
+                                         (getenv "PYTHONPATH"))))
+               (wrap-program (string-append out "/bin/crit")
+                 `("PYTHONPATH" ":" prefix (,path))))
+             #t)))))
+    (inputs
+     `(("protobuf" ,protobuf)
+       ("python" ,python-2)
+       ("python2-protobuf" ,python2-protobuf)
+       ("python2-ipaddr" ,python2-ipaddr)
+       ("iproute" ,iproute)
+       ("libaio" ,libaio)
+       ("libcap" ,libcap)
+       ("libnet" ,libnet)
+       ("libnl" ,libnl)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("protobuf-c" ,protobuf-c)
+       ("asciidoc" ,asciidoc)
+       ("xmlto" ,xmlto)
+       ("docbook-xml" ,docbook-xml)
+       ("docbook-xsl" ,docbook-xsl)))
+    (home-page "https://criu.org")
+    (synopsis "Checkpoint and restore in userspace")
+    (description "Using this tool, you can freeze a running application (or
+part of it) and checkpoint it to a hard drive as a collection of files.  You
+can then use the files to restore and run the application from the point it
+was frozen at.  The distinctive feature of the CRIU project is that it is
+mainly implemented in user space.")
+    ;; The project is licensed under GPLv2; files in the lib/ directory are
+    ;; LGPLv2.1.
+    (license (list gpl2 lgpl2.1))))
-- 
2.14.1

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

* [bug#28913] [PATCH 1/2] gnu: Add libnet.
  2017-10-21  0:55 ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ricardo Wurmus
  2017-10-21  0:55   ` [bug#28913] [PATCH 2/2] gnu: Add criu Ricardo Wurmus
@ 2017-10-22 22:38   ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2017-10-22 22:38 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 28913

Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/networking.scm (libnet): New variable.

LGTM!

> +    (home-page "https://sourceforge.net/projects/libnet-dev/")
> +    (synopsis "Framework for low-level network packet construction")
> +    (description
> +     "Libnet provides a fairly portable framework for network packet
> +construction and injection.")

Bonus points if you can elaborate based on ‘README’ or whatever.  :-)

Ludo’.

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

* [bug#28913] [PATCH 2/2] gnu: Add criu.
  2017-10-21  0:55   ` [bug#28913] [PATCH 2/2] gnu: Add criu Ricardo Wurmus
@ 2017-10-22 22:39     ` Ludovic Courtès
  2017-10-23  6:07       ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2017-10-22 22:39 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 28913

Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/virtualization.scm (criu): New variable.

[...]

> +         (replace 'configure
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             ;; The includes for libnl are located in a sub-directory.
> +             (setenv "C_INCLUDE_PATH"
> +                     (string-append (assoc-ref inputs "libnl")
> +                                    "/include/libnl3:"
> +                                    (getenv "C_INCLUDE_PATH")))

And there’s no libnet.pc or similar to provide the right -I flag?

> +    (synopsis "Checkpoint and restore in userspace")

“user space” (two words)?

Otherwise LGTM, thank you!

Ludo’.

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

* [bug#28913] [PATCH 2/2] gnu: Add criu.
  2017-10-22 22:39     ` Ludovic Courtès
@ 2017-10-23  6:07       ` Ricardo Wurmus
  2017-10-23  6:10         ` bug#28913: " Ricardo Wurmus
  2017-10-23 16:25         ` [bug#28913] " Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2017-10-23  6:07 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 28913


Ludovic Courtès <ludo@gnu.org> writes:

> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> * gnu/packages/virtualization.scm (criu): New variable.
>
> [...]
>
>> +         (replace 'configure
>> +           (lambda* (#:key inputs #:allow-other-keys)
>> +             ;; The includes for libnl are located in a sub-directory.
>> +             (setenv "C_INCLUDE_PATH"
>> +                     (string-append (assoc-ref inputs "libnl")
>> +                                    "/include/libnl3:"
>> +                                    (getenv "C_INCLUDE_PATH")))
>
> And there’s no libnet.pc or similar to provide the right -I flag?

There is a libnl-3.0.pc file with these contents:

--8<---------------cut here---------------start------------->8---
prefix=/gnu/store/qyr5m7c21a4myx5421m90yxkxav2qij7-libnl-3.4.0
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libnl
Description: Convenience library for netlink sockets
Version: 3.4.0
Libs: -L${libdir} -lnl-3
Cflags: -I${includedir}/libnl3
--8<---------------cut here---------------end--------------->8---

That’s not enough, though, to find header files included by other libnl
headers.  Without the setenv snippet above compilation fails with this
error:

--8<---------------cut here---------------start------------->8---
In file included from criu/libnetlink.c:5:0:
/gnu/store/qyr5m7c21a4myx5421m90yxkxav2qij7-libnl-3.4.0/include/libnl3/netlink/attr.h:15:29: fatal error: netlink/netlink.h: No such file or directory
compilation terminated.
--8<---------------cut here---------------end--------------->8---

>> +    (synopsis "Checkpoint and restore in userspace")
>
> “user space” (two words)?

Okay. Thanks for reviewing these patches!

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* bug#28913: [PATCH 2/2] gnu: Add criu.
  2017-10-23  6:07       ` Ricardo Wurmus
@ 2017-10-23  6:10         ` Ricardo Wurmus
  2017-10-23 16:25         ` [bug#28913] " Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2017-10-23  6:10 UTC (permalink / raw)
  To: 28913-done


Pushed to master with commit fe420383e.

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* [bug#28913] [PATCH 2/2] gnu: Add criu.
  2017-10-23  6:07       ` Ricardo Wurmus
  2017-10-23  6:10         ` bug#28913: " Ricardo Wurmus
@ 2017-10-23 16:25         ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2017-10-23 16:25 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 28913

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>
>>> * gnu/packages/virtualization.scm (criu): New variable.
>>
>> [...]
>>
>>> +         (replace 'configure
>>> +           (lambda* (#:key inputs #:allow-other-keys)
>>> +             ;; The includes for libnl are located in a sub-directory.
>>> +             (setenv "C_INCLUDE_PATH"
>>> +                     (string-append (assoc-ref inputs "libnl")
>>> +                                    "/include/libnl3:"
>>> +                                    (getenv "C_INCLUDE_PATH")))
>>
>> And there’s no libnet.pc or similar to provide the right -I flag?
>
> There is a libnl-3.0.pc file with these contents:
>
> prefix=/gnu/store/qyr5m7c21a4myx5421m90yxkxav2qij7-libnl-3.4.0
> exec_prefix=${prefix}
> libdir=${exec_prefix}/lib
> includedir=${prefix}/include
>
> Name: libnl
> Description: Convenience library for netlink sockets
> Version: 3.4.0
> Libs: -L${libdir} -lnl-3
> Cflags: -I${includedir}/libnl3
>
>
> That’s not enough, though, to find header files included by other libnl
> headers.  Without the setenv snippet above compilation fails with this
> error:
>
> In file included from criu/libnetlink.c:5:0:
> /gnu/store/qyr5m7c21a4myx5421m90yxkxav2qij7-libnl-3.4.0/include/libnl3/netlink/attr.h:15:29: fatal error: netlink/netlink.h: No such file or directory
> compilation terminated.

Could it be that ‘Cflags’ from the .pc file is not honored?

Ludo’.

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

end of thread, other threads:[~2017-10-23 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 19:09 [bug#28913] gnu: Add criu Ricardo Wurmus
2017-10-21  0:55 ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ricardo Wurmus
2017-10-21  0:55   ` [bug#28913] [PATCH 2/2] gnu: Add criu Ricardo Wurmus
2017-10-22 22:39     ` Ludovic Courtès
2017-10-23  6:07       ` Ricardo Wurmus
2017-10-23  6:10         ` bug#28913: " Ricardo Wurmus
2017-10-23 16:25         ` [bug#28913] " Ludovic Courtès
2017-10-22 22:38   ` [bug#28913] [PATCH 1/2] gnu: Add libnet Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).