Subject: Re: [bug#31818] [PATCH] gnu: Add restic.

From: Oleg Pykhalov <[email-masked]>
Date: Thu, 14 Jun 2018 16:58:05 +0300

Hello Leo,

Thank you for review.

Leo Famulari <[email-masked]> 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.