GNU bug report logs - #37927
Better handle license expressions in 'guix import crate'

Previous Next

Package: guix-patches;

Reported by: Brice Waegeneire <brice <at> waegenei.re>

Date: Fri, 25 Oct 2019 20:28:01 UTC

Severity: normal

Tags: patch

Merged with 37928

Done: Ludovic Courtès <ludo <at> gnu.org>

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 37927 in the body.
You can then email your comments to 37927 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#37927; Package guix-patches. (Fri, 25 Oct 2019 20:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brice Waegeneire <brice <at> waegenei.re>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 25 Oct 2019 20:28:02 GMT) Full text and rfc822 format available.

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

From: Brice Waegeneire <brice <at> waegenei.re>
To: guix-patches <at> gnu.org
Date: Fri, 25 Oct 2019 22:27:12 +0200
This patch should allow correctly importing most of the licenses from
crates.io. Before it, importing recursively ripgrep would result in ~140
missing licenses; now none seems missing.





Merged 37927 37928. Request was from Mathieu Othacehe <m.othacehe <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 28 Oct 2019 14:41:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#37927; Package guix-patches. (Mon, 04 Nov 2019 22:28:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 37927 <at> debbugs.gnu.org, 37928 <at> debbugs.gnu.org
Subject: Re: [bug#37928] [PATCH] import: crate: Fix licenses.
Date: Mon, 04 Nov 2019 23:27:24 +0100
Hi Brice,

Brice Waegeneire <brice <at> 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’.




Set bug title to 'Better handle license expressions in 'guix import crate''. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 Nov 2019 22:29:05 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#37927; Package guix-patches. (Sat, 16 Nov 2019 16:38:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 37927 <at> debbugs.gnu.org
Subject: Re: [bug#37927] [bug#37928] [PATCH] import: crate: Fix licenses.
Date: Sat, 16 Nov 2019 17:37:09 +0100
Hi Brice,

Did you have a chance to look into this?

(See <https://issues.guix.gnu.org/issue/37927> for context.)

Thanks in advance.  :-)
Ludo’.

Ludovic Courtès <ludo <at> gnu.org> skribis:

> Hi Brice,
>
> Brice Waegeneire <brice <at> 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’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 11 Dec 2019 13:02:03 GMT) Full text and rfc822 format available.

Notification sent to Brice Waegeneire <brice <at> waegenei.re>:
bug acknowledged by developer. (Wed, 11 Dec 2019 13:02:03 GMT) Full text and rfc822 format available.

Message #20 received at 37927-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 37927-done <at> debbugs.gnu.org, 37928-done <at> debbugs.gnu.org
Subject: Re: [bug#37928] [PATCH v2] import: crate: Better handle license
 expressions.
Date: Wed, 11 Dec 2019 12:24:04 +0100
Hi Brice,

Brice Waegeneire <brice <at> waegenei.re> skribis:

> * guix/import/crate.scm (%dual-license-rx): Removed function.
> (crate->guix-package): Handle most of the multi-licensing cases.
> * tests/crate.scm (licenses): Add tests for some licenses.

Thanks for the updated patch!

> +(define (string->license string)
> +    (map
> +     spdx-string->license
> +     (filter (lambda (license)
> +               (and (not (string-null? license))
> +                   (not (any (lambda (elem) (string=? elem license))
> +                             '("AND" "OR" "WITH")))))
> +            (string-split string (string->char-set " /")))))

I changed that to use ‘filter-map’ instead and pushed as
263a267b75e472cb84428571580dabd99d5dff0c.

Thanks!

Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 11 Dec 2019 13:02:03 GMT) Full text and rfc822 format available.

Notification sent to Brice Waegeneire <brice <at> waegenei.re>:
bug acknowledged by developer. (Wed, 11 Dec 2019 13:02: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. (Thu, 09 Jan 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 102 days ago.

Previous Next


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