[PATCH] guix: add license prefix hackage imports

  • Done
  • quality assurance status badge
Details
4 participants
  • Joe Hillenbrand
  • Ludovic Courtès
  • Xinglu Chen
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Joe Hillenbrand
Severity
normal
J
J
Joe Hillenbrand wrote on 4 Oct 2018 18:17
(address . guix-patches@gnu.org)
CANJQ5C6Q_izmdftZ2xWb2SbiDiCnf3-ZdTTH_UzS=hFvbtPx9Q@mail.gmail.com
---
guix/import/hackage.scm | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)

Toggle diff (48 lines)
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 766a0b53f..8f4a46534 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -35,6 +35,7 @@
#:use-module (guix store)
#:use-module (gcrypt hash)
#:use-module (guix base32)
+ #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix memoization)
#:use-module (guix upstream)
#:use-module (guix packages)
@@ -135,20 +136,21 @@ version."
;; https://www.haskell.org
;; /cabal/release/cabal-latest/doc/API/Cabal/Distribution-License.html.
(match-lambda
- ("GPL-2" 'gpl2)
- ("GPL-3" 'gpl3)
- ("GPL" "'gpl??")
- ("AGPL-3" 'agpl3)
- ("AGPL" "'agpl??")
- ("LGPL-2.1" 'lgpl2.1)
- ("LGPL-3" 'lgpl3)
- ("LGPL" "'lgpl??")
- ("BSD2" 'bsd-2)
- ("BSD3" 'bsd-3)
- ("MIT" 'expat)
- ("ISC" 'isc)
- ("MPL" 'mpl2.0)
- ("Apache-2.0" 'asl2.0)
+ ("GPL-2" 'license:gpl2)
+ ("GPL-3" 'license:gpl3)
+ ("GPL" 'license:gpl??)
+ ("AGPL-3" 'license:agpl3)
+ ("AGPL" 'license:agpl)
+ ("LGPL-2.0" 'license:lgpl2.0)
+ ("LGPL-2.1" 'license:lgpl2.1)
+ ("LGPL-3" 'license:lgpl3)
+ ("LGPL" 'license:lgpl??)
+ ("BSD2" 'license:bsd-2)
+ ("BSD3" 'license:bsd-3)
+ ("MIT" 'license:expat)
+ ("ISC" 'license:isc)
+ ("MPL" 'license:mpl2.0)
+ ("Apache-2.0" 'license:asl2.0)
((x) (string->license x))
((lst ...) `(list ,@(map string->license lst)))
(_ #f)))
--
2.19.0
L
L
Ludovic Courtès wrote on 12 Oct 2018 15:17
(name . Joe Hillenbrand)(address . joehillen@gmail.com)
87h8hri9sj.fsf@gnu.org
Hi Joe,

Joe Hillenbrand <joehillen@gmail.com> skribis:

Toggle quote (7 lines)
> ---
> guix/import/hackage.scm | 30 ++++++++++++++++--------------
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
> index 766a0b53f..8f4a46534 100644

[...]

Toggle quote (2 lines)
> + ("GPL-2" 'license:gpl2)

No strong opinion, but apparently none of the importers currently adds
the ‘license:’ prefix and I’d rather keep that consistent, one way or
another.

Ricardo, WDYT?

Thanks for the patch!

Ludo’.
J
J
Joe Hillenbrand wrote on 12 Oct 2018 19:55
(name . Ludovic Courtès)(address . ludo@gnu.org)
CANJQ5C5PfMfM4dduVEiqnT36x_9ZpCQKN7DZtWGr2UHYA3EWDA@mail.gmail.com
Sorry, I meant to add justification in the commit message, but apparently I
forgot.

The motivation was to be consistent with the `gnu/packages/haskell.scm` which
uses the `license:` prefix. I noticed this when I imported a bunch of packages
and all of them were missing the prefix, which then had to be manually added.

On Fri, Oct 12, 2018 at 6:17 AM Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (5 lines)
>
> No strong opinion, but apparently none of the importers currently adds
> the ‘license:’ prefix and I’d rather keep that consistent, one way or
> another.

That's not entirely true. crate calls `spdx-string->license` which adds the
prefix, but it doesn't appear to actually work because it looks for the license
in the wrong part of the json output from crates.io.

I'd be happy to add it to the other importers as it looks like almost all of
`gnu/packages/*.scm` has the `license:` prefix. If so, should I do them all
in a new patch?

Thanks,
Joe
R
R
Ricardo Wurmus wrote on 12 Oct 2018 22:31
(name . Joe Hillenbrand)(address . joehillen@gmail.com)
87a7nioqk6.fsf@elephly.net
Hi Joe,

Toggle quote (14 lines)
> The motivation was to be consistent with the `gnu/packages/haskell.scm` which
> uses the `license:` prefix. I noticed this when I imported a bunch of packages
> and all of them were missing the prefix, which then had to be manually added.
>
> On Fri, Oct 12, 2018 at 6:17 AM Ludovic Courtès <ludo@gnu.org> wrote:
>>
>> No strong opinion, but apparently none of the importers currently adds
>> the ‘license:’ prefix and I’d rather keep that consistent, one way or
>> another.
>
> That's not entirely true. crate calls `spdx-string->license` which adds the
> prefix, but it doesn't appear to actually work because it looks for the license
> in the wrong part of the json output from crates.io.

I have a slight preference to not adding the prefix. It is true that
most modules do use this prefix, but I think the importers should be
agnostic of that. Some modules don’t use this prefix (e.g. web.scm) or
no prefix at all (especially user modules that don’t exist yet).

I’d rather have the importers be more flexible and do the right thing
dependent on context, but I have no good idea how to accomplish this
considering that they are used outside of any context (unless they were
called as part of an updater).

--
Ricardo
L
L
Ludovic Courtès wrote on 15 Oct 2018 10:07
(name . Ricardo Wurmus)(address . rekado@elephly.net)
877eijljkf.fsf@gnu.org
Hello,

Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (24 lines)
>> The motivation was to be consistent with the `gnu/packages/haskell.scm` which
>> uses the `license:` prefix. I noticed this when I imported a bunch of packages
>> and all of them were missing the prefix, which then had to be manually added.
>>
>> On Fri, Oct 12, 2018 at 6:17 AM Ludovic Courtès <ludo@gnu.org> wrote:
>>>
>>> No strong opinion, but apparently none of the importers currently adds
>>> the ‘license:’ prefix and I’d rather keep that consistent, one way or
>>> another.
>>
>> That's not entirely true. crate calls `spdx-string->license` which adds the
>> prefix, but it doesn't appear to actually work because it looks for the license
>> in the wrong part of the json output from crates.io.
>
> I have a slight preference to not adding the prefix. It is true that
> most modules do use this prefix, but I think the importers should be
> agnostic of that. Some modules don’t use this prefix (e.g. web.scm) or
> no prefix at all (especially user modules that don’t exist yet).
>
> I’d rather have the importers be more flexible and do the right thing
> dependent on context, but I have no good idea how to accomplish this
> considering that they are used outside of any context (unless they were
> called as part of an updater).

Right, I sort of feel along the same lines.

OTOH, the goal of ‘guix import’ is to provide templates as close as
possible to working package definitions. In that sense, if adding the
‘license:’ prefix lowers the barrier a little bit (and it certainly
does, as Joe wrote), the better.

For the sake of consistency though, it may be best to do it for all the
importers, if we were to take that route.

WDYT, Ricardo?

Thanks,
Ludo’.
R
R
Ricardo Wurmus wrote on 15 Oct 2018 11:47
(name . Ludovic Courtès)(address . ludo@gnu.org)
87va63mthl.fsf@elephly.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (8 lines)
> OTOH, the goal of ‘guix import’ is to provide templates as close as
> possible to working package definitions. In that sense, if adding the
> ‘license:’ prefix lowers the barrier a little bit (and it certainly
> does, as Joe wrote), the better.
>
> For the sake of consistency though, it may be best to do it for all the
> importers, if we were to take that route.

Adding the same prefix to all importers sounds good to me.

--
Ricardo
J
J
Joe Hillenbrand wrote on 15 Oct 2018 15:42
(name . Ricardo Wurmus)(address . rekado@elephly.net)
CANJQ5C6776YL+q1dZWCFwMdrEyP1t6CvqmYE0tqqWtR+0iPZ2Q@mail.gmail.com
On Mon, Oct 15, 2018, 02:49 Ricardo Wurmus <rekado@elephly.net> wrote:

Toggle quote (9 lines)
>
> Ludovic Courtès <ludo@gnu.org> writes:
> >
> > For the sake of consistency though, it may be best to do it for all the
> > importers, if we were to take that route.
>
> Adding the same prefix to all importers sounds good to me.
>

Should I create a patch for each importer or do them all in one patch?

Toggle quote (1 lines)
>
Attachment: file
R
R
Ricardo Wurmus wrote on 15 Oct 2018 15:47
(name . Joe Hillenbrand)(address . joehillen@gmail.com)
87pnwbmid7.fsf@elephly.net
Joe Hillenbrand <joehillen@gmail.com> writes:

Toggle quote (13 lines)
> On Mon, Oct 15, 2018, 02:49 Ricardo Wurmus <rekado@elephly.net> wrote:
>
>>
>> Ludovic Courtès <ludo@gnu.org> writes:
>> >
>> > For the sake of consistency though, it may be best to do it for all the
>> > importers, if we were to take that route.
>>
>> Adding the same prefix to all importers sounds good to me.
>>
>
> Should I create a patch for each importer or do them all in one patch?

Either way is fine. If you create one patch for all importers please
make sure to list all the changes to the different files explicitly in
the commit summary.

Thank you!

--
Ricardo
X
X
Xinglu Chen wrote on 21 Dec 2021 18:18
87v8zhev19.fsf@yoctocell.xyz
This was done in commit cfec09a9928e171a724f630ba652ea0241d52e92.

Closing!
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmHCDGIVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5DAEP/1ouuATu5RMi6o3NyH+8/5mAHUEW
jVQUQ9Dalc6xSqMAe3M7V8MDVUn7cdiMWfM4gxrACnd1OcdMgvPG/CS/8fYzH97s
aOTXrsQJqklM77UwLfGa4mM8oG/abxe1JsVKBCqMx+TJ2C/1ZSma6KncQaJ37IFk
IUOeEyp2q6XYc/Zc4R+C0OjjSabN+Ud6F0DEpFhVJIkHWBTs17PCB/7kpm4Pgnn9
fLencnbpod5PVgr3O33Bju82VLRcKPX86rw5/no3BofvtjMHkAXCQBweAEp9n8R+
RCB4/3cjCP8IzFKMErBykvsNeZ/qOI9+EfElUTlP9X8JqK8uWr6Gy6yGx1TlRk8B
oS87T1+jzCkqHfQcVE8nKX7eJI8WymhDgE0VoDt+IrZemCNXZrd1CyU+I3Sen+JJ
u/e3uqFUF8uiPs3fdNK+H1FTJDEOwJOu50Yc0zs239HBbN4uyn+A/7aVkXDyoWUz
sMHsq4OLoX30RUbgaH0CE9km6epwYW9YbPu56oeSl/CuvOOP0xIER7XdtDBbx/fK
0ybhnQRljx5mSFQgT6uID17B+UAqDxOuSt9tokjoYszRgudW7FdSKJ2+FipbTj8h
2I6dJeEqVjqsgSRJHUbVAXw4o5odng0sFaXNFf04X3Hzs3kNn24Dq0sqbtuPu/35
k5Vy6LF/7OfwUUZv
=CC7x
-----END PGP SIGNATURE-----

Closed
?