GNU bug report logs - #31818
[PATCH] gnu: Add restic.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Wed, 13 Jun 2018 19:19:02 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

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 31818 in the body.
You can then email your comments to 31818 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#31818; Package guix-patches. (Wed, 13 Jun 2018 19:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 13 Jun 2018 19:19:02 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH] gnu: Add restic.
Date: Wed, 13 Jun 2018 22:18:19 +0300
* gnu/packages/backup.scm (restic): New variable.
---
 gnu/packages/backup.scm | 88 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 711bd3224..16c5c7e6f 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017 Christopher Allan Webber <cwebber <at> dustycloud.org>
 ;;; Copyright © 2017 Rutger Helling <rhelling <at> mykolab.com>
 ;;; Copyright © 2018 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
@@ -45,6 +47,7 @@
   #:use-module (gnu packages ftp)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages linux)
@@ -822,3 +825,88 @@ file systems with unattended creation and expiration.  A dirvish backup vault
 is like a time machine for your data. ")
     (license (license:fsf-free "file://COPYING"
                                "Open Software License 2.0"))))
+
+(define-public restic
+  (package
+    (name "restic")
+    (version "0.9.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/restic/restic/releases/download/"
+                    "v" version "/restic-" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "15f0rsm2lxk4lmn4773q28g49p68pqyyx0ccp7r556asan73p79m"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/restic/restic"
+      ;; We don't need to install the source code for end-user applications.
+       #:install-source? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion (string-append
+                                        "src/github.com/restic/restic/restic-"
+                                        ,version)
+               (invoke "go" "run" "build.go"))))
+
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (utils (assoc-ref outputs "utils"))
+                   (src (string-append "src/github.com/restic/restic/restic-"
+                                       ,version)))
+               (install-file (string-append src "/restic")
+                             (string-append out "/bin"))
+               (delete-file (string-append src "/restic"))
+               #t)))
+
+         (add-after 'install 'install-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man "/share/man")
+                    (man-section (string-append man "/man"))
+                    (src (string-append "src/github.com/restic/restic/restic-"
+                                        ,version "/doc/man/")))
+               ;; Install all the man pages to "out".
+               (for-each
+                 (lambda (file)
+                   (install-file file
+                                 (string-append out man-section
+                                                (string-take-right file 1))))
+                 (find-files src "\\.[1-9]"))
+             #t))))))
+    (home-page "https://restic.net/")
+    (synopsis "Backup program with multiple revisions, encryption and more")
+    (description "Restic is a program that does backups right and was designed
+with the following principles in mind:
+
+@itemize
+@item Easy: Doing backups should be a frictionless process, otherwise you
+might be tempted to skip it.  Restic should be easy to configure and use, so
+that, in the event of a data loss, you can just restore it.  Likewise,
+restoring data should not be complicated.
+
+@item Fast: Backing up your data with restic should only be limited by your
+network or hard disk bandwidth so that you can backup your files every day.
+Nobody does backups if it takes too much time.  Restoring backups should only
+transfer data that is needed for the files that are to be restored, so that
+this process is also fast.
+
+@item Verifiable: Much more important than backup is restore, so restic
+enables you to easily verify that all data can be restored.  @item Secure:
+Restic uses cryptography to guarantee confidentiality and integrity of your
+data.  The location the backup data is stored is assumed not to be a trusted
+environment (e.g.  a shared space where others like system administrators are
+able to access your backups).  Restic is built to secure your data against
+such attackers.
+
+@item Efficient: With the growth of data, additional snapshots should only
+take the storage of the actual increment.  Even more, duplicate data should be
+de-duplicated before it is actually written to the storage back end to save
+precious backup space.
+@end itemize")
+    (license license:bsd-2)))
-- 
2.17.1





Information forwarded to guix-patches <at> gnu.org:
bug#31818; Package guix-patches. (Thu, 14 Jun 2018 01:27:01 GMT) Full text and rfc822 format available.

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

From: Leo Famulari <leo <at> famulari.name>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 31818 <at> debbugs.gnu.org
Subject: Re: [bug#31818] [PATCH] gnu: Add restic.
Date: Wed, 13 Jun 2018 21:26:08 -0400
[Message part 1 (text/plain, inline)]
On Wed, Jun 13, 2018 at 10:18:19PM +0300, Oleg Pykhalov wrote:
> * gnu/packages/backup.scm (restic): New variable.

Cool, thanks for this!

> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "https://github.com/restic/restic/releases/download/"
> +                    "v" version "/restic-" version ".tar.gz"))

This tarball includes bundled copies of restic's dependency graph in the
vendor directory.

Adding the package to Guix with the bundled libraries is not how we
usually do things but, if they are all free software, it could be okay.

For Syncthing I unbundled everything — see (gnu packages syncthing).

Go presents a challenge for downstream packagers due to the humongous
dependency graphs of unversioned libraries. Our tooling could handle
this better than it currently does [0], but I don't think we should let
this hold us back now that we are getting patches for Go software :)

Does anyone have opinions about the bundled ("vendored") code in this
package?

> +         (replace 'build
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (with-directory-excursion (string-append
> +                                        "src/github.com/restic/restic/restic-"
> +                                        ,version)
> +               (invoke "go" "run" "build.go"))))

It would be nice if this could be made verbose — currently the build
phase is totally silent.

[0]
<https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00030.html>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31818; Package guix-patches. (Thu, 14 Jun 2018 13:59:02 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 31818 <at> debbugs.gnu.org
Subject: Re: [bug#31818] [PATCH] gnu: Add restic.
Date: Thu, 14 Jun 2018 16:58:05 +0300
[Message part 1 (text/plain, inline)]
Hello Leo,

Thank you for review.

Leo Famulari <leo <at> famulari.name> writes:

> On Wed, Jun 13, 2018 at 10:18:19PM +0300, Oleg Pykhalov wrote:
>> * gnu/packages/backup.scm (restic): New variable.

[…]

>> +    (source (origin
>> +              (method url-fetch)
>> +              (uri (string-append
>> +                    "https://github.com/restic/restic/releases/download/"
>> +                    "v" version "/restic-" version ".tar.gz"))
>
> This tarball includes bundled copies of restic's dependency graph in the
> vendor directory.
>
> Adding the package to Guix with the bundled libraries is not how we
> usually do things but, if they are all free software, it could be okay.

[…]

> Does anyone have opinions about the bundled ("vendored") code in this
> package?

I made some research for licenses in the bundled restic source.  It
seems there is no licenses except BSD, MIT (Expat or X11), {L,}GPL.
Could it be merged because of that or should we investigate more?

--8<---------------cut here---------------start------------->8---
licensecheck -r /tmp/guix-build-restic-0.9.1.drv-1/src &> /tmp/.local/restic-licensecheck.txt
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
#!/bin/sh

input()
{
    for line in /tmp/.local/restic-licensecheck.txt; do
        grep -v 'Apache (v2.0)' $line\
            | grep -v 'BSD (3 clause)'\
            | grep -v 'BSD (2 clause)'\
            | grep -v 'MIT/X11 (BSD like)'\
            | grep -v GPL\
            | grep -v GENERATED\
            | cut -d ':' -f 1\
            | grep '.go$'
    done
}

for file in $(input); do
    grep --files-without-match -v BSD $file;
done
--8<---------------cut here---------------end--------------->8---

Also, I add a completion installation phase.
--8<---------------cut here---------------start------------->8---
(add-after 'install-docs 'install-shell-completion
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (etc (string-append out "/etc"))
                    (share (string-append out "/share")))
               (for-each
                (lambda (shell)
                  (let* ((shell-name (symbol->string shell))
                         (dir (string-append "etc/completion/" shell-name)))
                    (mkdir-p dir)
                    (invoke (string-append bin "/restic") "generate"
                            (string-append "--" shell-name "-completion")
                            (string-append dir "/"
                                           (case shell
                                             ((bash) "restic")
                                             ((zsh) "_restic"))))))
                '(bash zsh))
               (with-directory-excursion "etc/completion"
                 (install-file "bash/restic"
                               (string-append etc "/bash_completion.d"))
                 (install-file "zsh/_restic"
                               (string-append share "/zsh/site-functions")))
               #t)))
--8<---------------cut here---------------end--------------->8---

Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31818; Package guix-patches. (Thu, 14 Jun 2018 19:07:01 GMT) Full text and rfc822 format available.

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

From: Leo Famulari <leo <at> famulari.name>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 31818 <at> debbugs.gnu.org
Subject: Re: [bug#31818] [PATCH] gnu: Add restic.
Date: Thu, 14 Jun 2018 15:06:36 -0400
[Message part 1 (text/plain, inline)]
On Thu, Jun 14, 2018 at 04:58:05PM +0300, Oleg Pykhalov wrote:
> I made some research for licenses in the bundled restic source.  It
> seems there is no licenses except BSD, MIT (Expat or X11), {L,}GPL.
> Could it be merged because of that or should we investigate more?

I think we are basically choosing between have a restic package using
the bundled code or not having a restic package. Unless you are ready to
package all those things, we don't currently have the option of a restic
package with unbundled dependencies.

So, LGTM, but please add a code comment that mentions the bundled /
vendored dependencies. And please use both words, "bundled" and
"vendored", so that it's easy to grep for.

> Also, I add a completion installation phase.

Nice!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31818; Package guix-patches. (Sat, 16 Jun 2018 18:56:01 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 31818-done <at> debbugs.gnu.org, 31818 <at> debbugs.gnu.org
Subject: Re: [bug#31818] [PATCH] gnu: Add restic.
Date: Sat, 16 Jun 2018 21:54:23 +0300
[Message part 1 (text/plain, inline)]
Hello Leo,

Leo Famulari <leo <at> famulari.name> writes:

> On Thu, Jun 14, 2018 at 04:58:05PM +0300, Oleg Pykhalov wrote:
>> I made some research for licenses in the bundled restic source.  It
>> seems there is no licenses except BSD, MIT (Expat or X11), {L,}GPL.
>> Could it be merged because of that or should we investigate more?
>
> I think we are basically choosing between have a restic package using
> the bundled code or not having a restic package. Unless you are ready to
> package all those things, we don't currently have the option of a restic
> package with unbundled dependencies.
>
> So, LGTM, but please add a code comment that mentions the bundled /
> vendored dependencies. And please use both words, "bundled" and
> "vendored", so that it's easy to grep for.

[…]

OK, pushed as f77886c1c5f3c2bf33b78391cea5c4e5b2c05948

Oleg.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Sat, 16 Jun 2018 18:56:02 GMT) Full text and rfc822 format available.

Notification sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
bug acknowledged by developer. (Sat, 16 Jun 2018 18:56:03 GMT) Full text and rfc822 format available.

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

This bug report was last modified 6 years and 336 days ago.

Previous Next


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