From: "Ludovic Courtès" <ludo@gnu.org>
To: Brice Waegeneire <brice@waegenei.re>
Cc: 37927@debbugs.gnu.org, 37928@debbugs.gnu.org
Subject: [bug#37927] [bug#37928] [PATCH] import: crate: Fix licenses.
Date: Mon, 04 Nov 2019 23:27:24 +0100 [thread overview]
Message-ID: <87mudb46r7.fsf@gnu.org> (raw)
In-Reply-To: <20191025202713.7739-2-brice@waegenei.re> (Brice Waegeneire's message of "Fri, 25 Oct 2019 22:27:13 +0200")
Hi Brice,
Brice Waegeneire <brice@waegenei.re> skribis:
> * guix/import/crate.scm (%dual-license-rx): Removed function.
> (crate->guix-package): Handle most of the multi-licensing cases.
Nice!
> (define* (crate->guix-package crate-name #:optional version)
> "Fetch the metadata for CRATE-NAME from crates.io, and return the
> `package' s-expression corresponding to that package, or #f on failure.
> When VERSION is specified, attempt to fetch that version; otherwise fetch the
> latest version of CRATE-NAME."
> (define (string->license string)
> - (match (regexp-exec %dual-license-rx string)
> - (#f (list (spdx-string->license string)))
> - (m (list (spdx-string->license (match:substring m 1))
> - (spdx-string->license (match:substring m 2))))))
> + (filter
> + (lambda (word)
> + (and (not (string-null? word))
> + (not (any (lambda (elem) (string=? elem word))
> + '("AND" "OR" "WITH"))) ))
> + (string-split string (string->char-set " /"))))
It would be great to have tests for that in tests/crate.scm. To that
end, I think you could lift ‘string->license’ to the top level (that is,
outside ‘crate->guix-package’), and then have a few tests along these
lines:
(define string->license
(@@ (guix import crate) string->license))
(test-equal "GPL OR LGPL"
(list license:gpl3+ license:lgpl3+)
(string->license "GPL OR LGPL"))
(See
<https://guix.gnu.org/manual/en/html_node/Running-the-Test-Suite.html>.)
Let me know if anything is unclear.
Could you send an updated patch?
Thanks,
Ludo’.
next prev parent reply other threads:[~2019-11-04 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 20:27 [bug#37927] Brice Waegeneire
2019-10-25 20:27 ` [bug#37928] [PATCH] import: crate: Fix licenses Brice Waegeneire
2019-11-04 22:27 ` Ludovic Courtès [this message]
2019-11-16 16:37 ` [bug#37927] " Ludovic Courtès
2019-11-26 20:17 ` [bug#37928] Brice Waegeneire
2019-11-26 20:17 ` [bug#37928] [PATCH v2] import: crate: Better handle license expressions Brice Waegeneire
2019-12-11 11:24 ` bug#37927: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mudb46r7.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=37927@debbugs.gnu.org \
--cc=37928@debbugs.gnu.org \
--cc=brice@waegenei.re \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).