unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
@ 2016-08-05 18:37 David Craven
  2016-08-05 18:37 ` [PATCH 03/12] gnu: python: Import guix licenses with #:prefix license: David Craven
                   ` (10 more replies)
  0 siblings, 11 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* guix/import/utils.scm (define-module): guix licenses import uses a prefix.
  (string->licenses): Add license: prefix to licenses.
  (license->symbol): Add license: prefix to licenses. Return a symbol with the
  prefix license:.
---
 guix/import/utils.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 44e004b..93cd0f0 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -22,7 +22,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (guix hash)
   #:use-module (guix base32)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
   #:use-module ((guix build download) #:prefix build:)
   #:export (factorize-uri
@@ -112,12 +112,12 @@ recursively apply the procedure to the sub-list."
 (define (string->license str)
   "Convert the string STR into a license object."
   (match str
-    ("GNU LGPL" lgpl2.0)
-    ("GPL" gpl3)
-    ((or "BSD" "BSD License") bsd-3)
-    ((or "MIT" "MIT license" "Expat license") expat)
-    ("Public domain" public-domain)
-    ((or "Apache License, Version 2.0" "Apache 2.0") asl2.0)
+    ("GNU LGPL" license:lgpl2.0)
+    ("GPL" license:gpl3)
+    ((or "BSD" "BSD License") license:bsd-3)
+    ((or "MIT" "MIT license" "Expat license") license:expat)
+    ("Public domain" license:public-domain)
+    ((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
     (_ #f)))
 
 (define (license->symbol license)
@@ -125,12 +125,12 @@ recursively apply the procedure to the sub-list."
 to in the (guix licenses) module, or #f if there is no such known license."
   ;; TODO: Traverse list public variables in (guix licenses) instead so we
   ;; don't have to maintain a list manualy.
-  (assoc-ref `((,lgpl2.0 . lgpl2.0)
-               (,gpl3 . gpl3)
-               (,bsd-3 . bsd-3)
-               (,expat . expat)
-               (,public-domain . public-domain)
-               (,asl2.0 . asl2.0))
+  (assoc-ref `((,license:lgpl2.0 . license:lgpl2.0)
+               (,license:gpl3 . license:gpl3)
+               (,license:bsd-3 . license:bsd-3)
+               (,license:expat . license:expat)
+               (,license:public-domain . license:public-domain)
+               (,license:asl2.0 . license:asl2.0))
              license))
 
 (define (snake-case str)
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 03/12] gnu: python: Import guix licenses with #:prefix license:.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 04/12] gnu: python: Add python-binaryornot David Craven
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (define-module): Add import.
---
 gnu/packages/python.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 470bad8..fc52b6c 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -46,6 +46,7 @@
                           gpl2 gpl2+ gpl3 gpl3+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ agpl3+
                           isc mpl2.0 psfl public-domain repoze unlicense x11-style
                           zpl2.1))
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module ((guix licenses) #:select (expat zlib) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 04/12] gnu: python: Add python-binaryornot.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
  2016-08-05 18:37 ` [PATCH 03/12] gnu: python: Import guix licenses with #:prefix license: David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-08 20:37   ` Leo Famulari
  2016-08-05 18:37 ` [PATCH 05/12] gnu: python: Add python-nltk David Craven
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-binaryornot): New package.
  (python2-binaryornot): New package.
---
 gnu/packages/python.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index fc52b6c..bea635c 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9809,3 +9809,32 @@ etc.")
     (package
       (inherit base)
       (name "ptpython2"))))
+
+(define-public python-binaryornot
+  (package
+    (name "python-binaryornot")
+    (version "0.4.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "binaryornot" version))
+              (sha256
+               (base32
+                "1j4f51dxic39mdwf6alj7gd769wy6mhk916v031wjali51xkh3xb"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-hypothesis" ,python-hypothesis)))
+    (inputs
+     `(("python-chardet" ,python-chardet)
+       ("python-setuptools" ,python-setuptools)))
+    (home-page "https://github.com/audreyr/binaryornot")
+    (synopsis "Package to check if a file is binary or text")
+    (description "Ultra-lightweight pure Python package to check if a file is
+binary or text.")
+    (license license:bsd-3)))
+
+(define-public python2-binaryornot
+  (let ((binaryornot (package-with-python2 python-binaryornot)))
+    (package (inherit binaryornot)
+      (propagated-inputs
+        `(("python2-enum34" ,python2-enum34)
+          ,@(package-propagated-inputs binaryornot))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 05/12] gnu: python: Add python-nltk.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
  2016-08-05 18:37 ` [PATCH 03/12] gnu: python: Import guix licenses with #:prefix license: David Craven
  2016-08-05 18:37 ` [PATCH 04/12] gnu: python: Add python-binaryornot David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 06/12] gnu: python: Add python-pymongo David Craven
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-nltk): New package.
  (python2-nltk): New package.
---
 gnu/packages/python.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index bea635c..c480bc4 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9838,3 +9838,24 @@ binary or text.")
       (propagated-inputs
         `(("python2-enum34" ,python2-enum34)
           ,@(package-propagated-inputs binaryornot))))))
+
+(define-public python-nltk
+  (package
+    (name "python-nltk")
+    (version "3.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "nltk" version))
+              (sha256
+               (base32
+                "0skxbhnymwlspjkzga0f7x1hg3y50fwpfghs8g8k7fh6f4nknlym"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (home-page "http://nltk.org/")
+    (synopsis "Natural Language Toolkit")
+    (description "Natural Language Toolkit")
+    (license license:asl2.0)))
+
+(define-public python2-nltk
+  (package-with-python2 python-nltk))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 06/12] gnu: python: Add python-pymongo.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (2 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 05/12] gnu: python: Add python-nltk David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-08 20:36   ` Leo Famulari
  2016-08-05 18:37 ` [PATCH 07/12] gnu: python: Add python-sh David Craven
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-pymongo): New package.
  (python2-pymongo): New package.
---
 gnu/packages/python.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c480bc4..3a1552d 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9859,3 +9859,25 @@ binary or text.")
 
 (define-public python2-nltk
   (package-with-python2 python-nltk))
+
+(define-public python-pymongo
+  (package
+    (name "python-pymongo")
+    (version "3.3.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pymongo" version))
+              (sha256
+               (base32
+                "07mra6w86wjqy4lx5fvimidjhhfzd562gfjn8grsnbv2q8pk0i9x"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-certifi" ,python-certifi)
+       ("python-setuptools" ,python-setuptools)))
+    (home-page "http://github.com/mongodb/mongo-python-driver")
+    (synopsis "Python driver for MongoDB")
+    (description "Python driver for MongoDB.")
+    (license license:asl2.0)))
+
+(define-public pymongo2-pymongo
+  (package-with-python2 python-pymongo))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 07/12] gnu: python: Add python-sh.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (3 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 06/12] gnu: python: Add python-pymongo David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 08/12] gnu: python: Add python-schematics David Craven
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-sh): New package.
  (python2-sh): New package.
---
 gnu/packages/python.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 3a1552d..3eab007 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9881,3 +9881,26 @@ binary or text.")
 
 (define-public pymongo2-pymongo
   (package-with-python2 python-pymongo))
+
+(define-public python-sh
+  (package
+  (name "python-sh")
+  (version "1.11")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "sh" version))
+            (sha256
+             (base32
+              "192r0mpv6dmkysjzhc43ddffiwb5g7c76bgr1mb1z2xz9awbj3sr"))))
+  (build-system python-build-system)
+  (inputs
+   `(("python-setuptools" ,python-setuptools)))
+  (arguments
+   `(#:tests? #f)) ; no tests
+  (home-page "https://github.com/amoffat/sh")
+  (synopsis "Python subprocess interface")
+  (description "Python subprocess interface.")
+  (license license:expat)))
+
+(define-public python2-sh
+  (package-with-python2 python-sh))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 08/12] gnu: python: Add python-schematics.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (4 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 07/12] gnu: python: Add python-sh David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 09/12] gnu: python: Add python-publicsuffix David Craven
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-schematics): New package.
  (python2-schematics): New package.
---
 gnu/packages/python.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 3eab007..2627dc8 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9904,3 +9904,32 @@ binary or text.")
 
 (define-public python2-sh
   (package-with-python2 python-sh))
+
+(define-public python-schematics
+  (package
+    (name "python-schematics")
+    (version "1.1.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "https://github.com/schematics/schematics/archive/v" version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "19v1i69bf3bzarfxmbv0v6ivpcn758x3shvbiy9l2hy0lvqwnp6l"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-six" ,python-six)))
+    (inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (arguments
+     `(#:tests? #f)) ; requires a bunch of not very nice packages with fixed
+                     ; version requirements (eg python-coveralls)
+    (home-page "https://github.com/schematics/schematics")
+    (synopsis "Python Data Structures for Humans")
+    (description "Python Data Structures for Humans.")
+    (license license:bsd-3)))
+
+(define-public python2-schematics
+  (package-with-python2 python-schematics))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 09/12] gnu: python: Add python-publicsuffix.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (5 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 08/12] gnu: python: Add python-schematics David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 10/12] gnu: python: Add python-publicsuffix2 David Craven
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-publicsuffix): New package.
  (python2-publicsuffix): New package.
---
 gnu/packages/python.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 2627dc8..4de5024 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9933,3 +9933,27 @@ binary or text.")
 
 (define-public python2-schematics
   (package-with-python2 python-schematics))
+
+(define-public python-publicsuffix
+  (package
+  (name "python-publicsuffix")
+  (version "1.1.0")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "publicsuffix" version))
+            (sha256
+             (base32
+              "1adx520249z2cy7ykwjr1k190mn2888wqn9jf8qm27ly4qymjxxf"))))
+  (build-system python-build-system)
+  (inputs
+   `(("python-setuptools" ,python-setuptools)))
+  (arguments
+   `(#:tests? #f)) ; tests use the internet
+  (home-page "https://www.tablix.org/~avian/git/publicsuffix.git")
+  (synopsis "Get suffix for a domain name")
+  (description "Get a public suffix for a domain name using the Public Suffix
+List.")
+  (license license:expat)))
+
+(define-public python2-publicsuffix
+  (package-with-python2 python-publicsuffix))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 10/12] gnu: python: Add python-publicsuffix2.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (6 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 09/12] gnu: python: Add python-publicsuffix David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 11/12] gnu: python: Add python-url David Craven
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-publicsuffix2): New package.
  (python2-publicsuffix2): New package.
---
 gnu/packages/python.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4de5024..b1ba8e5 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9957,3 +9957,26 @@ List.")
 
 (define-public python2-publicsuffix
   (package-with-python2 python-publicsuffix))
+
+(define-public python-publicsuffix2
+  (package
+  (name "python-publicsuffix2")
+  (version "2.20160621")
+  (source
+    (origin
+      (method url-fetch)
+      (uri (pypi-uri "publicsuffix2" version ".tar.bz2"))
+      (sha256
+       (base32
+        "06lx603gdwad5hc3hmn763ngq0rq9bzz1ni3ga72nzk5n872arkd"))))
+  (build-system python-build-system)
+  (inputs
+   `(("python-setuptools" ,python-setuptools)))
+  (home-page "https://github.com/pombredanne/python-publicsuffix2")
+  (synopsis "Get a public suffix for a domain name using the Public Suffix List")
+  (description "Get a public suffix for a domain name using the Public Suffix
+List.  Forked from and using the same API as the publicsuffix package.")
+  (license (list license:expat license:mpl2.0))))
+
+(define-public python2-publicsuffix2
+  (package-with-python2 python-publicsuffix2))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 11/12] gnu: python: Add python-url.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (7 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 10/12] gnu: python: Add python-publicsuffix2 David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:37 ` [PATCH 12/12] gnu: python: Add python-ipaddress David Craven
  2016-08-27  6:43 ` [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix Ricardo Wurmus
  10 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-url): New package.
  (python2-url): New package.
---
 gnu/packages/python.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index b1ba8e5..4f2eba2 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9980,3 +9980,30 @@ List.  Forked from and using the same API as the publicsuffix package.")
 
 (define-public python2-publicsuffix2
   (package-with-python2 python-publicsuffix2))
+
+(define-public python-url
+  (package
+  (name "python-url")
+  (version "0.2.0")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "url" version))
+            (sha256
+             (base32
+              "0v879yadcz9qxfl41ak6wkga1kimp9cflla9ddz03hjjvgkqy5ki"))))
+  (build-system python-build-system)
+  (propagated-inputs
+   `(("python-publicsuffix" ,python-publicsuffix)))
+  (inputs
+   `(("python-coverage" ,python-coverage)
+     ("python-nose" ,python-nose)
+     ("python-setuptools" ,python-setuptools)))
+  (arguments
+   `(#:tests? #f)) ; FIXME: tests fail with "ImportError: No module named 'tests'"
+  (home-page "http://github.com/seomoz/url-py")
+  (synopsis "URL Parsing")
+  (description "URL Parsing.")
+  (license license:expat)))
+
+(define-public python2-url
+  (package-with-python2 python-url))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 12/12] gnu: python: Add python-ipaddress.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (8 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 11/12] gnu: python: Add python-url David Craven
@ 2016-08-05 18:37 ` David Craven
  2016-08-05 18:50   ` Leo Famulari
  2016-08-27  6:43 ` [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix Ricardo Wurmus
  10 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-05 18:37 UTC (permalink / raw)
  To: guix-devel; +Cc: David Craven

* gnu/packages/python.scm (python-ipaddress): New package.
  (python2-ipaddress): New package.
---
 gnu/packages/python.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4f2eba2..c8d169a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10007,3 +10007,24 @@ List.  Forked from and using the same API as the publicsuffix package.")
 
 (define-public python2-url
   (package-with-python2 python-url))
+
+(define-public python-ipaddress
+  (package
+    (name "python-ipaddress")
+    (version "1.0.16")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "ipaddress" version))
+              (sha256
+               (base32
+                "1c3imabdrw8nfksgjjflzg7h4ynjckqacb188rf541m74arq4cas"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (home-page "https://github.com/phihag/ipaddress")
+    (synopsis "IPv4/IPv6 manipulation library")
+    (description "IPv4/IPv6 manipulation library.")
+    (license license:psfl)))
+
+(define-public python2-ipaddress
+  (package-with-python2 python-ipaddress))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* Re: [PATCH 12/12] gnu: python: Add python-ipaddress.
  2016-08-05 18:37 ` [PATCH 12/12] gnu: python: Add python-ipaddress David Craven
@ 2016-08-05 18:50   ` Leo Famulari
  2016-08-06 12:52     ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Leo Famulari @ 2016-08-05 18:50 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Fri, Aug 05, 2016 at 08:37:30PM +0200, David Craven wrote:
> * gnu/packages/python.scm (python-ipaddress): New package.
>   (python2-ipaddress): New package.

I believe we already have python2-ipaddress, although an older version.

Great news if you can update it and enable the tests!

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 12/12] gnu: python: Add python-ipaddress.
  2016-08-05 18:50   ` Leo Famulari
@ 2016-08-06 12:52     ` David Craven
  2016-08-06 15:57       ` Danny Milosavljevic
  2016-08-07  0:20       ` Leo Famulari
  0 siblings, 2 replies; 69+ messages in thread
From: David Craven @ 2016-08-06 12:52 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

> I believe we already have python2-ipaddress, although an older version.

Ups, I missed that. Thanks.

Can you answer some questions on best practices for packaging python packages?

1. Are python-setuptools inputs or native-inputs? It seems to be done
both ways but I guess it doesn't really matter since it's an interpreted
language.

2. Pypi uri scheme changed in April to including a blake hash of the
files, but they introduced backwards compatible redirects after it
broke many existing tools [0]. Should new packages use the new
or the old scheme? IMO the old one is cleaner since we can use
(pypi-uri "package-name" version) to construct it instead of having
long hashes. If this is a best practice we should also have the
pypi importer suggest it instead of the new url's.

[0] https://bitbucket.org/pypa/pypi/issues/438/backwards-compatible-un-hashed-package

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 12/12] gnu: python: Add python-ipaddress.
  2016-08-06 12:52     ` David Craven
@ 2016-08-06 15:57       ` Danny Milosavljevic
  2016-08-07  0:20       ` Leo Famulari
  1 sibling, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-06 15:57 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

> 1. Are python-setuptools inputs or native-inputs? It seems to be done
> both ways but I guess it doesn't really matter since it's an interpreted
> language.

Usually native-inputs. The idea is you only need the native-inputs to compile and install the thing and then you can throw the native-inputs away. On the other hand, you need the inputs at runtime of the installed program.

You usually don't need *setup*tools after it has setup whatever it was supposed to setup :)

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 12/12] gnu: python: Add python-ipaddress.
  2016-08-06 12:52     ` David Craven
  2016-08-06 15:57       ` Danny Milosavljevic
@ 2016-08-07  0:20       ` Leo Famulari
  1 sibling, 0 replies; 69+ messages in thread
From: Leo Famulari @ 2016-08-07  0:20 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Sat, Aug 06, 2016 at 02:52:37PM +0200, David Craven wrote:
> > I believe we already have python2-ipaddress, although an older version.
> 
> Ups, I missed that. Thanks.
> 
> Can you answer some questions on best practices for packaging python packages?
> 
> 1. Are python-setuptools inputs or native-inputs? It seems to be done
> both ways but I guess it doesn't really matter since it's an interpreted
> language.

Almost always native-inputs, but there are a handful of packages that
actually use setuptools at runtime.

> 2. Pypi uri scheme changed in April to including a blake hash of the
> files, but they introduced backwards compatible redirects after it
> broke many existing tools [0]. Should new packages use the new
> or the old scheme? IMO the old one is cleaner since we can use
> (pypi-uri "package-name" version) to construct it instead of having
> long hashes. If this is a best practice we should also have the
> pypi importer suggest it instead of the new url's.

We prefer to use pypi-uri. We used the long blake URLs while we were
adjusting pypi-uri to work with the new PyPi URL scheme.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 06/12] gnu: python: Add python-pymongo.
  2016-08-05 18:37 ` [PATCH 06/12] gnu: python: Add python-pymongo David Craven
@ 2016-08-08 20:36   ` Leo Famulari
  2016-08-08 20:39     ` Leo Famulari
  0 siblings, 1 reply; 69+ messages in thread
From: Leo Famulari @ 2016-08-08 20:36 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Fri, Aug 05, 2016 at 08:37:24PM +0200, David Craven wrote:
> * gnu/packages/python.scm (python-pymongo): New package.
>   (python2-pymongo): New package.

s/package/variable

> +    (inputs
> +     `(("python-certifi" ,python-certifi)
> +       ("python-setuptools" ,python-setuptools)))

I notice several of these patches include setuptools as an input to the
Python 3 variant of the package.

While some Python 3 packages require setuptools, most don't, whereas
most Python 2 packages do require setuptools.

We have a "python2-variant" system that we use when the Python 2 version
of some package requires a different set of inputs from the Python 3
version that it is based on. There is a good example in python-lockfile
/ python2-lockfile.

It adds a few lines of code but if we use it consistently, it will
drastically reduce the number of packages that depend on
python-setuptools.

Can you check this patch series to see if the Python 3 variants require
setuptools?

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 04/12] gnu: python: Add python-binaryornot.
  2016-08-05 18:37 ` [PATCH 04/12] gnu: python: Add python-binaryornot David Craven
@ 2016-08-08 20:37   ` Leo Famulari
  2016-08-22 12:05     ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Leo Famulari @ 2016-08-08 20:37 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Fri, Aug 05, 2016 at 08:37:22PM +0200, David Craven wrote:
> * gnu/packages/python.scm (python-binaryornot): New package.
>   (python2-binaryornot): New package.

> +(define-public python2-binaryornot
> +  (let ((binaryornot (package-with-python2 python-binaryornot)))
> +    (package (inherit binaryornot)
> +      (propagated-inputs
> +        `(("python2-enum34" ,python2-enum34)
> +          ,@(package-propagated-inputs binaryornot))))))

I believe this will need to use the python2-variant system, as in
python2-hypothesis.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 06/12] gnu: python: Add python-pymongo.
  2016-08-08 20:36   ` Leo Famulari
@ 2016-08-08 20:39     ` Leo Famulari
  0 siblings, 0 replies; 69+ messages in thread
From: Leo Famulari @ 2016-08-08 20:39 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, Aug 08, 2016 at 04:36:02PM -0400, Leo Famulari wrote:
> We have a "python2-variant" system that we use when the Python 2 version
> of some package requires a different set of inputs from the Python 3
> version that it is based on. There is a good example in python-lockfile
> / python2-lockfile.

For your reference, this is the bug report that led to the creation of
this tool:
http://bugs.gnu.org/22437

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 04/12] gnu: python: Add python-binaryornot.
  2016-08-08 20:37   ` Leo Famulari
@ 2016-08-22 12:05     ` David Craven
  2016-08-22 12:14       ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-22 12:05 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

(properties `((python2-variant . ,(delay python2-hypothesis))))))

(define-public python2-hypothesis
  (let ((hypothesis (package-with-python2
                     (strip-python2-variant python-hypothesis))))

> I believe this will need to use the python2-variant system, as in
> python2-hypothesis.

Can you please explain the properties field? It's not mentioned in the
guix manual. I can see that strip-python2-variant just removes the
property.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 04/12] gnu: python: Add python-binaryornot.
  2016-08-22 12:05     ` David Craven
@ 2016-08-22 12:14       ` David Craven
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-22 12:14 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

>> I believe this will need to use the python2-variant system, as in
>> python2-hypothesis.

> Can you please explain the properties field? It's not mentioned in the
> guix manual. I can see that strip-python2-variant just removes the
> property.

I see you provided a link to the bug report as a reply to a different
patch. Question answered thanks!

^ permalink raw reply	[flat|nested] 69+ messages in thread

* [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-08-22 12:14       ` David Craven
@ 2016-08-22 13:20         ` David Craven
  2016-08-22 13:20           ` [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license: David Craven
                             ` (9 more replies)
  0 siblings, 10 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* guix/import/utils.scm (define-module): guix licenses import uses a prefix.
  (string->licenses): Add license: prefix to licenses.
  (license->symbol): Add license: prefix to licenses. Return a symbol with the
  prefix license:.
---
 guix/import/utils.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 44e004b..93cd0f0 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -22,7 +22,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (guix hash)
   #:use-module (guix base32)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
   #:use-module ((guix build download) #:prefix build:)
   #:export (factorize-uri
@@ -112,12 +112,12 @@ recursively apply the procedure to the sub-list."
 (define (string->license str)
   "Convert the string STR into a license object."
   (match str
-    ("GNU LGPL" lgpl2.0)
-    ("GPL" gpl3)
-    ((or "BSD" "BSD License") bsd-3)
-    ((or "MIT" "MIT license" "Expat license") expat)
-    ("Public domain" public-domain)
-    ((or "Apache License, Version 2.0" "Apache 2.0") asl2.0)
+    ("GNU LGPL" license:lgpl2.0)
+    ("GPL" license:gpl3)
+    ((or "BSD" "BSD License") license:bsd-3)
+    ((or "MIT" "MIT license" "Expat license") license:expat)
+    ("Public domain" license:public-domain)
+    ((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
     (_ #f)))
 
 (define (license->symbol license)
@@ -125,12 +125,12 @@ recursively apply the procedure to the sub-list."
 to in the (guix licenses) module, or #f if there is no such known license."
   ;; TODO: Traverse list public variables in (guix licenses) instead so we
   ;; don't have to maintain a list manualy.
-  (assoc-ref `((,lgpl2.0 . lgpl2.0)
-               (,gpl3 . gpl3)
-               (,bsd-3 . bsd-3)
-               (,expat . expat)
-               (,public-domain . public-domain)
-               (,asl2.0 . asl2.0))
+  (assoc-ref `((,license:lgpl2.0 . license:lgpl2.0)
+               (,license:gpl3 . license:gpl3)
+               (,license:bsd-3 . license:bsd-3)
+               (,license:expat . license:expat)
+               (,license:public-domain . license:public-domain)
+               (,license:asl2.0 . license:asl2.0))
              license))
 
 (define (snake-case str)
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license:.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-26 20:55             ` David Craven
  2016-08-22 13:20           ` [PATCH 03/11] gnu: Add python-binaryornot David Craven
                             ` (8 subsequent siblings)
  9 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (define-module): Add import.
---
 gnu/packages/python.scm | 424 ++++++++++++++++++++++++------------------------
 1 file changed, 211 insertions(+), 213 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 15c957e..1742dc8 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
+;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,12 +43,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages python)
-  #:use-module ((guix licenses)
-                #:select (asl2.0 bsd-4 bsd-3 bsd-2 non-copyleft cc0 x11 x11-style
-                          gpl2 gpl2+ gpl3 gpl3+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ agpl3+
-                          isc mpl2.0 psfl public-domain repoze unlicense x11-style
-                          zpl2.1 lgpl3))
-  #:use-module ((guix licenses) #:select (expat zlib) #:prefix license:)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages adns)
@@ -298,7 +294,7 @@ introspection capabilities; intuitive object orientation; natural
 expression of procedural code; full modularity, supporting hierarchical
 packages; exception-based error handling; and very high level dynamic
 data types.")
-    (license psfl)))
+    (license license:psfl)))
 
 ;; Current 2.x version.
 (define-public python-2 python-2.7)
@@ -418,7 +414,7 @@ limiting process resources and management of running processes.  It implements
 many functionalities offered by command line tools such as: ps, top, lsof,
 netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime,
 pidof, tty, taskset, pmap.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-psutil
   (package-with-python2 python-psutil))
@@ -456,7 +452,7 @@ cross-platform implementations of over 30 password hashing algorithms, as well
 as a framework for managing existing password hashes.  It's designed to be
 useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
 to providing full-strength password hashing for multi-user application.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-passlib
   (package-with-python2 python-passlib))
@@ -493,7 +489,7 @@ John the Ripper).")
     ;; "sha2.c" is under BSD-3;
     ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
     ;; the rest is under ISC.
-    (license (list isc bsd-3 bsd-4))))
+    (license (list license:isc license:bsd-3 license:bsd-4))))
 
 (define-public python2-py-bcrypt
   (package-with-python2 python-py-bcrypt))
@@ -523,7 +519,7 @@ John the Ripper).")
 providing both client and server functionality.  While it leverages a Python C
 extension for low level cryptography (PyCrypto), Paramiko itself is a pure
 Python interface around SSH networking concepts.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-paramiko
   (package-with-python2 python-paramiko))
@@ -608,7 +604,7 @@ making them easy to handle and incorporate into other protocols.")
     (synopsis "Cassandra Cluster Manager")
     (description "A script/library to create, launch and remove an Apache
 Cassandra cluster on localhost.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-ccm
   (package-with-python2 python-ccm))
@@ -662,7 +658,7 @@ using Python 2.4 or higher and provides access to the Olson timezone database.")
 - a Python interface to the CLDR (Common Locale Data Repository), providing
 access to various locale display names, localized number and date formatting,
 etc. ")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-babel
   (package-with-python2 python-babel))
@@ -694,7 +690,7 @@ etc. ")
 earlier versions of Python.  The function checks the hostname in the
 certificate returned by the server to which a connection has been established,
 and verifies that it matches the intended target hostname.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python-h5py
   (package
@@ -740,7 +736,7 @@ HDF5 library from Python.  The low-level interface is intended to be a
 complete wrapping of the HDF5 API, while the high-level component supports
 access to HDF5 files, datasets and groups using established Python and NumPy
 concepts.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-h5py))))))
 
 (define-public python2-h5py
@@ -832,7 +828,7 @@ test hooks,
 project installation,
 platform-specific details,
 Python 3 support.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-setuptools
   (package-with-python2 python-setuptools))
@@ -870,7 +866,7 @@ Python 3 support.")
      "Pycrypto is a collection of both secure hash functions (such as SHA256
 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
 etc.).  The package is structured to make adding new modules easy.")
-    (license public-domain)))
+    (license license:public-domain)))
 
 (define-public python2-pycrypto
   (let ((pycrypto (package-with-python2 python-pycrypto)))
@@ -906,7 +902,7 @@ etc.).  The package is structured to make adding new modules easy.")
 service from python.  It can be used in any application that needs safe
 password storage.")
     ;; "MIT" and PSF dual license
-    (license x11)
+    (license license:x11)
     (properties `((python2-variant . ,(delay python2-keyring))))))
 
 (define-public python2-keyring
@@ -938,7 +934,7 @@ functions for smoothing over the differences between the Python versions with
 the goal of writing Python code that is compatible on both Python versions.
 Six supports every Python version since 2.5.  It is contained in only one
 Python file, so it can be easily copied into your project.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python2-six
   (package-with-python2 python-six))
@@ -962,7 +958,7 @@ Python file, so it can be easily copied into your project.")
     (description
      "The dateutil module provides powerful extensions to the standard
 datetime module, available in Python 2.3+.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-dateutil-2))))))
 
 (define-public python2-dateutil-2
@@ -992,7 +988,7 @@ datetime module, available in Python 2.3+.")
     (description
      "The dateutil module provides powerful extensions to the standard
 datetime module, available in Python 2.3+.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-dateutil
   (package-with-python2 python-dateutil))
@@ -1017,7 +1013,7 @@ datetime module, available in Python 2.3+.")
      "Parse human-readable date/time text")
     (description
      "Parse human-readable date/time text.")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-parsedatetime))))))
 
 (define-public python2-parsedatetime
@@ -1056,7 +1052,7 @@ structures designed to make working with structured (tabular,
 multidimensional, potentially heterogeneous) and time series data both easy
 and intuitive.  It aims to be the fundamental high-level building block for
 doing practical, real world data analysis in Python.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-pandas))))))
 
 (define-public python2-pandas
@@ -1087,7 +1083,7 @@ doing practical, real world data analysis in Python.")
 This module attempts to fix a glaring hole in pytz, that there is no way to
 get the local timezone information, unless you know the zoneinfo name, and
 under several distributions that's hard or impossible to figure out.")
-    (license cc0)))
+    (license license:cc0)))
 
 (define-public python2-pysqlite
   (package
@@ -1145,8 +1141,9 @@ Database API 2.0T.")
     (description
      "Mechanize implements stateful programmatic web browsing in Python,
 after Andy Lester’s Perl module WWW::Mechanize.")
-    (license (non-copyleft "file://COPYING"
-                           "See COPYING in the distribution."))))
+    (license (license:non-copyleft
+              "file://COPYING"
+              "See COPYING in the distribution."))))
 
 
 (define-public python-simplejson
@@ -1175,7 +1172,7 @@ library contained in Python 2.6, but maintains compatibility with Python 2.5
 and (currently) has significant performance advantages, even without using
 the optional C extension for speedups.  Simplejson is also supported on
 Python 3.3+.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python2-simplejson
   (package-with-python2 python-simplejson))
@@ -1200,7 +1197,7 @@ Python 3.3+.")
     (synopsis "Python extension wrapping the ICU C++ API")
     (description
      "PyICU is a python extension wrapping the ICU C++ API.")
-    (license x11)
+    (license license:x11)
     (properties `((python2-variant . ,(delay python2-pyicu))))))
 
 (define-public python2-pyicu
@@ -1233,7 +1230,7 @@ Python 3.3+.")
 It uses Accessibility (a11y) technologies to communicate with desktop
 applications. dogtail scripts are written in Python and executed like any
 other Python program.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public python2-empy
   (package
@@ -1268,7 +1265,7 @@ effect as a markup language.  Also supported are callbacks via hooks,
 recording and playback via diversions, and dynamic, chainable filters.  The
 system is highly configurable via command line options and embedded
 commands.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-element-tree
   (package
@@ -1290,9 +1287,9 @@ commands.")
     (description
      "ElementTree is a Python library supporting lightweight XML processing.")
     (home-page "http://effbot.org/zone/element-index.htm")
-    (license (x11-style "http://docs.python.org/2/license.html"
-                        "Like \"CWI LICENSE AGREEMENT FOR PYTHON \
-0.9.0 THROUGH 1.2\"."))))
+    (license (license:x11-style
+              "http://docs.python.org/2/license.html"
+              "Like \"CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2\"."))))
 
 (define-public python2-pybugz
   (package
@@ -1319,7 +1316,7 @@ commands.")
 bug tracking system.  It is meant as an aid to speed up interaction with the
 bug tracker.")
     (home-page "http://www.liquidx.net/pybugz/")
-    (license gpl2)))
+    (license license:gpl2)))
 
 (define-public python-enum34
   (package
@@ -1344,7 +1341,7 @@ bug tracker.")
     (description
      "Enum34 is the new Python stdlib enum module available in Python 3.4
 backported for previous versions of Python from 2.4 to 3.3.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-enum34
   (package-with-python2 python-enum34))
@@ -1371,7 +1368,7 @@ backported for previous versions of Python from 2.4 to 3.3.")
     (synopsis "Extended parse module")
     (description
      "Parse_type extends the python parse module.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python-parse
   (package
@@ -1396,7 +1393,7 @@ backported for previous versions of Python from 2.4 to 3.3.")
     (description
      "Parse strings using a specification based on the Python format()
 syntax.")
-    (license x11)))
+    (license license:x11)))
 
 
 (define-public scons
@@ -1423,7 +1420,7 @@ cross-platform substitute for the classic Make utility with integrated
 functionality similar to autoconf/automake and compiler caches such as ccache.
 In short, SCons is an easier, more reliable and faster way to build
 software.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python-extras
   (package
@@ -1502,7 +1499,7 @@ matching them against a list of media-ranges.")
     (synopsis "Python testing library")
     (description
      "Nose extends the unittest library to make testing easier.")
-    (license lgpl2.0+)))
+    (license license:lgpl2.0+)))
 
 (define-public python2-nose
   (package-with-python2 python-nose))
@@ -1528,7 +1525,7 @@ matching them against a list of media-ranges.")
     (description
      "Unittest2 is a replacement for the unittest module in the Python
 standard library.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-unittest2
   (package (inherit python-unittest2)
@@ -1780,7 +1777,7 @@ subprocess and see the output as well as any file modifications.")
      "Testtools extends the Python standard library unit testing framework to
 provide matchers, more debugging information, and cross-Python
 compatibility.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-testtools
   (package-with-python2 python-testtools))
@@ -1808,7 +1805,7 @@ compatibility.")
     (description
      "Testscenarios provides clean dependency injection for Python unittest
 style tests.")
-    (license (list bsd-3 asl2.0)))) ; at the user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
 
 (define-public python2-testscenarios
   (package-with-python2 python-testscenarios))
@@ -1835,7 +1832,7 @@ style tests.")
     (description
      "Testresources is an extension to Python's unittest to allow declarative
 use of resources by test cases.")
-    (license (list bsd-3 asl2.0)))) ; at the user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
 
 (define-public python2-testresources
   (package-with-python2 python-testresources))
@@ -1864,7 +1861,7 @@ use of resources by test cases.")
     (description
      "Python-subunit is a Python implementation of the subunit test streaming
 protocol.")
-    (license (list bsd-3 asl2.0)))) ; at the user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
 
 (define-public python2-subunit
   (package-with-python2 python-subunit))
@@ -1899,7 +1896,7 @@ protocol.")
     (description
      "Fixtures provides a way to create reusable state, useful when writing
 Python tests.")
-    (license (list bsd-3 asl2.0)))) ; at user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at user's option
 
 (define-public python2-fixtures-0.3.16
   (package-with-python2 python-fixtures-0.3.16))
@@ -1929,7 +1926,7 @@ Python tests.")
     (description
       "Python Build Reasonableness (PBR) is a library that injects some useful
 and sensible default behaviors into your setuptools run.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-pbr-0.11
   (package-with-python2 python-pbr-0.11))
@@ -1971,7 +1968,7 @@ and sensible default behaviors into your setuptools run.")
     (description
       "Python Build Reasonableness (PBR) is a library that injects some useful
 and sensible default behaviors into your setuptools run.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-pbr
   (package-with-python2 python-pbr))
@@ -2003,7 +2000,7 @@ and sensible default behaviors into your setuptools run.")
     (description
      "Fixtures provides a way to create reusable state, useful when writing
 Python tests.")
-    (license (list bsd-3 asl2.0)))) ; at user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at user's option
 
 (define-public python2-fixtures
   (package-with-python2 python-fixtures))
@@ -2034,7 +2031,7 @@ Python tests.")
     (description "Testrepository provides a database of test results which can
 be used as part of a developer's workflow to check things such as what tests
 have failed since the last commit or what tests are currently failing.")
-    (license (list bsd-3 asl2.0)))) ; at user's option
+    (license (list license:bsd-3 license:asl2.0)))) ; at user's option
 
 (define-public python2-testrepository
   (package-with-python2 python-testrepository))
@@ -2060,7 +2057,7 @@ have failed since the last commit or what tests are currently failing.")
 uses the code analysis tools and tracing hooks provided in the Python standard
 library to determine which lines are executable, and which have been
 executed.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-coverage
   (package-with-python2 python-coverage))
@@ -2087,7 +2084,7 @@ executed.")
     (description
      "Discover provides test discovery for unittest, a feature that has been
 backported from Python 2.7 for Python 2.4+.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-discover
   (package-with-python2 python-discover))
@@ -2118,7 +2115,7 @@ Behavior-driven development (or BDD) is an agile software development
 technique that encourages collaboration between developers, QA and
 non-technical or business participants in a software project.  Behave uses
 tests written in a natural language style, backed up by Python code.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python-exif-read
   (package
@@ -2139,7 +2136,7 @@ tests written in a natural language style, backed up by Python code.")
     (description
      "ExifRead is a Python library to extract EXIF data from tiff and jpeg
 files.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-exif-read
   (package-with-python2 python-exif-read))
@@ -2162,7 +2159,7 @@ files.")
     (synopsis "Python implementation of the JSON-LD specification")
     (description
      "PyLD is an implementation of the JSON-LD specification.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-pyld
   (package-with-python2 python-pyld))
@@ -2186,7 +2183,7 @@ files.")
     (description
      "Certifi is a Python library that contains a CA certificate bundle, which
 is used by the Requests library to verify HTTPS requests.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-certifi
   (package-with-python2 python-certifi))
@@ -2215,7 +2212,7 @@ is used by the Requests library to verify HTTPS requests.")
 composable way with as little code as necessary.  Its name stands for
 \"Command Line Interface Creation Kit\".  It's highly configurable but comes
 with sensible defaults out of the box.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-click
   (package-with-python2 python-click))
@@ -2279,7 +2276,7 @@ installed with a newer @code{pip} or with wheel's own command line utility.")
     (description
      "Requests is a Python HTTP client library.  It aims to be easier to use
 than Python’s urllib2 library.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 ;; Some software requires an older version of Requests, notably Docker
 ;; Compose.
@@ -2315,7 +2312,7 @@ than Python’s urllib2 library.")
 information in a variety of version control systems in order to discover
 version numbers.")
     (home-page "https://github.com/habnabit/vcversioner")
-    (license isc)))
+    (license license:isc)))
 
 (define-public python2-vcversioner
   (package-with-python2 python-vcversioner))
@@ -2373,7 +2370,7 @@ useful when integrating with legacy code that doesn't support Unicode, or for
 ease of entry of non-Roman names on a US keyboard, or when constructing ASCII
 machine identifiers from human-readable Unicode strings that should still be
 somewhat intelligeble.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public python2-unidecode
   (package-with-python2 python-unidecode))
@@ -2428,7 +2425,7 @@ somewhat intelligeble.")
     (description
      "Oauthlib is a generic, spec-compliant, thorough implementation of the
 OAuth request-signing logic.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-oauthlib))))))
 
 (define-public python2-oauthlib
@@ -2458,7 +2455,7 @@ OAuth request-signing logic.")
     (description
      "Itsdangerous provides various helpers to pass trusted data to untrusted
 environments and back.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-itsdangerous))))))
 
 (define-public python2-itsdangerous
@@ -2551,7 +2548,7 @@ object.")
     (description
      "Markupsafe provides an XML/HTML/XHTML markup safe string implementation
 for Python.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-markupsafe
   (package-with-python2 python-markupsafe))
@@ -2576,7 +2573,7 @@ for Python.")
     (description
      "Jinja2 is a small but fast and easy to use stand-alone template engine
 written in pure Python.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-jinja2
   (package-with-python2 python-jinja2))
@@ -2626,7 +2623,7 @@ logic-free templating system Mustache.")
 In particular, joblib offers: transparent disk-caching of the output values
 and lazy re-evaluation (memoize pattern), easy simple parallel computing
 logging and tracing of the execution.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-joblib
   (package-with-python2 python-joblib))
@@ -2657,7 +2654,7 @@ formats, such as HTML, XML, and LaTeX.  For input Docutils supports
 reStructuredText.")
     ;; Most of the source code is public domain, but some source files are
     ;; licensed under the PFSL, BSD 2-clause, and GPLv3+ licenses.
-    (license (list public-domain psfl bsd-2 gpl3+))))
+    (license (list license:public-domain license:psfl license:bsd-2 license:gpl3+))))
 
 (define-public python2-docutils
   (package-with-python2 python-docutils))
@@ -2680,7 +2677,7 @@ reStructuredText.")
     (synopsis "Syntax highlighting")
     (description
      "Pygments is a syntax highlighting package written in Python.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-pygments
   (package-with-python2 python-pygments))
@@ -2709,7 +2706,7 @@ reStructuredText.")
     (description "Sphinx is a tool that makes it easy to create documentation
 for Python projects or other documents consisting of multiple reStructuredText
 sources.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-sphinx
   (package-with-python2 python-sphinx))
@@ -2769,7 +2766,7 @@ sources.")
     (description
      "Feedgenerator-py3k is a standalone version of Django's feedgenerator,
 which can produce feeds in RSS 2.0, RSS 0.91, and Atom formats.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-feedgenerator
   (package-with-python2 python-feedgenerator))
@@ -2844,7 +2841,7 @@ interested parties to subscribe to events, or \"signals\".")
      "Pelican is a tool to generate a static blog from reStructuredText,
 Markdown input files, and more.  Pelican uses Jinja2 for templating
 and is very extensible.")
-    (license agpl3+)))
+    (license license:agpl3+)))
 
 (define-public python-scikit-learn
   (package
@@ -2888,7 +2885,7 @@ and is very extensible.")
     (description
      "Scikit-learn provides simple and efficient tools for data
 mining and data analysis.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-scikit-learn
   (let ((scikit (package-with-python2 python-scikit-learn)))
@@ -2928,7 +2925,7 @@ mining and data analysis.")
     (synopsis "Image processing in Python")
     (description
      "Scikit-image is a collection of algorithms for image processing.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-scikit-image
   (let ((scikit-image (package-with-python2 python-scikit-image)))
@@ -2995,7 +2992,7 @@ mining and data analysis.")
      "RQ (Redis Queue) is a simple Python library for queueing jobs and
 processing them in the background with workers.  It is backed by Redis and it
 is designed to have a low barrier to entry.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-rq
   (package-with-python2 python-rq))
@@ -3029,7 +3026,7 @@ is designed to have a low barrier to entry.")
     (description "Cython is an optimising static compiler for both the Python
 programming language and the extended Cython programming language.  It makes
 writing C extensions for Python as easy as Python itself.")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-cython))))))
 
 (define-public python2-cython
@@ -3105,7 +3102,7 @@ with Python.  It contains among other things: a powerful N-dimensional array
 object, sophisticated (broadcasting) functions, tools for integrating C/C++
 and Fortran code, useful linear algebra, Fourier transform, and random number
 capabilities.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define python2-numpy-bootstrap
   (package-with-python2 python-numpy-bootstrap))
@@ -3142,7 +3139,7 @@ capabilities.")
      "FaST-LMM, which stands for Factored Spectrally Transformed Linear Mixed
 Models, is a program for performing both single-SNP and SNP-set genome-wide
 association studies (GWAS) on extremely large data sets.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python-numpy
   (package (inherit python-numpy-bootstrap)
@@ -3285,7 +3282,7 @@ that client code uses to construct the grammar directly in Python code.")
      "Numpy's Sphinx extensions")
     (description
      "Sphinx extension to support docstrings in Numpy format.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-numpydoc
   (package-with-python2 python-numpydoc))
@@ -3450,7 +3447,7 @@ quality figures in a variety of hardcopy formats and interactive environments
 across platforms.  Matplotlib can be used in Python scripts, the python and
 ipython shell, web application servers, and six graphical user interface
 toolkits.")
-    (license psfl)
+    (license license:psfl)
     (properties `((python2-variant . ,(delay python2-matplotlib))))))
 
 (define-public python2-matplotlib
@@ -3499,7 +3496,7 @@ toolkits.")
 can, for example, efficiently read whole PLINK *.bed/bim/fam files or parts of
 those files.  It can also efficiently manipulate ranges of integers using set
 operators such as union, intersection, and difference.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python-rpy2
   (package
@@ -3528,7 +3525,7 @@ operators such as union, intersection, and difference.")
 low-level interface to R from Python, a proposed high-level interface,
 including wrappers to graphical libraries, as well as R-like structures and
 functions.")
-    (license gpl3+)))
+    (license license:gpl3+)))
 
 (define-public python2-rpy2
   (let ((rpy2 (package-with-python2 python-rpy2)))
@@ -3631,7 +3628,7 @@ atlas_libs = openblas
     (description "The SciPy library is one of the core packages that make up
 the SciPy stack.  It provides many user-friendly and efficient numerical
 routines such as routines for numerical integration and optimization.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-scipy
   (package-with-python2 python-scipy))
@@ -3666,7 +3663,7 @@ gives application developers the full power and flexibility of SQL.  It
 provides a full suite of well known enterprise-level persistence patterns,
 designed for efficient and high-performing database access, adapted into a
 simple and Pythonic domain language.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python2-sqlalchemy
   (package-with-python2 python-sqlalchemy))
@@ -3729,7 +3726,7 @@ SQLAlchemy Database Toolkit for Python.")
      "The python-distutils-extra module enables you to easily integrate
 gettext support, themed icons, and scrollkeeper-based documentation into
 Python's distutils.")
-    (license gpl2)))
+    (license license:gpl2)))
 
 (define-public python2-distutils-extra
   (package-with-python2 python-distutils-extra))
@@ -3766,7 +3763,7 @@ Python's distutils.")
     (description
      "The elib.intl module provides enhanced internationalization (I18N)
 services for your Python modules and applications.")
-    (license lgpl3+)))
+    (license license:lgpl3+)))
 
 (define-public python-pillow
   (package
@@ -3825,7 +3822,7 @@ efficient internal representation, and fairly powerful image processing
 capabilities.  The core image library is designed for fast access to data
 stored in a few basic pixel formats.  It should provide a solid foundation for
 a general image processing tool.")
-    (license (x11-style
+    (license (license:x11-style
               "http://www.pythonware.com/products/pil/license.htm"
               "The PIL Software License"))))
 
@@ -3874,7 +3871,7 @@ a general image processing tool.")
      "Pycparser is a complete parser of the C language, written in pure Python
 using the PLY parsing library.  It parses C code into an AST and can serve as
 a front-end for C compilers or analysis tools.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-pycparser
   (package-with-python2 python-pycparser))
@@ -4017,7 +4014,7 @@ support for Python 3 and PyPy.  It is based on cffi.")
 Python bindings and object-oriented API for cairo.  Cairo is a 2D vector
 graphics library with support for multiple backends including image buffers,
 PNG, PostScript, PDF, and SVG file output.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-cairocffi
   (package-with-python2 python-cairocffi))
@@ -4074,7 +4071,7 @@ etc.  The core of this module is a decorator factory.")
       "A Python package for Distributed Resource Management (DRM) job
 submission and control.  This package is an implementation of the DRMAA 1.0
 Python language binding specification.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-drmaa
   (package-with-python2 python-drmaa))
@@ -4105,7 +4102,7 @@ Python language binding specification.")
       "Gridmap is a Python package to allow you to easily create jobs on the
 cluster directly from Python.  You can directly map Python functions onto the
 cluster without needing to write any wrapper code yourself.")
-    (license gpl3+)))
+    (license license:gpl3+)))
 
 (define-public python2-gridmap
   (package-with-python2 python-gridmap))
@@ -4135,7 +4132,7 @@ cluster without needing to write any wrapper code yourself.")
 controlling them; and responding to expected patterns in their output.
 Pexpect works like Don Libes’ Expect.  Pexpect allows your script to spawn a
 child application and control it as if a human were typing commands.")
-    (license isc)))
+    (license license:isc)))
 
 (define-public python2-pexpect
   (package-with-python2 python-pexpect))
@@ -4247,7 +4244,7 @@ functions, akin to Python’s built-in generic functions like @code{len()},
 these generic functions use simple lookup tables, akin to those used by
 e.g. @code{pickle.dump()} and other generic functions found in the Python
 standard library.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-simplegeneric
   (package-with-python2 python-simplegeneric))
@@ -4270,7 +4267,7 @@ standard library.")
     (synopsis "Vestigial utilities from IPython")
     (description
      "This package provides retired utilities from IPython.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-ipython-genutils
   (package-with-python2 python-ipython-genutils))
@@ -4306,7 +4303,7 @@ callbacks.  The package also includes a mechanism to use traitlets for
 configuration, loading values from files or from command line arguments.  This
 is a distinct layer on top of traitlets, so you can use traitlets in your code
 without using the configuration machinery.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-traitlets
   (package-with-python2 python-traitlets))
@@ -4404,7 +4401,7 @@ without using the configuration machinery.")
 Powerful interactive shells, a browser-based notebook, support for interactive
 data visualization, embeddable interpreters and tools for parallel
 computing.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-ipython
   (let ((ipython (package-with-python2 python-ipython)))
@@ -4449,7 +4446,7 @@ computing.")
     (description
       "Python-isodate is a python module for parsing and formatting
 ISO 8601 dates, time and duration.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-isodate
   (package-with-python2 python-isodate))
@@ -4513,7 +4510,7 @@ and written in Python.")
     (description
      "Urwid is a curses-based UI/widget library for Python.  It includes many
 features useful for text console applications.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-urwid
   (package-with-python2 python-urwid))
@@ -4537,7 +4534,7 @@ features useful for text console applications.")
     (synopsis "Tree widgets for urwid")
     (description "Urwidtrees is a Widget Container API for the @code{urwid}
 toolkit.  Use it to build trees of widgets.")
-    (license gpl3+)))
+    (license license:gpl3+)))
 
 (define-public python2-urwidtrees
   (package-with-python2 python-urwidtrees))
@@ -4645,7 +4642,7 @@ translate the complete SQLite API into Python.")
     (description
       "The lxml XML toolkit is a Pythonic binding for the C libraries
 libxml2 and libxslt.")
-    (license bsd-3))) ; and a few more, see LICENSES.txt
+    (license license:bsd-3))) ; and a few more, see LICENSES.txt
 
 (define-public python2-lxml
   (package-with-python2 python-lxml))
@@ -4711,7 +4708,7 @@ converts incoming documents to Unicode and outgoing documents to UTF-8.")
       "Cssutils is a Python package for parsing and building CSS
 Cascading Style Sheets.  Currently it provides a DOM only and no rendering
 options.")
-    (license lgpl3+)))
+    (license license:lgpl3+)))
 
 (define-public python-cssselect
   (package
@@ -4739,7 +4736,7 @@ options.")
       "Cssselect ia a Python module that parses CSS3 Selectors and translates
 them to XPath 1.0 expressions.  Such expressions can be used in lxml or
 another XPath engine to find the matching elements in an XML or HTML document.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-cssselect
   (package-with-python2 python-cssselect))
@@ -4795,7 +4792,7 @@ interfaces in an easy and portable manner.")
     (description
       "NetworkX is a Python package for the creation, manipulation, and study
 of the structure, dynamics, and functions of complex networks.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-networkx
   (package-with-python2 python-networkx))
@@ -4844,7 +4841,7 @@ Python style, together with a fast and comfortable execution environment.")
 graphics in Python.  It is built on top of matplotlib and tightly integrated
 with the PyData stack, including support for numpy and pandas data structures
 and statistical routines from scipy and statsmodels.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-seaborn))))))
 
 (define-public python2-seaborn
@@ -4877,7 +4874,7 @@ and statistical routines from scipy and statsmodels.")
      "SymPy is a Python library for symbolic mathematics.  It aims to become a
 full-featured computer algebra system (CAS) while keeping the code as simple
 as possible in order to be comprehensible and easily extensible.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-sympy
   (package-with-python2 python-sympy))
@@ -4942,7 +4939,7 @@ as possible in order to be comprehensible and easily extensible.")
      "The Python X Library is intended to be a fully functional X client
 library for Python programs.  It is useful to implement low-level X clients.
 It is written entirely in Python.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public python-singledispatch
   (package
@@ -4994,7 +4991,7 @@ originally developed at FriendFeed.  By using non-blocking network I/O,
 Tornado can scale to tens of thousands of open connections, making it ideal
 for long polling, WebSockets, and other applications that require a long-lived
 connection to each user.")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-tornado))))))
 
 (define-public python2-tornado
@@ -5029,7 +5026,7 @@ connection to each user.")
     (description
      "Python-backports-abc provides a backport of additions to the
 'collections.abc' module in Python-3.5.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-backports-abc
   (package-with-python2 python-backports-abc))
@@ -5065,7 +5062,7 @@ connection to each user.")
     (description
      "Waf is a Python-based framework for configuring, compiling and installing
 applications.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-waf
   (package-with-python2 python-waf))
@@ -5097,7 +5094,7 @@ applications.")
     (synopsis "Python bindings for 0MQ")
     (description
      "PyZMQ is the official Python binding for the ZeroMQ messaging library.")
-    (license bsd-4)))
+    (license license:bsd-4)))
 
 (define-public python2-pyzmq
   (package-with-python2 python-pyzmq))
@@ -5304,7 +5301,7 @@ complexity of Python source code.")
     (synopsis "Markdown parser in pure Python")
     (description "This package provides a fast markdown parser in pure
 Python.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-mistune
   (package-with-python2 python-mistune))
@@ -5337,7 +5334,7 @@ Python.")
 Markdown.  The library features international input, various Markdown
 extensions, and several HTML output formats.  A command line wrapper
 markdown_py is also provided to convert Markdown files to HTML.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-markdown
   (package-with-python2 python-markdown))
@@ -5370,7 +5367,7 @@ markdown_py is also provided to convert Markdown files to HTML.")
     (description
      "This package provides a Python library used to launch a subprocess in a
 pseudo terminal (pty), and interact with both the process and its pty.")
-    (license isc)))
+    (license license:isc)))
 
 (define-public python2-ptyprocess
   (package-with-python2 python-ptyprocess))
@@ -5402,7 +5399,7 @@ pseudo terminal (pty), and interact with both the process and its pty.")
     (synopsis "Terminals served to term.js using Tornado websockets")
     (description "This package provides a Tornado websocket backend for the
 term.js Javascript terminal emulator library.")
-    (license bsd-2)
+    (license license:bsd-2)
     (properties `((python2-variant . ,(delay python2-terminado))))))
 
 (define-public python2-terminado
@@ -5441,8 +5438,9 @@ supports reading and writinfg of TrueType/OpenType fonts, reading and writing
 of AFM files, reading (and partially writing) of PS Type 1 fonts.  The package
 also contains a tool called “TTX” which converts TrueType/OpenType fonts to and
 from an XML-based format.")
-    (license (non-copyleft "file://LICENSE.txt"
-                           "See LICENSE.txt in the distribution."))))
+    (license (license:non-copyleft
+              "file://LICENSE.txt"
+              "See LICENSE.txt in the distribution."))))
 
 (define-public python2-fonttools
   (package-with-python2 python-fonttools))
@@ -5468,7 +5466,7 @@ from an XML-based format.")
 or create documents in LilyPond format.  A command line program ly is also
 provided that can be used to do various manipulations with LilyPond files.")
     (home-page "https://pypi.python.org/pypi/python-ly")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public python-appdirs
   (package
@@ -5521,7 +5519,7 @@ should be stored on various operating systems.")
     (description
      "Python-LLFUSE is a set of Python bindings for the low level FUSE API.")
     (home-page "https://bitbucket.org/nikratio/python-llfuse/")
-    (license lgpl2.0+)
+    (license license:lgpl2.0+)
     (properties `((python2-variant . ,(delay python2-llfuse))))))
 
 (define-public python2-llfuse
@@ -5543,7 +5541,7 @@ should be stored on various operating systems.")
                 "1imlqw9b73086y97izr036f58pgc5akv4ihc2rrf8j5h75jbrlaa"))))
     ;; Python-LLFUSE < 0.42 includes underscore.js, which is MIT (expat)
     ;; licensed.  The rest of the package is licensed under LGPL2.0 or later.
-    (license (list license:expat lgpl2.0+))))
+    (license (list license:expat license:lgpl2.0+))))
 
 (define-public python-msgpack
   (package
@@ -5561,7 +5559,7 @@ should be stored on various operating systems.")
 suitable for similar data to JSON.  This package provides CPython bindings for
 reading and writing MessagePack data.")
     (home-page "https://pypi.python.org/pypi/msgpack-python/")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-msgpack))))))
 
 (define-public python2-msgpack
@@ -5596,7 +5594,7 @@ reading and writing MessagePack data.")
     (description
       "A Python library for representing and manipulating IPv4, IPv6, CIDR, EUI
 and MAC network addresses.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-netaddr
   (package-with-python2 python-netaddr))
@@ -5628,7 +5626,7 @@ and MAC network addresses.")
       "The aim of the wrapt module is to provide a transparent object proxy for
   Python, which can be used as the basis for the construction of function
   wrappers and decorator functions.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-wrapt
   (package-with-python2 python-wrapt))
@@ -5679,7 +5677,7 @@ and MAC network addresses.")
     (description
       "This module provides a monotonic() function which returns the value (in
 fractional seconds) of a clock which never goes backwards.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-monotonic
   (package-with-python2 python-monotonic))
@@ -5735,7 +5733,7 @@ object to help create WSGI responses.")
 spreadsheets using Microsoft Excel® proprietary file formats @samp{.xls} and
 @samp{.xlsx} (versions 2.0 onwards).  It has support for Excel dates and is
 Unicode-aware.  It is not intended as an end-user tool.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-xlrd
   (package-with-python2 python-xlrd))
@@ -5763,7 +5761,7 @@ Unicode-aware.  It is not intended as an end-user tool.")
 tables.  PrettyTable allows for selection of which columns are to be printed,
 independent alignment of columns (left or right justified or centred) and
 printing of sub-tables by specifying a row range.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-prettytable
   (package-with-python2 python-prettytable))
@@ -5820,7 +5818,7 @@ printing of sub-tables by specifying a row range.")
     (synopsis "Hierarchical datasets for Python")
     (description "PyTables is a package for managing hierarchical datasets and
 designed to efficently cope with extremely large amounts of data.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-tables
   (package-with-python2 python-tables))
@@ -5843,7 +5841,7 @@ designed to efficently cope with extremely large amounts of data.")
     (description
      "This is an implementation of ASN.1 types and codecs in Python.  It is
 suitable for a wide range of protocols based on the ASN.1 specification.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-pyasn1
   (package-with-python2 python-pyasn1))
@@ -5869,7 +5867,7 @@ suitable for a wide range of protocols based on the ASN.1 specification.")
     (description
      "Pyasn1-modules is a collection of Python modules providing ASN.1 types and
 implementations of ASN.1-based codecs and protocols.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-pyasn1-modules
   (package-with-python2 python-pyasn1-modules))
@@ -5897,7 +5895,7 @@ implementations of ASN.1-based codecs and protocols.")
 in Python.  This library is used to create, poke at, and manipulate IPv4 and
 IPv6 addresses and networks.  This is a port of the Python 3.3 ipaddress
 module to older versions of Python.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-ipaddr
   (package
@@ -5926,7 +5924,7 @@ IPv6 addresses and networks.
 For new implementations you may prefer to use the standard module
 @code{ipaddress}, which was introduced in Python 3.3 and backported to older
 versions of Python.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python-idna
   (package
@@ -5953,7 +5951,7 @@ from the earlier standard from 2003.  The library is also intended to act as a
 suitable drop-in replacement for the “encodings.idna” module that comes with
 the Python standard library but currently only supports the older 2003
 specification.")
-    (license bsd-4)))
+    (license license:bsd-4)))
 
 (define-public python2-idna
   (package-with-python2 python-idna))
@@ -5980,7 +5978,7 @@ specification.")
 technique for writing tests.  You may hear the term mixed up with mocks,
 fakes, or doubles.  Basically, a stub is an object that returns pre-canned
 responses, rather than doing any computation.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-pretend
   (package-with-python2 python-pretend))
@@ -6004,7 +6002,7 @@ responses, rather than doing any computation.")
     (description
       "This package contains test vectors for the cryptography package.")
     ;; Distributed under either BSD-3 or ASL2.0
-    (license (list bsd-3 asl2.0))))
+    (license (list license:bsd-3 license:asl2.0))))
 
 (define-public python2-cryptography-vectors
   (package-with-python2 python-cryptography-vectors))
@@ -6046,7 +6044,7 @@ library” for Python.  The package includes both high level recipes, and low
 level interfaces to common cryptographic algorithms such as symmetric ciphers,
 message digests and key derivation functions.")
     ;; Distributed under either BSD-3 or ASL2.0
-    (license (list bsd-3 asl2.0))
+    (license (list license:bsd-3 license:asl2.0))
     (properties `((python2-variant . ,(delay python2-cryptography))))))
 
 (define-public python2-cryptography
@@ -6085,7 +6083,7 @@ message digests and key derivation functions.")
     (description
       "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
 library.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-pyopenssl
   (package-with-python2 python-pyopenssl))
@@ -6157,7 +6155,7 @@ similar hash values, which allows for the detection of similar objects by
 comparing their hash values.  The byte stream should have a sufficient amount
 of complexity; for example, a byte stream of identical bytes will not generate
 a hash value.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-tlsh
   (package
@@ -6204,7 +6202,7 @@ a hash value.")
      "This package provides Python bindings to libarchive, a C library to
 access possibly compressed archives in many different formats.  It uses
 Python's @code{ctypes} foreign function interface (FFI).")
-    (license lgpl2.0+)))
+    (license license:lgpl2.0+)))
 
 (define-public python2-libarchive-c
   (package-with-python2 python-libarchive-c))
@@ -6275,7 +6273,7 @@ Debian-related files, such as:
 @end enumerate\n")
 
     ;; Modules are either GPLv2+ or GPLv3+.
-    (license gpl3+)))
+    (license license:gpl3+)))
 
 (define-public python2-debian
   (package-with-python2 python-debian))
@@ -6302,7 +6300,7 @@ Debian-related files, such as:
     (description
      "This package provides @code{chardet}, a Python module that can
 automatically detect a wide range of file encodings.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-chardet
   (package-with-python2 python-chardet))
@@ -6363,7 +6361,7 @@ programatically with command-line parsers like @code{getopt} and
 use by applications which are unaware of any subscribers to their events.  It
 is a simple event-dispatching system on which more sophisticated event
 dispatching systems can be built.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-event
   (package-with-python2 python-zope-event))
@@ -6389,7 +6387,7 @@ methodology")
     (description "Zope.interface provides an implementation of \"object
 interfaces\" for Python.  Interfaces are a mechanism for labeling objects as
 conforming to a given API or contract.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-interface
   (package-with-python2 python-zope-interface))
@@ -6416,7 +6414,7 @@ conforming to a given API or contract.")
     (synopsis "Zope exceptions")
     (description "Zope.exceptions provides general-purpose exception types
 that have uses outside of the Zope framework.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-exceptions
   (package-with-python2 python-zope-exceptions))
@@ -6442,7 +6440,7 @@ that have uses outside of the Zope framework.")
     (synopsis "Zope testing helpers")
     (description "Zope.testing provides a number of testing utilities for HTML
 forms, HTTP servers, regular expressions, and more.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-testing
   (package-with-python2 python-zope-testing))
@@ -6472,7 +6470,7 @@ forms, HTTP servers, regular expressions, and more.")
     (synopsis "Zope testrunner script")
     (description "Zope.testrunner provides a script for running Python
 tests.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-testrunner
   (let ((base (package-with-python2 python-zope-testrunner)))
@@ -6504,7 +6502,7 @@ tests.")
     (synopsis "Message identifiers for internationalization")
     (description "Zope.i18nmessageid provides facilities for declaring
 internationalized messages within program source text.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-i18nmessageid
   (package-with-python2 python-zope-i18nmessageid))
@@ -6531,7 +6529,7 @@ internationalized messages within program source text.")
     (synopsis "Zope data schemas")
     (description "Zope.scheme provides extensions to zope.interface for
 defining data schemas.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-schema
   (package-with-python2 python-zope-schema))
@@ -6556,7 +6554,7 @@ defining data schemas.")
     (synopsis "Zope Configuration Markup Language")
     (description "Zope.configuration implements ZCML, the Zope Configuration
 Markup Language.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-configuration
   (package-with-python2 python-zope-configuration))
@@ -6583,7 +6581,7 @@ Proxies are special objects which serve as mostly-transparent wrappers around
 another object, intervening in the apparent behavior of the wrapped object
 only when necessary to apply the policy (e.g., access checking, location
 brokering, etc.) for which the proxy is responsible.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-proxy
   (package-with-python2 python-zope-proxy))
@@ -6608,7 +6606,7 @@ brokering, etc.) for which the proxy is responsible.")
     (synopsis "Zope location library")
     (description "Zope.location implements the concept of \"locations\" in
 Zope3, which are are special objects that have a structural location.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-location
   (package-with-python2 python-zope-location))
@@ -6638,7 +6636,7 @@ Zope3, which are are special objects that have a structural location.")
     (synopsis "Zope security framework")
     (description "Zope.security provides a generic mechanism to implement
 security policies on Python objects.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-security
   (let ((zope-security (package-with-python2 python-zope-security)))
@@ -6677,7 +6675,7 @@ security policies on Python objects.")
     (description "Zope.component represents the core of the Zope Component
 Architecture.  Together with the zope.interface package, it provides
 facilities for defining, registering and looking up components.")
-    (license zpl2.1)))
+    (license license:zpl2.1)))
 
 (define-public python2-zope-component
   (package-with-python2 python-zope-component))
@@ -6714,7 +6712,7 @@ facilities for defining, registering and looking up components.")
     (description "A Python wrapper for the dialog utility.  Its purpose is to
 provide an easy to use, pythonic and comprehensive Python interface to dialog.
 This allows one to make simple text-mode user interfaces on Unix-like systems")
-    (license lgpl2.1)
+    (license license:lgpl2.1)
     (properties `((python2-variant . ,(delay python2-pythondialog))))))
 
 (define-public python2-pythondialog
@@ -6776,7 +6774,7 @@ powerful debugger, full-featured request and response objects, HTTP utilities to
 handle entity tags, cache control headers, HTTP dates, cookie handling, file
 uploads, a powerful URL routing system and a bunch of community-contributed
 addon modules.")
-    (license x11)))
+    (license license:x11)))
 
 (define-public python2-werkzeug
   (package-with-python2 python-werkzeug))
@@ -6806,7 +6804,7 @@ writer: an ini file round tripper.  Its main feature is that it is very easy to
 use, with a straightforward programmer’s interface and a simple syntax for
 config files.")
     (home-page "https://github.com/DiffSK/configobj")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-configobj
   (package-with-python2 python-configobj))
@@ -6858,7 +6856,7 @@ based on PyOpenSSL.  PyOpenSSL provides a more fully featured SSL implementation
 over the default provided with Python and importantly enables full verification
 of the SSL peer.")
     (home-page "https://github.com/cedadev/ndg_httpsclient/")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 ;; python2-openssl requires special care, so package-with-python2 is
 ;; insufficient.
@@ -6895,7 +6893,7 @@ of the SSL peer.")
 provides utilities for common tasks involving decorators and context
 managers.  It also contains additional features that are not part of
 the standard library.")
-    (license psfl)))
+    (license license:psfl)))
 
 (define-public python2-contextlib2
   (package-with-python2 python-contextlib2))
@@ -6917,7 +6915,7 @@ the standard library.")
     (synopsis "Python module for creating simple ASCII tables")
     (description "Texttable is a Python module for creating simple ASCII
 tables.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-texttable
   (package-with-python2 python-texttable))
@@ -6942,7 +6940,7 @@ tables.")
     (synopsis "WebSocket client for Python")
     (description "The Websocket-client module provides the low level APIs for
 WebSocket usage in Python programs.")
-    (license lgpl2.1+)))
+    (license license:lgpl2.1+)))
 
 (define-public python2-websocket-client
   (package-with-python2 python-websocket-client))
@@ -6991,7 +6989,7 @@ for atomic filesystem operations.")
     (description "This is a toolbelt of useful classes and functions to be used
 with python-requests.")
     (home-page "https://github.com/sigmavirus24/requests-toolbelt")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python-click-threading
   (package
@@ -7232,7 +7230,7 @@ processes across test runs.")
     (description "The icalendar package is a parser/generator of iCalendar
 files for use with Python.")
     (home-page "https://github.com/collective/icalendar")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python-sphinxcontrib-newsfeed
   (package
@@ -7252,7 +7250,7 @@ files for use with Python.")
     (description "Sphinxcontrib-newsfeed is an extension for adding a simple
 Blog, News or Announcements section to a Sphinx website.")
     (home-page "https://bitbucket.org/prometheus/sphinxcontrib-newsfeed")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python-args
   (package
@@ -7271,7 +7269,7 @@ Blog, News or Announcements section to a Sphinx website.")
     (synopsis "Command-line argument parser")
     (description
      "This library provides a Python module to parse command-line arguments.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-args
   (package-with-python2 python-args))
@@ -7296,7 +7294,7 @@ Blog, News or Announcements section to a Sphinx website.")
      "Clint is a Python module filled with a set of tools for developing
 command-line applications, including tools for colored and indented
 output, progress bar display, and pipes.")
-    (license isc)))
+    (license license:isc)))
 
 (define-public python2-clint
   (package-with-python2 python-clint))
@@ -7319,7 +7317,7 @@ output, progress bar display, and pipes.")
     (description
      "Astor is designed to allow easy manipulation of Python source via the
 Abstract Syntax Tree.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-astor
   (package-with-python2 python-astor))
@@ -7344,7 +7342,7 @@ Abstract Syntax Tree.")
      "This package provides a pure Python based parser generator, that also
 works with RPython.  It is a more-or-less direct port of David Bazzley's PLY,
 with a new public API, and RPython support.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-rply
   (package-with-python2 python-rply))
@@ -7456,7 +7454,7 @@ authenticated session objects providing things like keep-alive.")
      "The concurrent.futures module provides a high-level interface for
 asynchronously executing callables.  This package backports the
 concurrent.futures package from Python 3.2")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python-urllib3
   (package
@@ -7512,7 +7510,7 @@ supports url redirection and retries, and also gzip and deflate decoding.")
    (description "Colorama is a Python library for rendering colored terminal
 text.")
    (home-page "https://pypi.python.org/pypi/colorama")
-   (license bsd-3)))
+   (license license:bsd-3)))
 
 (define-public python2-colorama
   (package-with-python2 python-colorama))
@@ -7538,7 +7536,7 @@ encryption and decryption, signing and verifying signatures, and key
 generation according to PKCS#1 version 1.5.  It can be used as a Python
 library as well as on the command line.")
    (home-page "http://stuvel.eu/rsa")
-   (license asl2.0)))
+   (license license:asl2.0)))
 
 (define-public python2-rsa
   (package-with-python2 python-rsa))
@@ -7649,7 +7647,7 @@ document.")
    (synopsis "Low-level interface to AWS")
    (description "Botocore is a Python library that provides a low-level
 interface to the Amazon Web Services (AWS) API.")
-   (license asl2.0)))
+   (license license:asl2.0)))
 
 (define-public python2-botocore
   (package-with-python2 python-botocore))
@@ -7683,7 +7681,7 @@ interface to the Amazon Web Services (AWS) API.")
    (synopsis "Command line client for AWS")
    (description "AWS CLI provides a unified command line interface to the
 Amazon Web Services (AWS) API.")
-   (license asl2.0)))
+   (license license:asl2.0)))
 
 (define-public python-hypothesis
   (package
@@ -7705,7 +7703,7 @@ much larger range of examples than you would ever want to write by hand.  It’s
 based on the Haskell library, Quickcheck, and is designed to integrate
 seamlessly into your existing Python unit testing work flow.")
     (home-page "https://github.com/DRMacIver/hypothesis")
-    (license mpl2.0)
+    (license license:mpl2.0)
     (properties `((python2-variant . ,(delay python2-hypothesis))))))
 
 (define-public python2-hypothesis
@@ -7739,7 +7737,7 @@ unit test functions that use @code{py.test}. This is useful for using
 function multiple times, without setting up or tearing down fixture state as is
 normally the case.")
     (home-page "https://github.com/untitaker/pytest-subtesthack/")
-    (license unlicense)))
+    (license license:unlicense)))
 
 (define-public python2-pytest-subtesthack
   (package-with-python2 python-pytest-subtesthack))
@@ -7768,7 +7766,7 @@ normally the case.")
     (description "Provides bindings to libxdo for manipulating X11 via simulated
 input.  (Note that this is mostly a legacy library; you may wish to look at
 python-xdo for newer bindings.)")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python-wtforms
   (package
@@ -7791,7 +7789,7 @@ python-xdo for newer bindings.)")
      "WTForms is a flexible forms validation and rendering library
 for Python web development.  It is very similar to the web form API
 available in Django, but is a standalone package.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-wtforms))))))
 
 (define-public python2-wtforms
@@ -7848,7 +7846,7 @@ templates into Python modules.")
     (synopsis "Waitress WSGI server")
     (description "Waitress is meant to be a production-quality pure-Python WSGI
 server with very acceptable performance.")
-    (license zpl2.1)
+    (license license:zpl2.1)
     (properties `((python2-variant . ,(delay python2-waitress))))))
 
 (define-public python2-waitress
@@ -8029,7 +8027,7 @@ layouts.")
     (description "pyquery allows you to make jQuery queries on xml documents.
 The API is as much as possible the similar to jQuery.  pyquery uses lxml for
 fast xml and html manipulation.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-pyquery))))))
 
 (define-public python2-pyquery
@@ -8117,7 +8115,7 @@ minimum of WSGI.")
     (description
      "Anyjson loads whichever is the fastest JSON module installed
 and provides a uniform API regardless of which JSON implementation is used.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-anyjson))))))
 
 (define-public python2-anyjson
@@ -8153,7 +8151,7 @@ and provides a uniform API regardless of which JSON implementation is used.")
      "This is a fork of amqplib which was originally written by Barry Pederson.
 It is maintained by the Celery project, and used by kombu as a pure python
 alternative when librabbitmq is not available.")
-    (license lgpl2.1+)
+    (license license:lgpl2.1+)
     (properties `((python2-variant . ,(delay python2-amqp))))))
 
 (define-public python2-amqp
@@ -8195,7 +8193,7 @@ and also provide proven and tested solutions to common messaging problems.
 AMQP is the Advanced Message Queuing Protocol, an open standard protocol for
 message orientation, queuing, routing, reliability and security, for which the
 RabbitMQ messaging server is the most popular implementation.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-kombu))))))
 
 (define-public python2-kombu
@@ -8229,7 +8227,7 @@ RabbitMQ messaging server is the most popular implementation.")
 multiprocessing package itself is a renamed and updated version of R Oudkerk's
 pyprocessing package.  This standalone variant is intended to be compatible with
 Python 2.4 and 2.5, and will draw its fixes/improvements from python-trunk.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-billiard))))))
 
 (define-public python2-billiard
@@ -8270,7 +8268,7 @@ supports scheduling as well.  The execution units, called tasks, are executed
 concurrently on a single or more worker servers using multiprocessing,
 Eventlet, or gevent.  Tasks can execute asynchronously (in the background) or
 synchronously (wait until ready).")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-celery))))))
 
 (define-public python2-celery
@@ -8333,7 +8331,7 @@ ISO 8859, etc.).")
   (description
     "python-editor is a library that provides the editor module for
 programmatically interfacing with your system's $EDITOR.")
-  (license asl2.0)
+  (license license:asl2.0)
   (properties `((python2-variant . ,(delay python2-editor))))))
 
 (define-public python2-editor
@@ -8360,7 +8358,7 @@ programmatically interfacing with your system's $EDITOR.")
     (description "A Sphinx extension to literally insert the output of arbitrary
 commands into documents, helping you to keep your command examples up to date.")
     (home-page "https://github.com/lunaryorn/sphinxcontrib-programoutput")
-    (license bsd-2)
+    (license license:bsd-2)
     (properties `((python2-variant . ,(delay python2-sphinxcontrib-programoutput))))))
 
 (define-public python2-sphinxcontrib-programoutput
@@ -8389,7 +8387,7 @@ commands into documents, helping you to keep your command examples up to date.")
 system.  The extension allows generation of API documentation by
 introspection of @code{zope.interface} instances in code.")
     (home-page "https://github.com/repoze/repoze.sphinx.autointerface")
-    (license repoze)))
+    (license license:repoze)))
 
 (define-public python2-sphinx-repoze-autointerface
   (package-with-python2 python-sphinx-repoze-autointerface))
@@ -8416,7 +8414,7 @@ introspection of @code{zope.interface} instances in code.")
     (synopsis "Python PostgreSQL adapter")
     (description
      "psycopg2 is a thread-safe PostgreSQL adapter that implements DB-API 2.0. ")
-    (license lgpl3+)
+    (license license:lgpl3+)
     (properties `((python2-variant . ,(delay python2-psycopg2))))))
 
 (define-public python2-psycopg2
@@ -8446,7 +8444,7 @@ are supported and well tested. vCard 3.0 files are supported, and all data
 should be imported, but only a few components are understood in a sophisticated
 way.")
     (home-page "http://eventable.github.io/vobject/")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-vobject))))))
 
 (define-public python2-vobject
@@ -8473,7 +8471,7 @@ way.")
     (description "The Munkres module provides an implementation of the Munkres
 algorithm (also called the Hungarian algorithm or the Kuhn-Munkres algorithm),
 useful for solving the Assignment Problem.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-munkres
   (package-with-python2 python-munkres))
@@ -8498,7 +8496,7 @@ useful for solving the Assignment Problem.")
     (description "Flask is a micro web framework based on the Werkzeug toolkit
 and Jinja2 template engine.  It is called a micro framework because it does not
 presume or force a developer to use a particular tool or library.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-flask))))))
 
 (define-public python2-flask
@@ -8561,7 +8559,7 @@ Python.")
     (synopsis "Utility for mocking out the `requests` Python library")
     (description "A utility library for mocking out the `requests` Python
 library.")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-responses))))))
 
 (define-public python2-responses
@@ -8622,7 +8620,7 @@ ambiguities (forward vs. backward slashes, etc.).
     (synopsis "Approximate and phonetic matching of strings")
     (description "Jellyfish uses a variety of string comparison and phonetic
 encoding algorithms to do fuzzy string matching.")
-    (license bsd-2)
+    (license license:bsd-2)
     (properties `((python2-variant . ,(delay python2-jellyfish))))))
 
 (define-public python2-jellyfish
@@ -8658,7 +8656,7 @@ encoding algorithms to do fuzzy string matching.")
     (synopsis "Unicode CSV module for Python 2")
     (description "Unicodecsv is a drop-in replacement for Python 2.7's CSV
 module, adding support for Unicode strings.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python-rarfile
   (package
@@ -8687,7 +8685,7 @@ module, adding support for Unicode strings.")
     (synopsis "RAR archive reader for Python")
     (description "This is Python module for RAR archive reading.  The interface
 is made as zipfile like as possible.")
-    (license isc)))
+    (license license:isc)))
 
 (define-public python2-rarfile
   (package-with-python2 python-rarfile))
@@ -8790,7 +8788,7 @@ in storage services that are compatible with the Amazon Simple Storage
 Service (S3) protocol, including S3 itself.  It supports rsync-like backup,
 GnuPG encryption, and more.  It also supports management of Amazon's
 CloudFront content delivery network.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public python-pkgconfig
   (package
@@ -8858,7 +8856,7 @@ LDFLAGS and parse the output to build extensions with setup.py.")
 files.  It contains a drop-in replacement for the I/O interface in the
 standard library's @code{bz2} module, including features from the latest
 development version of CPython that are not available in older releases.")
-    (license asl2.0)
+    (license license:asl2.0)
     (properties `((python2-variant . ,(delay python2-bz2file))))))
 
 (define-public python2-bz2file
@@ -8950,7 +8948,7 @@ to support both Python 2 and Python 3 with minimal overhead.")
 other signals and errors) in Cython code, using two related approaches,
 for mixed Cython/Python code or external C libraries and pure Cython code,
 respectively.")
-    (license lgpl3+)))
+    (license license:lgpl3+)))
 
 (define-public python2-cysignals
   (package-with-python2 python-cysignals))
@@ -8993,7 +8991,7 @@ respectively.")
   (synopsis "Experimental Python-2 to C++ Compiler")
   (description (string-append "This is an experimental compiler for a subset of
 Python.  It generates C++ code and a Makefile."))
-  (license (list gpl3 bsd-3 license:expat))))
+  (license (list license:gpl3 license:bsd-3 license:expat))))
 
 (define-public python2-rope
   (package
@@ -9020,7 +9018,7 @@ Python.  It generates C++ code and a Makefile."))
 the renaming, moving and extracting of attributes, functions, modules, fields
 and parameters in Python 2 source code.  These refactorings can also be applied
 to occurences in strings and comments.")
-    (license gpl2)))
+    (license license:gpl2)))
 
 (define-public python-py3status
   (package
@@ -9041,7 +9039,7 @@ to occurences in strings and comments.")
     (description "py3status is an i3status wrapper which extends i3status
 functionality in a modular way, allowing you to extend your panel with your
 own code, responding to click events and updating clock every second.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python-tblib
   (package
@@ -9081,7 +9079,7 @@ multiple processes (imagine multiprocessing, billiard, futures, celery etc).
 
 @item Parse traceback strings and raise with the parsed tracebacks.
 @end itemize")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-tblib
   (package-with-python2 python-tblib))
@@ -9115,7 +9113,7 @@ multiple processes (imagine multiprocessing, billiard, futures, celery etc).
     (synopsis "Non-validating SQL parser")
     (description "Sqlparse is a non-validating SQL parser for Python.  It
 provides support for parsing, splitting and formatting SQL statements.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-sqlparse
   (package-with-python2 python-sqlparse))
@@ -9140,7 +9138,7 @@ provides support for parsing, splitting and formatting SQL statements.")
 that supports micro-threads called \"tasklets\".  Tasklets run
 pseudo-concurrently (typically in a single or a few OS-level threads) and
 are synchronized with data exchanges on \"channels\".")
-    (license (list psfl license:expat))))
+    (license (list license:psfl license:expat))))
 
 (define-public python2-greenlet
   (package-with-python2 python-greenlet))
@@ -9228,7 +9226,7 @@ focus on event-based network programming and multiprotocol integration.")
     (synopsis "Python Lex & Yacc")
     (description "PLY is a @code{lex}/@code{yacc} implemented purely in Python.
 It uses LR parsing and does extensive error checking.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-ply))))))
 
 (define-public python2-ply
@@ -9292,7 +9290,7 @@ data in Python.")
      "Kazoo is a Python client library for the Apache Zookeeper distributed
 application service.  It is designed to be easy to use and to avoid common
 programming errors.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-kazoo
   (package-with-python2 python-kazoo))
@@ -9326,7 +9324,7 @@ programming errors.")
      "PyKafka is a client for the Apache Kafka distributed messaging system.
 It includes Python implementations of Kafka producers and consumers, which
 are optionally backed by a C extension built on librdkafka.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-pykafka
   (package-with-python2 python-pykafka))
@@ -9387,7 +9385,7 @@ specified in POSIX.1-2001 and POSIX.1-2008.")
 It supports both the original 1.0 specification, as well as the
 new (proposed) 2.0 spec, which includes batch submission, keyword arguments,
 etc.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python-chai
   (package
@@ -9407,7 +9405,7 @@ etc.")
     (description
      "Chai provides an api for mocking, stubbing and spying your python
 objects, patterned after the Mocha library for Ruby.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-chai
   (package-with-python2 python-chai))
@@ -9436,7 +9434,7 @@ objects, patterned after the Mocha library for Ruby.")
      "Arrow is a Python library to creating, manipulating, formatting and
 converting dates, times, and timestamps.  It implements and updates the
 datetime type.")
-    (license asl2.0)))
+    (license license:asl2.0)))
 
 (define-public python2-arrow
   (package-with-python2 python-arrow))
@@ -9483,7 +9481,7 @@ underscored string.")
     (description "Pure Python Levenshtein implementation, based off the
 Wikipedia code samples at
 @url{http://en.wikipedia.org/wiki/Levenshtein_distance}.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-pylev
   (package-with-python2 python-pylev))
@@ -9535,7 +9533,7 @@ docstring and colored output.")
     (description
      "Lazy object proxy is an object that wraps a callable but defers the call
 until the object is actually required, and caches the result of said call.")
-    (license bsd-2)))
+    (license license:bsd-2)))
 
 (define-public python2-lazy-object-proxy
   (package-with-python2 python-lazy-object-proxy))
@@ -9594,7 +9592,7 @@ It supports TSIG authenticated messages and EDNS0.")
     (synopsis "Email address validation library for Python")
     (description
      "This library validates email address syntax and deliverability.")
-    (license cc0)))
+    (license license:cc0)))
 
 (define-public python2-email-validator
   (package-with-python2 python-email-validator))
@@ -9689,7 +9687,7 @@ addresses, and phone numbers.")
     (description
      "pyaml is a PyYAML based python module to produce pretty and readable
 YAML-serialized data.")
-    (license (non-copyleft "http://www.wtfpl.net/txt/copying/"))))
+    (license (license:non-copyleft "http://www.wtfpl.net/txt/copying/"))))
 
 (define-public python2-pyaml
   (package-with-python2 python-pyaml))
@@ -9712,7 +9710,7 @@ YAML-serialized data.")
     (description
      "flexmock is a testing library for Python that makes it easy to create
 mocks, stubs and fakes.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
 (define-public python2-flexmock
   (package-with-python2 python-flexmock))
@@ -9783,7 +9781,7 @@ interfaces in Python.  It's like GNU Readline but it also features syntax
 highlighting while typing, out-of-the-box multi-line input editing, advanced
 code completion, incremental search, support for Chinese double-width
 characters, mouse support, and auto suggestions.")
-  (license bsd-3)
+  (license license:bsd-3)
   (properties `((python2-variant . ,(delay python2-prompt-toolkit))))))
 
 (define-public python2-prompt-toolkit
@@ -9846,7 +9844,7 @@ characters, mouse support, and auto suggestions.")
 It supports syntax highlighting, multiline editing, autocompletion, mouse,
 color schemes, bracketed paste, Vi and Emacs keybindings, Chinese characters
 etc.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay ptpython-2))))))
 
 (define-public ptpython-2
@@ -9886,7 +9884,7 @@ etc.")
      "Stem is a Python controller library for Tor.  With it you can use Tor's
 control protocol to script against the Tor process and read descriptor data
 relays publish about themselves.")
-    (license lgpl3)))
+    (license license:lgpl3)))
 
 (define-public python2-stem
   (package-with-python2 python-stem))
@@ -9909,7 +9907,7 @@ relays publish about themselves.")
     (description "@code{pyserial} provide serial port bindings for Python.  It
 supports different byte sizes, stop bits, parity and flow control with RTS/CTS
 and/or Xon/Xoff.  The port is accessed in RAW mode.")
-    (license bsd-3)
+    (license license:bsd-3)
     (properties `((python2-variant . ,(delay python2-pyserial))))))
 
 (define-public python2-pyserial
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 03/11] gnu: Add python-binaryornot.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
  2016-08-22 13:20           ` [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license: David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 04/11] gnu: Add python-nltk David Craven
                             ` (7 subsequent siblings)
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-binaryornot): New variable.
(python2-binaryornot): New variable.
---
 gnu/packages/python.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1742dc8..c184fd3 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9981,3 +9981,34 @@ hardware-accelerated multitouch applications.")
 
 (define-public python2-kivy-next
   (package-with-python2 python-kivy-next))
+
+(define-public python-binaryornot
+  (package
+    (name "python-binaryornot")
+    (version "0.4.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "binaryornot" version))
+              (sha256
+               (base32
+                "1j4f51dxic39mdwf6alj7gd769wy6mhk916v031wjali51xkh3xb"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-chardet" ,python-chardet)
+       ("python-hypothesis" ,python-hypothesis)))
+    (home-page "https://github.com/audreyr/binaryornot")
+    (synopsis "Package to check if a file is binary or text")
+    (description "Ultra-lightweight pure Python package to check if a file is
+binary or text.")
+    (license license:bsd-3)
+    (properties `((python2-variant . ,(delay python2-binaryornot))))))
+
+(define-public python2-binaryornot
+  (let ((base (package-with-python2 (strip-python2-variant python-binaryornot))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base)))
+      (inputs
+       `(("python2-enum34" ,python2-enum34)
+         ,@(package-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 04/11] gnu: Add python-nltk.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
  2016-08-22 13:20           ` [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license: David Craven
  2016-08-22 13:20           ` [PATCH 03/11] gnu: Add python-binaryornot David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-27  8:39             ` Danny Milosavljevic
  2016-10-24 21:15             ` Leo Famulari
  2016-08-22 13:20           ` [PATCH 05/11] gnu: Add python-pymongo David Craven
                             ` (6 subsequent siblings)
  9 siblings, 2 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-nltk): New variable.
(python2-nltk): New variable.
---
 gnu/packages/python.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c184fd3..c1eaf12 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10012,3 +10012,27 @@ binary or text.")
       (inputs
        `(("python2-enum34" ,python2-enum34)
          ,@(package-inputs base))))))
+
+(define-public python-nltk
+  (package
+    (name "python-nltk")
+    (version "3.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "nltk" version))
+              (sha256
+               (base32
+                "0skxbhnymwlspjkzga0f7x1hg3y50fwpfghs8g8k7fh6f4nknlym"))))
+    (build-system python-build-system)
+    (home-page "http://nltk.org/")
+    (synopsis "Natural Language Toolkit")
+    (description "Natural Language Toolkit")
+    (license license:asl2.0)
+    (properties `((python2-variant . ,(delay python2-nltk))))))
+
+(define-public python2-nltk
+  (let ((base (package-with-python2 (strip-python2-variant python-nltk))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 05/11] gnu: Add python-pymongo.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (2 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 04/11] gnu: Add python-nltk David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 06/11] gnu: Add python-sh David Craven
                             ` (5 subsequent siblings)
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-pymongo): New variable.
(python2-pymongo): New variable.
---
 gnu/packages/python.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c1eaf12..a703be3 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10036,3 +10036,29 @@ binary or text.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-pymongo
+  (package
+    (name "python-pymongo")
+    (version "3.3.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pymongo" version))
+              (sha256
+               (base32
+                "07mra6w86wjqy4lx5fvimidjhhfzd562gfjn8grsnbv2q8pk0i9x"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-certifi" ,python-certifi)))
+    (home-page "http://github.com/mongodb/mongo-python-driver")
+    (synopsis "Python driver for MongoDB")
+    (description "Python driver for MongoDB.")
+    (license license:asl2.0)
+    (properties `((python2-variant . ,(delay python2-pymongo))))))
+
+(define-public python2-pymongo
+  (let ((base (package-with-python2 (strip-python2-variant python-pymongo))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 06/11] gnu: Add python-sh.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (3 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 05/11] gnu: Add python-pymongo David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-27  8:42             ` Danny Milosavljevic
  2016-08-22 13:20           ` [PATCH 07/11] gnu: Add python-schematics David Craven
                             ` (4 subsequent siblings)
  9 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-sh): New variable.
(python2-sh): New variable.
---
 gnu/packages/python.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index a703be3..8720341 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10062,3 +10062,29 @@ binary or text.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-sh
+  (package
+  (name "python-sh")
+  (version "1.11")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "sh" version))
+            (sha256
+             (base32
+              "192r0mpv6dmkysjzhc43ddffiwb5g7c76bgr1mb1z2xz9awbj3sr"))))
+  (build-system python-build-system)
+  (arguments
+   `(#:tests? #f)) ; no tests
+  (home-page "https://github.com/amoffat/sh")
+  (synopsis "Python subprocess interface")
+  (description "Python subprocess interface.")
+  (license license:expat)
+  (properties `((python2-variant . ,(delay python2-sh))))))
+
+(define-public python2-sh
+  (let ((base (package-with-python2 (strip-python2-variant python-sh))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 07/11] gnu: Add python-schematics.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (4 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 06/11] gnu: Add python-sh David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 08/11] gnu: Add python-publicsuffix David Craven
                             ` (3 subsequent siblings)
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-schematics): New variable.
(python2-schematics): New variable.
---
 gnu/packages/python.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 8720341..bcabf22 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10088,3 +10088,35 @@ binary or text.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-schematics
+  (package
+    (name "python-schematics")
+    (version "1.1.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "https://github.com/schematics/schematics/archive/v" version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "19v1i69bf3bzarfxmbv0v6ivpcn758x3shvbiy9l2hy0lvqwnp6l"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-six" ,python-six)))
+    (arguments
+     `(#:tests? #f)) ; requires a bunch of not very nice packages with fixed
+                     ; version requirements (eg python-coveralls)
+    (home-page "https://github.com/schematics/schematics")
+    (synopsis "Python Data Structures for Humans")
+    (description "Python Data Structures for Humans.")
+    (license license:bsd-3)
+    (properties `((python2-variant . ,(delay python2-schematics))))))
+
+(define-public python2-schematics
+  (let ((base (package-with-python2 (strip-python2-variant python-schematics))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 08/11] gnu: Add python-publicsuffix.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (5 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 07/11] gnu: Add python-schematics David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 09/11] gnu: Add python-publicsuffix2 David Craven
                             ` (2 subsequent siblings)
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-publicsuffix): New variable.
(python2-publicsuffix): New variable.
---
 gnu/packages/python.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index bcabf22..0c6a1ef 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10120,3 +10120,30 @@ binary or text.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-publicsuffix
+  (package
+  (name "python-publicsuffix")
+  (version "1.1.0")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "publicsuffix" version))
+            (sha256
+             (base32
+              "1adx520249z2cy7ykwjr1k190mn2888wqn9jf8qm27ly4qymjxxf"))))
+  (build-system python-build-system)
+  (arguments
+   `(#:tests? #f)) ; tests use the internet
+  (home-page "https://www.tablix.org/~avian/git/publicsuffix.git")
+  (synopsis "Get suffix for a domain name")
+  (description "Get a public suffix for a domain name using the Public Suffix
+List.")
+  (license license:expat)
+  (properties `((python2-variant . ,(delay python2-nltk))))))
+
+(define-public python2-publicsuffix
+  (let ((base (package-with-python2 (strip-python2-variant python-publicsuffix))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 09/11] gnu: Add python-publicsuffix2.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (6 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 08/11] gnu: Add python-publicsuffix David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 10/11] gnu: Add python-url David Craven
  2016-08-22 13:20           ` [PATCH 11/11] gnu: Add python-ipaddress David Craven
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-publicsuffix2): New variable.
(python2-publicsuffix2): New variable.
---
 gnu/packages/python.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0c6a1ef..72b3c64 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10147,3 +10147,29 @@ List.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-publicsuffix2
+  (package
+  (name "python-publicsuffix2")
+  (version "2.20160621")
+  (source
+    (origin
+      (method url-fetch)
+      (uri (pypi-uri "publicsuffix2" version ".tar.bz2"))
+      (sha256
+       (base32
+        "06lx603gdwad5hc3hmn763ngq0rq9bzz1ni3ga72nzk5n872arkd"))))
+  (build-system python-build-system)
+  (home-page "https://github.com/pombredanne/python-publicsuffix2")
+  (synopsis "Get a public suffix for a domain name using the Public Suffix List")
+  (description "Get a public suffix for a domain name using the Public Suffix
+List.  Forked from and using the same API as the publicsuffix package.")
+  (license (list license:expat license:mpl2.0))
+  (properties `((python2-variant . ,(delay python2-publicsuffix2))))))
+
+(define-public python2-publicsuffix2
+  (let ((base (package-with-python2 (strip-python2-variant python-publicsuffix2))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 10/11] gnu: Add python-url.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (7 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 09/11] gnu: Add python-publicsuffix2 David Craven
@ 2016-08-22 13:20           ` David Craven
  2016-08-22 13:20           ` [PATCH 11/11] gnu: Add python-ipaddress David Craven
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-url): New variable.
(python2-url): New variable.
---
 gnu/packages/python.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 72b3c64..40d10e2 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -10173,3 +10173,36 @@ List.  Forked from and using the same API as the publicsuffix package.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-url
+  (package
+  (name "python-url")
+  (version "0.2.0")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "url" version))
+            (sha256
+             (base32
+              "0v879yadcz9qxfl41ak6wkga1kimp9cflla9ddz03hjjvgkqy5ki"))))
+  (build-system python-build-system)
+  (inputs
+   `(("python-publicsuffix" ,python-publicsuffix)))
+  (native-inputs
+   `(("python-coverage" ,python-coverage)
+     ("python-nose" ,python-nose)))
+  (arguments
+   `(#:tests? #f)) ; FIXME: tests fail with "ImportError: No module named 'tests'"
+  (home-page "http://github.com/seomoz/url-py")
+  (synopsis "URL Parsing")
+  (description "URL Parsing.")
+  (license license:expat)
+  (properties `((python2-variant . ,(delay python2-url))))))
+
+(define-public python2-url
+  (let ((base (package-with-python2 (strip-python2-variant python-url))))
+    (package (inherit base)
+      (inputs
+       `(("python2-publicsuffix" ,python2-publicsuffix)))
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH 11/11] gnu: Add python-ipaddress.
  2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                             ` (8 preceding siblings ...)
  2016-08-22 13:20           ` [PATCH 10/11] gnu: Add python-url David Craven
@ 2016-08-22 13:20           ` David Craven
  9 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-22 13:20 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-ipaddress): New variable.
(python2-ipaddress): New variable.
---
 gnu/packages/python.scm | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 40d10e2..8d83b16 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -5872,30 +5872,33 @@ implementations of ASN.1-based codecs and protocols.")
 (define-public python2-pyasn1-modules
   (package-with-python2 python-pyasn1-modules))
 
-(define-public python2-ipaddress
+(define-public python-ipaddress
   (package
-    (name "python2-ipaddress")
-    (version "1.0.14")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://pypi.python.org/packages/source/i/"
-                           "ipaddress/ipaddress-" version ".tar.gz"))
-       (sha256
-        (base32
-         "0givid4963n57nsjibms2fc347zmcs188q1hw9al1dkc9kj4nvr2"))))
+    (name "python-ipaddress")
+    (version "1.0.16")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "ipaddress" version))
+              (sha256
+               (base32
+                "1c3imabdrw8nfksgjjflzg7h4ynjckqacb188rf541m74arq4cas"))))
     (build-system python-build-system)
-    (arguments
-     `(#:tests? #f  ; no tests
-       #:python ,python-2))
     (home-page "https://github.com/phihag/ipaddress")
     (synopsis "IP address manipulation library")
     (description
-     "This package provides a fast, lightweight IPv4/IPv6 manipulation library
-in Python.  This library is used to create, poke at, and manipulate IPv4 and
-IPv6 addresses and networks.  This is a port of the Python 3.3 ipaddress
-module to older versions of Python.")
-    (license license:psfl)))
+      "This package provides a fast, lightweight IPv4/IPv6 manipulation library
+ in Python.  This library is used to create, poke at, and manipulate IPv4 and
+ IPv6 addresses and networks.  This is a port of the Python 3.3 ipaddress
+ module to older versions of Python.")
+    (license license:psfl)
+    (properties `((python2-variant . ,(delay python2-ipaddress))))))
+
+(define-public python2-ipaddress
+  (let ((base (package-with-python2 (strip-python2-variant python-ipaddress))))
+    (package (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
 
 (define-public python2-ipaddr
   (package
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license:.
  2016-08-22 13:20           ` [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license: David Craven
@ 2016-08-26 20:55             ` David Craven
  0 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-26 20:55 UTC (permalink / raw)
  To: guix-devel, Leo Famulari

Hi Leo,

I made the changes you requested a while back. Are these patches ok then?

Thanks,
David

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
                   ` (9 preceding siblings ...)
  2016-08-05 18:37 ` [PATCH 12/12] gnu: python: Add python-ipaddress David Craven
@ 2016-08-27  6:43 ` Ricardo Wurmus
  2016-08-27  8:31   ` David Craven
  10 siblings, 1 reply; 69+ messages in thread
From: Ricardo Wurmus @ 2016-08-27  6:43 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel


David Craven <david@craven.ch> writes:

> * guix/import/utils.scm (define-module): guix licenses import uses a prefix.
>   (string->licenses): Add license: prefix to licenses.
>   (license->symbol): Add license: prefix to licenses. Return a symbol with the
>   prefix license:.

Nitpick: please use two spaces between sentences.

Is the purpose of this patch to make importers return licenses with this
prefix or is there another use case?

~~ Ricardo

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-08-27  6:43 ` [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix Ricardo Wurmus
@ 2016-08-27  8:31   ` David Craven
  2016-08-30 19:07     ` Eric Bavier
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-27  8:31 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

> Is the purpose of this patch to make importers return licenses with this
> prefix or is there another use case?

Yes that's the intention. I was only thinking about the python
importer, but this will affect all importers.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 04/11] gnu: Add python-nltk.
  2016-08-22 13:20           ` [PATCH 04/11] gnu: Add python-nltk David Craven
@ 2016-08-27  8:39             ` Danny Milosavljevic
  2016-10-24 21:15             ` Leo Famulari
  1 sibling, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-27  8:39 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

> +    (description "Natural Language Toolkit")

I'd elaborate on the description a bit. Otherwise LGTM.

From the site, buzzwords removed:

"It provides interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning, wrappers for natural language processing libraries."

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 06/11] gnu: Add python-sh.
  2016-08-22 13:20           ` [PATCH 06/11] gnu: Add python-sh David Craven
@ 2016-08-27  8:42             ` Danny Milosavljevic
  2016-08-28 12:28               ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-27  8:42 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 22 Aug 2016 15:20:13 +0200
David Craven <david@craven.ch> wrote:

> +  (description "Python subprocess interface.")

I'd mention that it provides a function per program and that you invoke programs by calling a function called like the program in the sh module. 

Essentially it hides the fact that it's an invocation of a process rather than a call of a function.

That's what it's for - otherwise you could have just used the Python built-in subprocess module.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 06/11] gnu: Add python-sh.
  2016-08-27  8:42             ` Danny Milosavljevic
@ 2016-08-28 12:28               ` David Craven
  2016-08-29 10:31                 ` Guix with U-Boot Danny Milosavljevic
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-28 12:28 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Thanks for your suggestions. I pushed the packages.

Is there a git repo somewhere I can pull your uboot stuff from? I'd
like to test it =)

I'm interested in starting a riscv port of guixsd at some point. I've
identified some blocking issues I think need to be addressed first to
make it feasible:

1. getting guix system vm running on arm/mips (requires uboot working)
2. offloading builds to a vm (since riscv won't have (commercially)
available soc's till next year)
3. updating the default gcc to a recent version (preferably gcc 6)

So I'm willing to invest some quality time with these issues...

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Guix with U-Boot
  2016-08-28 12:28               ` David Craven
@ 2016-08-29 10:31                 ` Danny Milosavljevic
  2016-08-29 11:25                   ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 10:31 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]

Hi,

On Sun, 28 Aug 2016 14:28:31 +0200
David Craven <david@craven.ch> wrote:

> Thanks for your suggestions. I pushed the packages.
> 
> Is there a git repo somewhere I can pull your uboot stuff from? I'd
> like to test it =) 

There's no such repo right now.

I'd prefer merging into master soon to creating a fork.

For what it's worth, the changes I sent to the mailing list were tested on my machines, including that the Grub support still works.

If merging is deemed too risky, would it be possible to create a "wip-u-boot" branch on Savannah instead? - it seems that is how these bigger changes are handled. Then I could push the U-Boot parts there.

I've attached the UNFINISHED u-boot-install program which installs the U-Boot bootloader (comparable to grub-install). I plan to upstream it into the U-Boot main repository eventually. The other parts required for u-boot support were all already posted to our mailing list here.

gnu/packages/u-boot.scm could be merged now - it shouldn't affect anything because it's unused by master.

Other than that, it's mostly renaming "grub" -> "bootloader" in the Guix main source code that it creating a massive amount of noise in the patches I sent before. The actual functional change is a small part.

> I'm interested in starting a riscv port of guixsd at some point.

Nice! I think RISC-V is quite important to have.

[-- Attachment #2: u-boot-install.c --]
[-- Type: text/x-c++src, Size: 14678 bytes --]

/** u-boot-install.

SPDX GPLv3+

Installation methods are:

A20:
	/proc/cpuinfo:
		Processor	: ARMv7 Processor rev 4 (v7l)
		Hardware        : sun7i   "platform"; check the U-Boot config for this.
	U-Boot [def]config:
		CONFIG_ARCH_SUNXI=y
		CONFIG_MACH_SUN7I=y
		CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime2"
	Installer for Allwinner:
		dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8 ; can be done by parted. ped_device_write, ped_device_sync, ...

Novena:
	"We ship a simple script called novena-install-spl. This simply does a dd of the file to the specified disk."
	disk=/dev/disk/by-path/platform-2198000.usdhc
	file=/boot/u-boot.spl
	if ! dd if="${file}" of="${disk}" bs=1024 seek=1 conv=notrunc 2> /dev/null

Raspberry Pi:
	mount /dev/sdb1 /mnt/tmp
	cp u-boot.bin /mnt/tmp/kernel.img
	umount /mnt/tmp

STMicroelectronics:
	http://www.stlinux.com/u-boot/install [from the U-Boot prompt]

Sheevaplug:
	http://www.cyrius.com/debian/kirkwood/sheevaplug/uboot-upgrade/

Xilinx:
	Downloading U-Boot to MicroBlaze

	http://www.wiki.xilinx.com/Build+U-Boot */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <parted/parted.h>
#include <sys/types.h>
#include <sys/stat.h>

/** skip_overlay_long_line: given a FILE, skips forward until the next '\n'. It also skips the '\n'.
  * @param f File to read */
static void skip_overly_long_line(FILE* f) {
	char buf[200];
	/* skip overly long lines */
	while (fgets(buf, sizeof(buf), f) != NULL && strchr(buf, '\n') == NULL)
		;
}

/** read_value_of_key_value_file: Read the value of a <key>=<value> file with the given key and return it.
 * @param separator separator between key and value
 * @param filename of file to read. File will be opened and closed automatically.
 * @param key key to search for. Whitespace after key in file is ignored.
 * @param value buffer to store value in. Will be NUL terminated if result != NULL.
 * @param valuesize size of buffer, including the NUL terminator.
 * @return value if successful, NULL otherwise.
 *
 * Cannot return values from lines which are longer than 399 Byte.
 */
static const char* read_value_of_key_value_file(char separator, const char* filename, const char* key, char* value, size_t valuesize) {
	char buf[400];
	char* result = NULL;
	FILE* f = fopen(filename, "r");
	if (f == NULL)
		return NULL;
	while (fgets(buf, sizeof(buf), f) != NULL) {
		if (strchr(buf, '\n') == NULL) {
			fprintf(stderr, "Warning: skipping overly long line that starts with \"%s\".\n", buf);
			skip_overly_long_line(f);
		} else {
			const char* xkey = buf;
			char* sep = strchr(buf, separator);
			if (sep != NULL) { /* we have key and value */
				*sep = 0; /* just in case separator is ' ' */
				const char* xvalue = sep + 1;
				/* strip leading whitespace from xvalue */
				while (*xvalue == ' ' || *xvalue == '\t')
					++xvalue;
				/* strip trailing whitespace from key */
				for (--sep; sep >= xkey; --sep) {
					if (*sep != ' ' && *sep != '\t')
						break;
					*sep = 0;
				}
				if (strcmp(key, xkey) == 0 && valuesize >= 1) {
					/* Note: be careful about '\n' in value */
					strncpy(value, xvalue, valuesize);
					if (value[valuesize - 1] == '\n')
						value[valuesize - 1] = 0;
					if (value[valuesize - 1] != 0) {
						fprintf(stderr, "Warning: skipping overly long value for entry that starts with %s=\"%s\".\n", xkey, xvalue);
					} else {
						result = strchr(value, '\n');
						if (result != NULL)
							*result = 0;
						result = value;
						break;
					}
				}
			}
		}
	}
	(void) fclose(f);
	return result;
}

static const char* read_proc_cpuinfo_hardware_platform(char* value, size_t valuesize) {
	return read_value_of_key_value_file(':', "/proc/cpuinfo", "Hardware", value, valuesize);
}

/** get_first_commandline_option_value: gets the value of the first (long) option with the specified name on the commandline and returns it.
  * @param argv The argument "vector" from main()
  * @param key The name of the option. Includes the "--" prefix
  * @return Value of the option. NULL if it was not found */
static const char* get_first_commandline_option_value(char* argv[], const char* key) {
	size_t keylen = strlen(key);
	for (++argv; *argv != NULL; ++argv) {
		const char* arg = *argv;
		if (strncmp(arg, "--", strlen("--")) != 0)
			break;
		if (strncmp(arg, key, keylen) == 0) {
			const char* value = &arg[keylen];
			if (key[0] && key[strlen(key) - 1] == '=') {
				return value;
			} else if (*value == 0)
				return value;
		}
		if (strcmp(arg, "--") == 0) /* end of options */
			break;
	}
	return NULL;
}

/** get_first_commandline_argument: gets the value of the first commandline argument (i.e. the first non-option).
  * @param argv The argument "vector" from main()
  * @return Value of the argument. NULL if none is there. */
static const char* get_first_commandline_argument(char* argv[]) {
	for (++argv; *argv != NULL; ++argv) {
		const char* arg = *argv;
		if (strncmp(arg, "--", strlen("--")) != 0)
			break;
		if (strcmp(arg, "--") == 0) /* end of options */ {
			++argv;
			break;
		}
	}
	return *argv;
}

/** print_usage: Prints usage information to stderr.
  * @param argv Argument "vector" from main() */
static void print_usage(char* argv[]) {
	fprintf(stderr, "Usage: %s [--source-image=<name>] [--platform=<platform>] <drive>\n", argv[0] ?: "u-boot-install");
	fprintf(stderr, "Usage: %s --list-platforms\n", argv[0] ?: "u-boot-install");
	fprintf(stderr, "Usage: %s --list-drives\n", argv[0] ?: "u-boot-install");
	fprintf(stderr, "If platform is not specified, it's autodetected by reading /proc/cpuinfo .\n");
	fprintf(stderr, "<drive> is usually a block device of the drive.\n");
}

/** ensure_nonclobbering_slot: Ensures a free slot at start_Sectors, size size_Sectors which doesn't clobber anything else (or fails)
  * @param drive Drive to use
  * @param start_Sectors The start (in Sectors)
  * @param size_Sectors The size (in Sectors) */
static void ensure_nonclobbering_slot(PedDevice* drive, PedSector start_Sectors, PedSector size_Sectors) {
	/* TODO print drive model just to make sure */
	/* TODO print char* size = ped_unit_format_byte (device, device->length * device->sector_size); */
	const char* drivename = drive->path;
	//long long sectorsize_Bytes = drive->sector_size;
	PedDisk* disk = ped_disk_new(drive);
	if (disk == NULL) {
		fprintf(stderr, "Error: could not read partition table from \"%s\".\n", drivename);
		exit(3);
	}
	for (PedPartition* part = ped_disk_next_partition(disk, NULL); part != NULL; part = ped_disk_next_partition(disk, part)) {
		if (part->num < 0)
			continue;
		/* example:
		1 2048 3563667087 ext4
		2 3563669504 6291456 
		3 3569960960 143360000 
		4 3713320960 193708175 ext4 */
		/* FIXME check unit */
		printf("%d\t%lld\t%lld\t%s\n", part->num, part->geom.start, part->geom.length, part->fs_type ? part->fs_type->name : "");
	}
	{
		int max_partition_count;
		/* FIXME what's the difference to ped_disk_get_max_primary_partition_count ? */
		if (!ped_disk_get_max_supported_partition_count(disk, &max_partition_count)) {
			/* FIXME print error message */
			abort();
		}
		if (max_partition_count > 56) { /* FIXME for disk type GPT;
			static PedDisk *
gpt_duplicate (const PedDisk *disk);

			see _generate_header which sets FirstUsableLBA = gpt_disk_data->data_area.start */
			/* TODO if GPT is too large, reduce size of GPT to max. 56 entries. If it even is GPT to begin with (see disk->type).
				That might entail copying all the things over to a new GPT.
			 */
			/* FirstUsableLBA is the first logical block that is used for contents */
			abort();
		}
		/* FIXME gpt_partition_align (PedPartition *part, const PedConstraint *constraint) -> boooool */
	}
	/* FIXME check active gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) PED_PARTITION_BOOT FIXME LEGACY_BOOT ?? */
	ped_disk_destroy(disk);
}

/** write_block_safely: first makes sure there's nothing at the specified location, then writes there.
  * @param drive Drive to write to
  * @param buffer Buffer to read
  * @param start_Bytes Location where to write to, in LBA bytes from the beginning of the disk
  * @param size_Bytes Size of buffer and also number of bytes to write */
static void write_block_safely(PedDevice* drive, const void* buffer, off_t start_Bytes, off_t size_Bytes) {
	const char* drivename = drive->path;
	long long sectorsize_Bytes = drive->sector_size;
	if (start_Bytes % sectorsize_Bytes != 0) {
		fprintf(stderr, "Error: %jd Bytes from the start of drive %s is not the start of a sector. Cannot install there.\n", (intmax_t) start_Bytes, drivename);
		exit(3);
	}
	PedSector start_Sectors = start_Bytes / sectorsize_Bytes;
	PedSector size_Sectors = size_Bytes / sectorsize_Bytes; // FIXME round up.
	ensure_nonclobbering_slot(drive, start_Sectors, size_Sectors);
	if (ped_device_write(drive, buffer, start_Sectors, size_Sectors) == 0) {
		/* FIXME print error message */
		exit(4);
	}
	if (ped_device_sync(drive) == 0) {
		/* FIXME print error message */
		exit(5);
	}
}

/** install_on_raw_drive: Installs U-Boot on Novena (i.MX6) devices
  * @param imagename Name of the image to read
  * @param drivename Name of the drive's block device (not partition)
  * @param position_Bytes position to write the image to */
static void install_on_raw_drive(const char* imagename, const char* drivename, off_t position_Bytes) {
	PedDevice* drive = ped_device_get(drivename);
	if (drive == NULL) {
		fprintf(stderr, "Error: could not open drive \"%s\".\n", drivename);
		exit(2);
	}
	FILE* f = fopen(imagename, "rb");
	long size_Bytes;
	if (f == NULL ||
	    fseek(f, 0, SEEK_END) == -1 ||
	    (size_Bytes = ftell(f)) == -1 ||
	    fseek(f, 0, SEEK_SET) == -1) {
		/* FIXME ferror, strerror */
		exit(1);
	}
	if (size_Bytes > 8000000U) { /* 8 MB */
		/* FIXME print Too big instead of allocating a huge buffer. */
		abort();
	}
	void* buffer = malloc(size_Bytes);
	if (buffer == NULL) {
		fprintf(stderr, "ERROR: memory allocation of %ju bytes failed.\n", (uintmax_t) size_Bytes);
		/* FIXME print error */
		abort();
	}
	clearerr(f);
	if (fread(buffer, size_Bytes, 1U, f) != 1) {
		/* FIXME ferror, strerror.
       fread() does not distinguish between end-of-file and error, and callers
       must use feof(3) and ferror(3) to determine which occurred. */
		abort();
	}
	write_block_safely(drive, buffer, position_Bytes, size_Bytes);
	free(buffer);
	(void) fclose(f);
	ped_device_destroy(drive);
}

/** install_on_sunxi: Installs U-Boot on Allwinner (sunxi) devices
  * @param argv Argument "vector" from main()
  * @param drivename Name of the drive */
static void install_on_sunxi(char* argv[], const char* drivename) {
	const char* imagename = get_first_commandline_option_value(argv, "--source-image=") ?: "u-boot-sunxi-with-spl.bin";
	install_on_raw_drive(imagename, drivename, 8192ULL);
}

/** install_on_novena: Installs U-Boot on Novena (Freescale i.MX6) devices
  * @param argv Argument "vector" from main()
  * @param drivename Name of the drive */
static void install_on_novena(char* argv[], const char* drivename) {
	const char* imagename = get_first_commandline_option_value(argv, "--source-image=") ?: "u-boot.spl";
	install_on_raw_drive(imagename, drivename, 1024ULL);
}

/** struct installer: Represents an installer for a platform */
struct installer {
	const char* platform;
	void (*install)(char* argv[], const char* drive);
};

/** installers: Registry for known installers */
static struct installer installers[] = {
	{.platform = "sun7i", install_on_sunxi},
	{.platform = "mxc" /* imx6 */, install_on_novena},
	// TODO {.platform = "uefi", install_on_uefi},
	{}, /* sentinel */
};

/** install: Given a platform and drive, uses the platform-specific installer to install U-Boot on the drive. 
  * @param argv Argument "vector" from main()
  * @param platform Name of the platform
  * @param drive Name of the drive */
static void install(char* argv[], const char* platform, const char* drive) {
	for (const struct installer* xinstallers = installers; xinstallers->platform != NULL; ++xinstallers) {
		const struct installer* xinstaller = xinstallers;
		const char* xplatform = xinstaller->platform;
		if (strcmp(xplatform, platform) == 0) {
			(*xinstaller->install)(argv, drive);
			return;
		}
	}
	fprintf(stderr, "Error: don't know how to install U-Boot on platform \"%s\".\n", platform);
	exit(1);
}

/** list_platforms: Lists supported platforms */
static void list_platforms(void) {
	for (const struct installer* xinstallers = installers; xinstallers->platform != NULL; ++xinstallers) {
		const struct installer* xinstaller = xinstallers;
		const char* xplatform = xinstaller->platform;
		if (puts(xplatform) == EOF) {
			/* FIXME print error message */
			exit(1);
		}
	}
}

/** list_drives: Lists available drives */
static void list_drives(void) {
	ped_device_probe_all();
	for (PedDevice* device = ped_device_get_next(NULL); device != NULL; device = ped_device_get_next(device)) {
		/* FIXME handle overflow. FIXME round properly. */
		if (printf("%s\t%'lld MB\n", device->path, device->length * device->sector_size / 1000000) == -1) {
			/* FIXME print error message */
			exit(1);
		}
	}
}

static const char* get_uefi_platform(void) {
	DIR* dir = opendir("/sys/firmware/efi/vars");
	if (dir != NULL) {
		closedir(dir);
		return "uefi";
	} else {
		if (errno != ENOENT) {
			perror("ERROR: /sys/firmware/efi/vars");
			exit(9);
		}
		return NULL;
	}
}

int main(int argc, char* argv[]) {
	/* FIXME maybe make the user specify a --remote for remote installation and a --local for local installation - both mandatory */
	char buf[200];
	if (get_first_commandline_option_value(argv, "--help") != NULL) {
		print_usage(argv);
		return 0;
	}
	const char* oplist_platforms = get_first_commandline_option_value(argv, "--list-platforms");
	if (oplist_platforms != NULL) {
		list_platforms();
		return 0;
	} else {
		const char* oplist_drives = get_first_commandline_option_value(argv, "--list-drives");
		if (oplist_drives != NULL) {
			list_drives();
			return 0;
		}
	}
	const char* platform = get_first_commandline_option_value(argv, "--platform=") ?: 
	                       get_uefi_platform() ?: 
	                       read_proc_cpuinfo_hardware_platform(buf, sizeof(buf));
	const char* drive = get_first_commandline_argument(argv);
	if (platform != NULL && drive != NULL) {
		printf("Platform %s\n", platform);
		printf("Drive %s\n", drive);
		//printf("Hardware %s\n", read_proc_cpuinfo_hardware_platform(buf, sizeof(buf)));
		install(argv, platform, drive);
	} else {
		print_usage(argv);
		return 1;
	}
	return 0;
}

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 10:31                 ` Guix with U-Boot Danny Milosavljevic
@ 2016-08-29 11:25                   ` David Craven
  2016-08-29 14:12                     ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 11:25 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

> If merging is deemed too risky, would it be possible to create a
> "wip-u-boot" branch on Savannah instead? - it seems that is
> how these bigger changes are handled. Then I could push the
> U-Boot parts there.

I'll collect your patches and do that. That should make it easier
to test. (I'm not qualified to merge your patches ;-)

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 11:25                   ` David Craven
@ 2016-08-29 14:12                     ` David Craven
  2016-08-29 14:19                       ` Danny Milosavljevic
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 14:12 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Mhmm so I'm trying your patches and I get a no code for gnu system
u-boot. The file seems to be missing from the patches?

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 14:12                     ` David Craven
@ 2016-08-29 14:19                       ` Danny Milosavljevic
  2016-08-29 16:51                         ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 14:19 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

On Mon, 29 Aug 2016 16:12:00 +0200
David Craven <david@craven.ch> wrote:

> Mhmm so I'm trying your patches and I get a no code for gnu system
> u-boot. The file seems to be missing from the patches?

Attached gnu/system/u-boot.scm . (Don't worry, once the branch is up, I'll diff with what I have here :) )

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: u-boot.scm --]
[-- Type: text/x-scheme, Size: 4167 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu system u-boot)
  #:use-module (guix store)
  #:use-module (guix packages)
  #:use-module (guix derivations)
  #:use-module (guix records)
  #:use-module (guix monads)
  #:use-module (guix gexp)
  #:use-module (guix download)
  #:use-module (gnu artwork)
  #:use-module (gnu system file-systems)
  #:autoload   (gnu packages u-boot) (make-u-boot-package)
  #:use-module (gnu system grub) ; <menu-entry>
  #:use-module (ice-9 match)
  #:use-module (ice-9 regex)
  #:use-module (srfi srfi-1)
  #:export (u-boot-configuration
            u-boot-configuration?
            u-boot-configuration-board
            u-boot-configuration-u-boot
            u-boot-configuration-device
            u-boot-configuration-file))

;;; Commentary:
;;;
;;; Configuration of U-Boot.
;;;
;;; Code:

(define-record-type* <u-boot-configuration>
  u-boot-configuration make-u-boot-configuration
  u-boot-configuration?
  (board           u-boot-configuration-board)           ; string ; not optional!
  (u-boot          u-boot-configuration-u-boot           ; package
                   (default #f)) ; will actually default to (make-u-boot-package board)
  (device          u-boot-configuration-device)        ; string
  (menu-entries    u-boot-configuration-menu-entries   ; list
                   (default '()))
  (default-entry   u-boot-configuration-default-entry  ; integer
                   (default 0))
  (timeout         u-boot-configuration-timeout        ; integer
                   (default 5)))

\f

;;;
;;; Configuration file.
;;;

(define* (u-boot-configuration-file config store-fs entries
                                  #:key
                                  (system (%current-system))
                                  (old-entries '()))
  "Return the U-Boot configuration file corresponding to CONFIG, a
<u-boot-configuration> object, and where the store is available at STORE-FS, a
<file-system> object.  OLD-ENTRIES is taken to be a list of menu entries
corresponding to old generations of the system."
  (define linux-image-name
    (if (string-prefix? "mips" system)
        "vmlinuz"
        "bzImage"))

  (define all-entries
    (append entries (u-boot-configuration-menu-entries config)))

  (define entry->gexp
    (match-lambda
     (($ <menu-entry> label linux arguments initrd)
      #~(format port "LABEL ~s
  MENU LABEL ~a
  LINUX ~a/~a ~a
  INITRD ~a
  FDTDIR .
  APPEND ~a
~%"
                #$label
                #$linux #$linux-image-name
                #$initrd
                (string-join (list #$@arguments))))))

  (define builder
      #~(call-with-output-file #$output
          (lambda (port)
            (format port "
ui menu.c32
DEFAULT ~a
TIMEOUT ~a~%"
                    #$(u-boot-configuration-default-entry config)
                    #$(u-boot-configuration-timeout config))
            #$@(map entry->gexp all-entries)

            #$@(if (pair? old-entries)
                   #~((format port "~%")
                      #$@(map entry->gexp old-entries)
                      (format port "~%"))
                   #~()))))

    (gexp->derivation "extlinux.conf" builder))

;;; u-boot.scm ends here

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 14:19                       ` Danny Milosavljevic
@ 2016-08-29 16:51                         ` David Craven
  2016-08-29 17:20                           ` Danny Milosavljevic
                                             ` (2 more replies)
  0 siblings, 3 replies; 69+ messages in thread
From: David Craven @ 2016-08-29 16:51 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

So I think that dtc and uboot are good now, I'll give it a few days
before merging...

I'm getting an Unbound variable: <u-boot-configuration> error :/

Here's my bootloader configuration. Any suggestions? =)

  (bootloader (u-boot-configuration
               (board "vexpress_ca9x4")
               (device "/dev/sdX")
               (u-boot armhf-linux-uboot)))

Thank you,
David

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 16:51                         ` David Craven
@ 2016-08-29 17:20                           ` Danny Milosavljevic
  2016-08-29 17:52                             ` Danny Milosavljevic
  2016-08-29 17:38                           ` Danny Milosavljevic
  2016-08-29 18:16                           ` Danny Milosavljevic
  2 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 17:20 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 18:51:45 +0200
David Craven <david@craven.ch> wrote:

> So I think that dtc and uboot are good now, I'll give it a few days
> before merging...
> 
> I'm getting an Unbound variable: <u-boot-configuration> error :/
> 
> Here's my bootloader configuration. Any suggestions? =)
> 
>   (bootloader (u-boot-configuration
>                (board "vexpress_ca9x4")
>                (device "/dev/sdX")
>                (u-boot armhf-linux-uboot)))

(use-modules ...
             (gnu system u-boot))
             ^^^ Add this

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 16:51                         ` David Craven
  2016-08-29 17:20                           ` Danny Milosavljevic
@ 2016-08-29 17:38                           ` Danny Milosavljevic
  2016-08-29 18:16                           ` Danny Milosavljevic
  2 siblings, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 17:38 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

On Mon, 29 Aug 2016 18:51:45 +0200
David Craven <david@craven.ch> wrote:

> So I think that dtc and uboot are good now, I'll give it a few days
> before merging...
> 
> I'm getting an Unbound variable: <u-boot-configuration> error :/
> 
> Here's my bootloader configuration. Any suggestions? =)
> 
>   (bootloader (u-boot-configuration
>                (board "vexpress_ca9x4")
>                (device "/dev/sdX")
>                (u-boot armhf-linux-uboot)))
> 
> Thank you,
> David

Try the attached gnu/system.scm . I also attached a patch so you could apply it to most other versions instead if you want to.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: system.scm --]
[-- Type: text/x-scheme, Size: 32451 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu system)
  #:use-module (guix store)
  #:use-module (guix monads)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (guix packages)
  #:use-module (guix derivations)
  #:use-module (guix profiles)
  #:use-module (guix ui)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages pciutils)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages less)
  #:use-module (gnu packages zile)
  #:use-module (gnu packages nano)
  #:use-module (gnu packages lsof)
  #:use-module (gnu packages gawk)
  #:use-module (gnu packages man)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages firmware)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (gnu services base)
  #:use-module (gnu system grub)
  #:use-module (gnu system u-boot)
  #:use-module (gnu system shadow)
  #:use-module (gnu system nss)
  #:use-module (gnu system locale)
  #:use-module (gnu system pam)
  #:use-module (gnu system linux-initrd)
  #:use-module (gnu system file-systems)
  #:use-module (gnu system mapped-devices)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:export (operating-system
            operating-system?

            operating-system-bootloader
            operating-system-services
            operating-system-user-services
            operating-system-packages
            operating-system-host-name
            operating-system-hosts-file
            operating-system-kernel
            operating-system-kernel-arguments
            operating-system-initrd
            operating-system-users
            operating-system-groups
            operating-system-issue
            operating-system-timezone
            operating-system-locale
            operating-system-locale-definitions
            operating-system-locale-libcs
            operating-system-mapped-devices
            operating-system-file-systems
            operating-system-store-file-system
            operating-system-user-mapped-devices
            operating-system-boot-mapped-devices
            operating-system-activation-script
            operating-system-user-accounts
            operating-system-shepherd-service-names

            operating-system-derivation
            operating-system-profile
            operating-system-bootloader-configuration-file
            operating-system-etc-directory
            operating-system-locale-directory
            operating-system-boot-script

            bootloader-configuration-device

            boot-parameters
            boot-parameters?
            boot-parameters-label
            boot-parameters-root-device
            boot-parameters-kernel
            boot-parameters-kernel-arguments
            read-boot-parameters

            local-host-aliases
            %setuid-programs
            %base-packages
            %base-firmware))

;;; Commentary:
;;;
;;; This module supports whole-system configuration.
;;;
;;; Code:

;; System-wide configuration.
;; TODO: Add per-field docstrings/stexi.
(define-record-type* <operating-system> operating-system
  make-operating-system
  operating-system?
  (kernel operating-system-kernel                 ; package
          (default linux-libre))
  (kernel-arguments operating-system-kernel-arguments
                    (default '()))                ; list of gexps/strings
  (bootloader operating-system-bootloader)        ; <grub-configuration> or <u-boot-configuration>

  (initrd operating-system-initrd                 ; (list fs) -> M derivation
          (default base-initrd))
  (firmware operating-system-firmware             ; list of packages
            (default %base-firmware))

  (host-name operating-system-host-name)          ; string
  (hosts-file operating-system-hosts-file         ; file-like | #f
              (default #f))

  (mapped-devices operating-system-mapped-devices ; list of <mapped-device>
                  (default '()))
  (file-systems operating-system-file-systems)    ; list of fs
  (swap-devices operating-system-swap-devices     ; list of strings
                (default '()))

  (users operating-system-users                   ; list of user accounts
         (default %base-user-accounts))
  (groups operating-system-groups                 ; list of user groups
          (default %base-groups))

  (skeletons operating-system-skeletons           ; list of name/monadic value
             (default (default-skeletons)))
  (issue operating-system-issue                   ; string
         (default %default-issue))

  (packages operating-system-packages             ; list of (PACKAGE OUTPUT...)
            (default %base-packages))             ; or just PACKAGE

  (timezone operating-system-timezone)            ; string
  (locale   operating-system-locale               ; string
            (default "en_US.utf8"))
  (locale-definitions operating-system-locale-definitions ; list of <locale-definition>
                      (default %default-locale-definitions))
  (locale-libcs operating-system-locale-libcs     ; list of <packages>
                (default %default-locale-libcs))
  (name-service-switch operating-system-name-service-switch ; <name-service-switch>
                       (default %default-nss))

  (services operating-system-user-services        ; list of monadic services
            (default %base-services))

  (pam-services operating-system-pam-services     ; list of PAM services
                (default (base-pam-services)))
  (setuid-programs operating-system-setuid-programs
                   (default %setuid-programs))    ; list of string-valued gexps

  (sudoers-file operating-system-sudoers-file     ; file-like
                (default %sudoers-specification)))

\f
;;;
;;; Services.
;;;

(define (other-file-system-services os)
  "Return file system services for the file systems of OS that are not marked
as 'needed-for-boot'."
  (define file-systems
    (remove file-system-needed-for-boot?
            (operating-system-file-systems os)))

  (define (device-mappings fs)
    (let ((device (file-system-device fs)))
      (if (string? device)                        ;title is 'device
          (filter (lambda (md)
                    (string=? (string-append "/dev/mapper/"
                                             (mapped-device-target md))
                              device))
                  (operating-system-mapped-devices os))
          '())))

  (define (add-dependencies fs)
    ;; Add the dependencies due to device mappings to FS.
    (file-system
      (inherit fs)
      (dependencies
       (delete-duplicates (append (device-mappings fs)
                                  (file-system-dependencies fs))
                          eq?))))

  (map (compose file-system-service add-dependencies) file-systems))

(define (mapped-device-user device file-systems)
  "Return a file system among FILE-SYSTEMS that uses DEVICE, or #f."
  (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
    (find (lambda (fs)
            (or (member device (file-system-dependencies fs))
                (and (eq? 'device (file-system-title fs))
                     (string=? (file-system-device fs) target))))
          file-systems)))

(define (operating-system-user-mapped-devices os)
  "Return the subset of mapped devices that can be installed in
user-land--i.e., those not needed during boot."
  (let ((devices      (operating-system-mapped-devices os))
        (file-systems (operating-system-file-systems os)))
   (filter (lambda (md)
             (let ((user (mapped-device-user md file-systems)))
               (or (not user)
                   (not (file-system-needed-for-boot? user)))))
           devices)))

(define (operating-system-boot-mapped-devices os)
  "Return the subset of mapped devices that must be installed during boot,
from the initrd."
  (let ((devices      (operating-system-mapped-devices os))
        (file-systems (operating-system-file-systems os)))
   (filter (lambda (md)
             (let ((user (mapped-device-user md file-systems)))
               (and user (file-system-needed-for-boot? user))))
           devices)))

(define (device-mapping-services os)
  "Return the list of device-mapping services for OS as a list."
  (map device-mapping-service
       (operating-system-user-mapped-devices os)))

(define (swap-services os)
  "Return the list of swap services for OS."
  (map swap-service (operating-system-swap-devices os)))

(define* (operating-system-directory-base-entries os #:key container?)
  "Return the basic entries of the 'system' directory of OS for use as the
value of the SYSTEM-SERVICE-TYPE service."
  (mlet %store-monad ((locale (operating-system-locale-directory os)))
    (if container?
        (return `(("locale" ,locale)))
        (mlet %store-monad
            ((kernel  ->  (operating-system-kernel os))
             (initrd      (operating-system-initrd-file os))
             (params      (operating-system-parameters-file os)))
          (return `(("kernel" ,kernel)
                    ("parameters" ,params)
                    ("initrd" ,initrd)
                    ("locale" ,locale)))))))      ;used by libc

(define* (essential-services os #:key container?)
  "Return the list of essential services for OS.  These are special services
that implement part of what's declared in OS are responsible for low-level
bookkeeping.  CONTAINER? determines whether to return the list of services for
a container or that of a \"bare metal\" system."
  (define known-fs
    (map file-system-mount-point (operating-system-file-systems os)))

  (let* ((mappings  (device-mapping-services os))
         (root-fs   (root-file-system-service))
         (other-fs  (other-file-system-services os))
         (unmount   (user-unmount-service known-fs))
         (swaps     (swap-services os))
         (procs     (user-processes-service
                     (map service-parameters other-fs)))
         (host-name (host-name-service (operating-system-host-name os)))
         (entries   (operating-system-directory-base-entries
                     os #:container? container?)))
    (cons* (service system-service-type entries)
           %boot-service

           ;; %SHEPHERD-ROOT-SERVICE must come first so that the gexp that
           ;; execs shepherd comes last in the boot script (XXX).  Likewise,
           ;; the cleanup service must come last so that its gexp runs before
           ;; activation code.
           %shepherd-root-service
           %activation-service
           (service cleanup-service-type #f)

           (pam-root-service (operating-system-pam-services os))
           (account-service (append (operating-system-accounts os)
                                    (operating-system-groups os))
                            (operating-system-skeletons os))
           (operating-system-etc-service os)
           (service fstab-service-type '())
           (session-environment-service
            (operating-system-environment-variables os))
           host-name procs root-fs unmount
           (service setuid-program-service-type
                    (operating-system-setuid-programs os))
           (service profile-service-type
                    (operating-system-packages os))
           (append other-fs mappings swaps

                   ;; Add the firmware service, unless we are building for a
                   ;; container.
                   (if container?
                       '()
                       (list %linux-bare-metal-service
                             (service firmware-service-type
                                      (operating-system-firmware os))))))))

(define* (operating-system-services os #:key container?)
  "Return all the services of OS, including \"internal\" services that do not
explicitly appear in OS."
  (append (operating-system-user-services os)
          (essential-services os #:container? container?)))

\f
;;;
;;; /etc.
;;;

(define %base-firmware
  ;; Firmware usable by default.
  (list ath9k-htc-firmware))

(define %base-packages
  ;; Default set of packages globally visible.  It should include anything
  ;; required for basic administrator tasks.
  (cons* procps psmisc which less zile nano
         lsof                                 ;for Guix's 'list-runtime-roots'
         pciutils usbutils
         util-linux inetutils isc-dhcp

         ;; wireless-tools is deprecated in favor of iw, but it's still what
         ;; many people are familiar with, so keep it around.
         iw wireless-tools rfkill

         iproute
         net-tools                        ; XXX: remove when Inetutils suffices
         man-db
         info-reader                     ;the standalone Info reader (no Perl)

         ;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also
         ;; want the other commands and the man pages (notably because
         ;; auto-completion in Emacs shell relies on man pages.)
         sudo

         ;; Get 'insmod' & co. from kmod, not module-init-tools, since udev
         ;; already depends on it anyway.
         kmod eudev

         e2fsprogs kbd

         bash-completion

         ;; The packages below are also in %FINAL-INPUTS, so take them from
         ;; there to avoid duplication.
         (map canonical-package
              (list guile-2.0 bash coreutils findutils grep sed
                    diffutils patch gawk tar gzip bzip2 xz lzip))))

(define %default-issue
  ;; Default contents for /etc/issue.
  "
This is the GNU system.  Welcome.\n")

(define (local-host-aliases host-name)
  "Return aliases for HOST-NAME, to be used in /etc/hosts."
  (string-append "127.0.0.1 localhost " host-name "\n"
                 "::1       localhost " host-name "\n"))

(define (default-/etc/hosts host-name)
  "Return the default /etc/hosts file."
  (plain-file "hosts" (local-host-aliases host-name)))

(define* (operating-system-etc-service os)
  "Return a <service> that builds containing the static part of the /etc
directory."
  (let ((login.defs (plain-file "login.defs" "# Empty for now.\n"))

        (issue      (plain-file "issue" (operating-system-issue os)))
        (nsswitch   (plain-file "nsswitch.conf"
                                (name-service-switch->string
                                 (operating-system-name-service-switch os))))

        ;; Startup file for POSIX-compliant login shells, which set system-wide
        ;; environment variables.
        (profile    (mixed-text-file "profile"  "\
# Crucial variables that could be missing in the profiles' 'etc/profile'
# because they would require combining both profiles.
# FIXME: See <http://bugs.gnu.org/20255>.
export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg

# Ignore the default value of 'PATH'.
unset PATH

# Load the system profile's settings.
GUIX_PROFILE=/run/current-system/profile \\
. /run/current-system/profile/etc/profile

# Prepend setuid programs.
export PATH=/run/setuid-programs:$PATH

if [ -f \"$HOME/.guix-profile/etc/profile\" ]
then
  # Load the user profile's settings.
  GUIX_PROFILE=\"$HOME/.guix-profile\" \\
  . \"$HOME/.guix-profile/etc/profile\"
else
  # At least define this one so that basic things just work
  # when the user installs their first package.
  export PATH=\"$HOME/.guix-profile/bin:$PATH\"
fi

# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
# loaded when someone logs in via SSH.  See <http://bugs.gnu.org/22175>.
# We need 'PATH' to be defined here, for 'cat' and 'cut'.
if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
     -a -z \"$LINUX_MODULE_DIRECTORY\" ]
then
  . /etc/environment
  export `cat /etc/environment | cut -d= -f1`
fi

# Set the umask, notably for users logging in via 'lsh'.
# See <http://bugs.gnu.org/22650>.
umask 022

# Allow GStreamer-based applications to find plugins.
export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"

if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
then
  # Load Bash-specific initialization code.
  . /etc/bashrc
fi
"))

        (bashrc    (plain-file "bashrc" "\
# Bash-specific initialization.

# The 'bash-completion' package.
if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
then
  # Bash-completion sources ~/.bash_completion.  It installs a dynamic
  # completion loader that searches its own completion files as well
  # as those in ~/.guix-profile and /run/current-system/profile.
  source /run/current-system/profile/etc/profile.d/bash_completion.sh
fi\n")))
    (etc-service
     `(("services" ,#~(string-append #$net-base "/etc/services"))
       ("protocols" ,#~(string-append #$net-base "/etc/protocols"))
       ("rpc" ,#~(string-append #$net-base "/etc/rpc"))
       ("login.defs" ,#~#$login.defs)
       ("issue" ,#~#$issue)
       ("nsswitch.conf" ,#~#$nsswitch)
       ("profile" ,#~#$profile)
       ("bashrc" ,#~#$bashrc)
       ("hosts" ,#~#$(or (operating-system-hosts-file os)
                         (default-/etc/hosts (operating-system-host-name os))))
       ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                      #$(operating-system-timezone os)))
       ("sudoers" ,(operating-system-sudoers-file os))))))

(define %root-account
  ;; Default root account.
  (user-account
   (name "root")
   (password "")
   (uid 0) (group "root")
   (comment "System administrator")
   (home-directory "/root")))

(define (operating-system-accounts os)
  "Return the user accounts for OS, including an obligatory 'root' account,
and excluding accounts requested by services."
  ;; Make sure there's a root account.
  (if (find (lambda (user)
              (and=> (user-account-uid user) zero?))
            (operating-system-users os))
      (operating-system-users os)
      (cons %root-account (operating-system-users os))))

(define (maybe-string->file file-name thing)
  "If THING is a string, return a <plain-file> with THING as its content.
Otherwise just return THING.

This is for backward-compatibility of fields that used to be strings and are
now file-like objects.."
  (match thing
    ((? string?)
     (warning (_ "using a string for file '~a' is deprecated; \
use 'plain-file' instead~%")
              file-name)
     (plain-file file-name thing))
    (x
     x)))

(define (maybe-file->monadic file-name thing)
  "If THING is a value in %STORE-MONAD, return it as is; otherwise return
THING in the %STORE-MONAD.

This is for backward-compatibility of fields that used to be monadic values
and are now file-like objects."
  (with-monad %store-monad
    (match thing
      ((? procedure?)
       (warning (_ "using a monadic value for '~a' is deprecated; \
use 'plain-file' instead~%")
                file-name)
       thing)
      (x
       (return x)))))

(define (operating-system-etc-directory os)
  "Return that static part of the /etc directory of OS."
  (etc-directory
   (fold-services (operating-system-services os)
                  #:target-type etc-service-type)))

(define (operating-system-environment-variables os)
  "Return the environment variables of OS for
@var{session-environment-service-type}, to be used in @file{/etc/environment}."
  `(("LANG" . ,(operating-system-locale os))
    ("TZ" . ,(operating-system-timezone os))
    ("TZDIR" . ,#~(string-append #$tzdata "/share/zoneinfo"))
    ;; Tell 'modprobe' & co. where to look for modules.
    ("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")
    ;; These variables are honored by OpenSSL (libssl) and Git.
    ("SSL_CERT_DIR" . "/etc/ssl/certs")
    ("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
    ("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")

    ;; 'GTK_DATA_PREFIX' must name one directory where GTK+ themes are
    ;; searched for.
    ("GTK_DATA_PREFIX" . "/run/current-system/profile")

    ;; By default, applications that use D-Bus, such as Emacs, abort at startup
    ;; when /etc/machine-id is missing.  Make sure these warnings are non-fatal.
    ("DBUS_FATAL_WARNINGS" . "0")))

(define %setuid-programs
  ;; Default set of setuid-root programs.
  (let ((shadow (@ (gnu packages admin) shadow)))
    (list #~(string-append #$shadow "/bin/passwd")
          #~(string-append #$shadow "/bin/su")
          #~(string-append #$inetutils "/bin/ping")
          #~(string-append #$inetutils "/bin/ping6")
          #~(string-append #$sudo "/bin/sudo")
          #~(string-append #$fuse "/bin/fusermount"))))

(define %sudoers-specification
  ;; Default /etc/sudoers contents: 'root' and all members of the 'wheel'
  ;; group can do anything.  See
  ;; <http://www.sudo.ws/sudo/man/1.8.10/sudoers.man.html>.
  ;; TODO: Add a declarative API.
  (plain-file "sudoers" "\
root ALL=(ALL) ALL
%wheel ALL=(ALL) ALL\n"))

(define* (operating-system-activation-script os #:key container?)
  "Return the activation script for OS---i.e., the code that \"activates\" the
stateful part of OS, including user accounts and groups, special directories,
etc."
  (let* ((services   (operating-system-services os #:container? container?))
         (activation (fold-services services
                                    #:target-type activation-service-type)))
    (activation-service->script activation)))

(define* (operating-system-boot-script os #:key container?)
  "Return the boot script for OS---i.e., the code started by the initrd once
we're running in the final root.  When CONTAINER? is true, skip all
hardware-related operations as necessary when booting a Linux container."
  (let* ((services (operating-system-services os #:container? container?))
         (boot     (fold-services services #:target-type boot-service-type)))
    ;; BOOT is the script as a monadic value.
    (service-parameters boot)))

(define (operating-system-user-accounts os)
  "Return the list of user accounts of OS."
  (let* ((services (operating-system-services os))
         (account  (fold-services services
                                  #:target-type account-service-type)))
    (filter user-account?
            (service-parameters account))))

(define (operating-system-shepherd-service-names os)
  "Return the list of Shepherd service names for OS."
  (append-map shepherd-service-provision
              (service-parameters
               (fold-services (operating-system-services os)
                              #:target-type
                              shepherd-root-service-type))))

(define* (operating-system-derivation os #:key container?)
  "Return a derivation that builds OS."
  (let* ((services (operating-system-services os #:container? container?))
         (system   (fold-services services)))
    ;; SYSTEM contains the derivation as a monadic value.
    (service-parameters system)))

(define* (operating-system-profile os #:key container?)
  "Return a derivation that builds the system profile of OS."
  (mlet* %store-monad
      ((services -> (operating-system-services os #:container? container?))
       (profile (fold-services services
                               #:target-type profile-service-type)))
    (match profile
      (("profile" profile)
       (return profile)))))

(define (operating-system-root-file-system os)
  "Return the root file system of OS."
  (find (match-lambda
         (($ <file-system> _ _ "/") #t)
         (_ #f))
        (operating-system-file-systems os)))

(define (operating-system-initrd-file os)
  "Return a gexp denoting the initrd file of OS."
  (define boot-file-systems
    (filter file-system-needed-for-boot?
            (operating-system-file-systems os)))

  (define mapped-devices
    (operating-system-boot-mapped-devices os))

  (define make-initrd
    (operating-system-initrd os))

  (mlet %store-monad ((initrd (make-initrd boot-file-systems
                                           #:linux (operating-system-kernel os)
                                           #:mapped-devices mapped-devices)))
    (return #~(string-append #$initrd "/initrd"))))

(define (locale-name->definition* name)
  "Variant of 'locale-name->definition' that raises an error upon failure."
  (match (locale-name->definition name)
    (#f
     (raise (condition
             (&message
              (message (format #f (_ "~a: invalid locale name") name))))))
    (def def)))

(define (operating-system-locale-directory os)
  "Return the directory containing the locales compiled for the definitions
listed in OS.  The C library expects to find it under
/run/current-system/locale."
  (define name
    (operating-system-locale os))

  (define definitions
    ;; While we're at it, check whether NAME is defined and add it if needed.
    (if (member name (map locale-definition-name
                          (operating-system-locale-definitions os)))
        (operating-system-locale-definitions os)
        (cons (locale-name->definition* name)
              (operating-system-locale-definitions os))))

  (locale-directory definitions
                    #:libcs (operating-system-locale-libcs os)))

(define (kernel->grub-label kernel)
  "Return a label for the GRUB menu entry that boots KERNEL."
  (string-append "GNU with "
                 (string-titlecase (package-name kernel)) " "
                 (package-version kernel)
                 " (beta)"))

(define (store-file-system file-systems)
  "Return the file system object among FILE-SYSTEMS that contains the store."
  (match (filter (lambda (fs)
                   (and (file-system-mount? fs)
                        (not (memq 'bind-mount (file-system-flags fs)))
                        (string-prefix? (file-system-mount-point fs)
                                        (%store-prefix))))
                 file-systems)
    ((and candidates (head . tail))
     (reduce (lambda (fs1 fs2)
               (if (> (string-length (file-system-mount-point fs1))
                      (string-length (file-system-mount-point fs2)))
                   fs1
                   fs2))
             head
             candidates))))

(define (operating-system-store-file-system os)
  "Return the file system that contains the store of OS."
  (store-file-system (operating-system-file-systems os)))

(define (bootloader-configuration-device bootloader-configuration)
    (match bootloader-configuration
      ((? grub-configuration? config)
       (grub-configuration-device config))
      ((? u-boot-configuration? config)
       (u-boot-configuration-device config))))

(define* (operating-system-bootloader-configuration-file os #:optional (old-entries '()))
  "Return the bootloader configuration file for OS.  Use OLD-ENTRIES to populate the
\"old entries\" menu."
  (mlet* %store-monad
      ((system      (operating-system-derivation os))
       (root-fs ->  (operating-system-root-file-system os))
       (store-fs -> (operating-system-store-file-system os))
       (kernel ->   (operating-system-kernel os))
       (root-device -> (if (eq? 'uuid (file-system-title root-fs))
                           (uuid->string (file-system-device root-fs))
                           (file-system-device root-fs)))
       (entries ->  (list (menu-entry
                           (label (kernel->grub-label kernel))
                           (linux kernel)
                           (linux-arguments
                            (cons* (string-append "--root=" root-device)
                                   #~(string-append "--system=" #$system)
                                   #~(string-append "--load=" #$system
                                                    "/boot")
                                   (operating-system-kernel-arguments os)))
                           (initrd #~(string-append #$system "/initrd"))))))
    (match (operating-system-bootloader os)
      ((? grub-configuration? config)
       (grub-configuration-file config
                                 store-fs entries
                                 #:old-entries old-entries))
      ((? u-boot-configuration? config)
       (u-boot-configuration-file config
                                 store-fs entries
                                 #:old-entries old-entries)))))

(define (operating-system-parameters-file os)
  "Return a file that describes the boot parameters of OS.  The primary use of
this file is the reconstruction of bootloader menu entries for old configurations."
  (mlet %store-monad ((initrd   (operating-system-initrd-file os))
                      (root ->  (operating-system-root-file-system os))
                      (label -> (kernel->grub-label
                                 (operating-system-kernel os))))
    (gexp->file "parameters"
                #~(boot-parameters (version 0)
                                   (label #$label)
                                   (root-device #$(file-system-device root))
                                   (kernel #$(operating-system-kernel os))
                                   (kernel-arguments
                                    #$(operating-system-kernel-arguments os))
                                   (initrd #$initrd))
                #:set-load-path? #f)))

\f
;;;
;;; Boot parameters
;;;

(define-record-type* <boot-parameters>
  boot-parameters make-boot-parameters boot-parameters?
  (label            boot-parameters-label)
  (root-device      boot-parameters-root-device)
  (kernel           boot-parameters-kernel)
  (kernel-arguments boot-parameters-kernel-arguments))

(define (read-boot-parameters port)
  "Read boot parameters from PORT and return the corresponding
<boot-parameters> object or #f if the format is unrecognized."
  (match (read port)
    (('boot-parameters ('version 0)
                       ('label label) ('root-device root)
                       ('kernel linux)
                       rest ...)
     (boot-parameters
      (label label)
      (root-device root)
      (kernel linux)
      (kernel-arguments
       (match (assq 'kernel-arguments rest)
         ((_ args) args)
         (#f       '())))))                       ;the old format
    (x                                            ;unsupported format
     (warning (_ "unrecognized boot parameters for '~a'~%")
              system)
     #f)))

;;; system.scm ends here

[-- Attachment #3: system.patch --]
[-- Type: text/x-patch, Size: 3623 bytes --]

diff --git a/gnu/system.scm b/gnu/system.scm
index 476720b..874be43 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -47,6 +47,7 @@
   #:use-module (gnu services shepherd)
   #:use-module (gnu services base)
   #:use-module (gnu system grub)
+  #:use-module (gnu system u-boot)
   #:use-module (gnu system shadow)
   #:use-module (gnu system nss)
   #:use-module (gnu system locale)
@@ -89,11 +90,13 @@
 
             operating-system-derivation
             operating-system-profile
-            operating-system-grub.cfg
+            operating-system-bootloader-configuration-file
             operating-system-etc-directory
             operating-system-locale-directory
             operating-system-boot-script
 
+            bootloader-configuration-device
+
             boot-parameters
             boot-parameters?
             boot-parameters-label
@@ -122,7 +125,7 @@
           (default linux-libre))
   (kernel-arguments operating-system-kernel-arguments
                     (default '()))                ; list of gexps/strings
-  (bootloader operating-system-bootloader)        ; <grub-configuration>
+  (bootloader operating-system-bootloader)        ; <grub-configuration> or <u-boot-configuration>
 
   (initrd operating-system-initrd                 ; (list fs) -> M derivation
           (default base-initrd))
@@ -695,8 +698,15 @@ listed in OS.  The C library expects to find it under
   "Return the file system that contains the store of OS."
   (store-file-system (operating-system-file-systems os)))
 
-(define* (operating-system-grub.cfg os #:optional (old-entries '()))
-  "Return the GRUB configuration file for OS.  Use OLD-ENTRIES to populate the
+(define (bootloader-configuration-device bootloader-configuration)
+    (match bootloader-configuration
+      ((? grub-configuration? config)
+       (grub-configuration-device config))
+      ((? u-boot-configuration? config)
+       (u-boot-configuration-device config))))
+
+(define* (operating-system-bootloader-configuration-file os #:optional (old-entries '()))
+  "Return the bootloader configuration file for OS.  Use OLD-ENTRIES to populate the
 \"old entries\" menu."
   (mlet* %store-monad
       ((system      (operating-system-derivation os))
@@ -716,13 +726,19 @@ listed in OS.  The C library expects to find it under
                                                     "/boot")
                                    (operating-system-kernel-arguments os)))
                            (initrd #~(string-append #$system "/initrd"))))))
-    (grub-configuration-file (operating-system-bootloader os)
-                             store-fs entries
-                             #:old-entries old-entries)))
+    (match (operating-system-bootloader os)
+      ((? grub-configuration? config)
+       (grub-configuration-file config
+                                 store-fs entries
+                                 #:old-entries old-entries))
+      ((? u-boot-configuration? config)
+       (u-boot-configuration-file config
+                                 store-fs entries
+                                 #:old-entries old-entries)))))
 
 (define (operating-system-parameters-file os)
   "Return a file that describes the boot parameters of OS.  The primary use of
-this file is the reconstruction of GRUB menu entries for old configurations."
+this file is the reconstruction of bootloader menu entries for old configurations."
   (mlet %store-monad ((initrd   (operating-system-initrd-file os))
                       (root ->  (operating-system-root-file-system os))
                       (label -> (kernel->grub-label

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 17:20                           ` Danny Milosavljevic
@ 2016-08-29 17:52                             ` Danny Milosavljevic
  2016-08-29 18:10                               ` Danny Milosavljevic
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 17:52 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

> >   (bootloader (u-boot-configuration
> >                (board "vexpress_ca9x4")
> >                (device "/dev/sdX")
> >                (u-boot armhf-linux-uboot)))  

Note: It should infer the correct u-boot to use on its own - at least that's the intention with the whole make-u-boot-package thing.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 17:52                             ` Danny Milosavljevic
@ 2016-08-29 18:10                               ` Danny Milosavljevic
  0 siblings, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 18:10 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 19:52:23 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> > >   (bootloader (u-boot-configuration
> > >                (board "vexpress_ca9x4")
> > >                (device "/dev/sdX")
> > >                (u-boot armhf-linux-uboot)))    
> 
> Note: It should infer the correct u-boot to use on its own - at least that's the intention with the whole make-u-boot-package thing.

Aaaand... this part is not implemented yet because I can't find in which package gnu/build/install.scm's install-grub finds the executable "grub-install" that it invokes (and how it finds it at all O_o).

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 16:51                         ` David Craven
  2016-08-29 17:20                           ` Danny Milosavljevic
  2016-08-29 17:38                           ` Danny Milosavljevic
@ 2016-08-29 18:16                           ` Danny Milosavljevic
  2016-08-29 18:20                             ` David Craven
  2 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 18:16 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

If I forgot any other things, see my working copy http://www.scratchpost.org/software/Guix/guix.tar.gz - warning: there be dragons.

The existing files that I touched for U-Boot are:

./gnu/build/vm.scm ; initialize-hard-disk has a key #:grub.cfg
./gnu/build/install.scm ; actual invocation of grub-install is here
./gnu/system/vm.scm ; qemu-image has a key #:grub-configuration; source file hardcodes grub package (?)
./gnu/system/install.scm ; references grub package "mostly so xrefs to its manual work"
./gnu/system.scm ; needs to be adapted
./guix/scripts/system.scm ; install-grub* needs to be generalized
./gnu.scm ; %public-modules grub for grub-configuration

Probably not:

./tests/system.scm ; harmless, just uses grub-configuration
./build-aux/hydra/demo-os.scm ; harmless, just uses grub-configuration

And the new files are called u-boot*

I also did this - although usually I'm against magically appearing symbols:

diff --git a/gnu.scm b/gnu.scm
index 932e4cd..9207e38 100644
--- a/gnu.scm
+++ b/gnu.scm
@@ -35,6 +35,7 @@
         (gnu system mapped-devices)
         (gnu system file-systems)
         (gnu system grub)                         ; 'grub-configuration'
+        (gnu system u-boot)                       ; 'u-boot-configuration'
         (gnu system pam)
         (gnu system shadow)                       ; 'user-account'
         (gnu system linux-initrd)

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 18:16                           ` Danny Milosavljevic
@ 2016-08-29 18:20                             ` David Craven
  2016-08-29 18:56                               ` David Craven
  2016-08-29 18:57                               ` How does install-grub work? Danny Milosavljevic
  0 siblings, 2 replies; 69+ messages in thread
From: David Craven @ 2016-08-29 18:20 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

> Note: It should infer the correct u-boot to use on its own - at least that's the intention with the whole make-u-boot-package thing.

Did you see the updated u-boot patch? It includes support for
cross-compilation, so make-u-boot-package takes a xgcc package and a
target triplet as arguments. So it probably broke the inference.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 18:20                             ` David Craven
@ 2016-08-29 18:56                               ` David Craven
  2016-08-29 19:04                                 ` Danny Milosavljevic
  2016-08-29 18:57                               ` How does install-grub work? Danny Milosavljevic
  1 sibling, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 18:56 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

FYI your editor is using dos style /n/r newlines. Don't know if that
is your intention. Are you on windows? O.O xD

On Mon, Aug 29, 2016 at 8:20 PM, David Craven <david@craven.ch> wrote:
>> Note: It should infer the correct u-boot to use on its own - at least that's the intention with the whole make-u-boot-package thing.
>
> Did you see the updated u-boot patch? It includes support for
> cross-compilation, so make-u-boot-package takes a xgcc package and a
> target triplet as arguments. So it probably broke the inference.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* How does install-grub work?
  2016-08-29 18:20                             ` David Craven
  2016-08-29 18:56                               ` David Craven
@ 2016-08-29 18:57                               ` Danny Milosavljevic
  2016-08-29 20:29                                 ` David Craven
  1 sibling, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 18:57 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 20:20:30 +0200
David Craven <david@craven.ch> wrote:

> > Note: It should infer the correct u-boot to use on its own - at least that's the intention with the whole make-u-boot-package thing.  
> 
> Did you see the updated u-boot patch? It includes support for
> cross-compilation,

Nice!

> so make-u-boot-package takes a xgcc package and a
> target triplet as arguments. So it probably broke the inference.

No, I think I didn't make it work yet.

I've modeled along the lines of what was already there for Grub. But I've got no idea where gnu/build/install.scm's install-grub finds "grub-install" - so the u-boot part doesn't work either since I don't know where to put the package reference in the first place (or how in the world it works for Grub to begin with).

Also, there's a few mysterious things with install-grub.

For example the documentation in the function header there says

  "Install Grub with GRUB.CFG on DEVICE, which is assumed to be
mounted on MOUNT-POINT."

I really doubt that it actually does what it says since usually grub is installed on the drive MBR and not inside a partition. And MOUNT-POINT is a mounted filesystem on a partition, right? So the whole drive is certainly not mounted at MOUNT-POINT.

MOUNT-POINT originally comes from guix/scripts/system.scm - process-action. And that is called by process-command. And that is called by guix-system which is used when invoking "guix system" "reconfigure". But I've never specified a mountpoint when invoking that...

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: Guix with U-Boot
  2016-08-29 18:56                               ` David Craven
@ 2016-08-29 19:04                                 ` Danny Milosavljevic
  0 siblings, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 19:04 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 20:56:53 +0200
David Craven <david@craven.ch> wrote:

> FYI your editor is using dos style /n/r newlines. Don't know if that
> is your intention. Are you on windows? O.O xD

Thanks for the heads-up!

No, it's nano on GuixSD. (Guile emacs on Guix broke a long time ago and while there was a workaround - that broke by now, too)

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 18:57                               ` How does install-grub work? Danny Milosavljevic
@ 2016-08-29 20:29                                 ` David Craven
  2016-08-29 20:50                                   ` Danny Milosavljevic
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 20:29 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

I have some questions too... So for booting a vm we don't actually
need a boot loader, since it passes the kernel image through the
-kernel flag. I don't think it's relevant that grub is installed in
the MBR. So getting guix system vm --system=armhf-linux to boot
doesn't actually require uboot... It just needs to make sure that grub
isn't pulled in as a dependency (since there isn't a substitute for
grub on arm/mips).

@Danny: Did you write install-uboot.c? I don't have a clue what it's
doing =P I don't really know anything about filesystems or
bootloaders...

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 20:29                                 ` David Craven
@ 2016-08-29 20:50                                   ` Danny Milosavljevic
  2016-08-29 20:54                                     ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 20:50 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 22:29:40 +0200
David Craven <david@craven.ch> wrote:

>So for booting a vm we don't actually need a boot loader, since it passes the kernel image through the -kernel flag. 

Huh, that appears to be the case. Back when I used VMs the first time they simulated the entire PC, BIOS and all and there you would need the partition table, bootloader etc just as you would on a real PC. But it seems to have changed now...

> @Danny: Did you write install-uboot.c? I don't have a clue what it's
> doing =P

Yes, I wrote it. It makes sure it's safe to write to an unclaimed fixed-position section of a drive and then writes to it.

Essentially it does

$ dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8 
        ^^^                                                ^^^
        depends on board                                   depends on board

but only after making sure that this doesn't clobber anything (payload data on parititons, the partition table etcetc).

It's supposed to be analogous to grub-install, just for u-boot.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 20:50                                   ` Danny Milosavljevic
@ 2016-08-29 20:54                                     ` David Craven
  2016-08-29 21:19                                       ` David Craven
  2016-08-29 21:45                                       ` Danny Milosavljevic
  0 siblings, 2 replies; 69+ messages in thread
From: David Craven @ 2016-08-29 20:54 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

>>So for booting a vm we don't actually need a boot loader, since it passes the kernel image through the -kernel flag.
>
> Huh, that appears to be the case. Back when I used VMs the first time they simulated the entire PC, BIOS and all and there you would need the partition table, bootloader etc just as you would on a real PC. But it seems to have changed now...

Does the u-boot bootloader routine have to do anything other than
generating the extlinux.conf file? That would be enough so that there
is an alternative to grub-install for the qemu use case and for actual
boards, isn't uboot usually written to flash instead of to a MBR?

> Yes, I wrote it. It makes sure it's safe to write to an unclaimed fixed-position section of a drive and then writes to it.
>
> Essentially it does
>
> $ dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
>         ^^^                                                ^^^
>         depends on board                                   depends on board
>
> but only after making sure that this doesn't clobber anything (payload data on parititons, the partition table etcetc).
>
> It's supposed to be analogous to grub-install, just for u-boot.

Nice!

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 20:54                                     ` David Craven
@ 2016-08-29 21:19                                       ` David Craven
  2016-08-29 21:57                                         ` Danny Milosavljevic
  2016-08-29 21:45                                       ` Danny Milosavljevic
  1 sibling, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 21:19 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

> Does the u-boot bootloader routine have to do anything other than
> generating the extlinux.conf file? That would be enough so that there
> is an alternative to grub-install for the qemu use case and for actual
> boards, isn't uboot usually written to flash instead of to a MBR?

So I'd say the next steps are:

1. Pick out your changes that are related to renaming grub to
bootloader and add a shim for the uboot parts. That should be enough
to get vm's booting.

2. Add your extlinux.conf generation/install code.

3. We can still add an install uboot to MBR procedure if it's necessary.

This would break the changes down into easy to review patches and subgoals...

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 20:54                                     ` David Craven
  2016-08-29 21:19                                       ` David Craven
@ 2016-08-29 21:45                                       ` Danny Milosavljevic
  2016-08-29 22:04                                         ` Danny Milosavljevic
  1 sibling, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 21:45 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, 29 Aug 2016 22:54:27 +0200
David Craven <david@craven.ch> wrote:

> for actual boards, isn't uboot usually written to flash instead of to a MBR?

That depends on the board - sometimes it's written to flash.

For Allwinner hardware, it's written to a fixed section (fixed sectors) on either a SD card or NAND flash or eMMC. It's not in the MBR but after it and before the first partition.

Many pieces of hardware have U-Boot as something like a BIOS - it's not meant to be updated. And if you do want to update it, you go to the U-Boot prompt and update it from within itself.

I think that's why the extlinux.conf exists in the first place - you just put it somewhere where the [potentially immutable forever] U-Boot can find it and it will pick it up (at least when the partition is marked Active).

Interestingly enough, the situation is similar with Libreboot and its integrated Grub. That's why I added comment in the source code that asks whether it makes sense to seperate the config storing part from the bootloader installation part - the latter can be unnecessary while the former can be very necessary at the same time.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 21:19                                       ` David Craven
@ 2016-08-29 21:57                                         ` Danny Milosavljevic
  2016-08-29 22:00                                           ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 21:57 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

Hi,

On Mon, 29 Aug 2016 23:19:30 +0200
David Craven <david@craven.ch> wrote:

> So I'd say the next steps are:
> 
> 1. Pick out your changes that are related to renaming grub to
> bootloader and add a shim for the uboot parts. That should be enough
> to get vm's booting.

Yes. Note that Ludo said that it might make sense to separate the build side (gnu/build/install.scm and gnu/build/vm.sc) from the host side (other stuff) also for the patches.

> 2. Add your extlinux.conf generation/install code.

Yes. This one is the most important part.

On the other hand, Part 3 below is actually not that important even for actual ARM hardware. Usually U-Boot is there when you buy it anyway - usually there's no need to fiddle with it directly.

> 3. We can still add an install uboot to MBR procedure if it's necessary.

Sometimes MBR, sometimes random location in the middle of nowhere with a magical sector number.

There's still a "FIXME" in gnu/build/install.scm install-bootloader about how to detect on the build side which bootloader to use and then call either install-grub or install-u-boot. I don't know how to do that. I've asked before about whether it's (1) possible and (2) desireable to just compare the config-filename to "extlinux.conf" and hardcode u-boot then. But *which* u-boot package does it use? How would it know?

This is a very important part that is both missing and necessary - and I've not found an answer to that so far.

> This would break the changes down into easy to review patches and subgoals...

Yes, I agree that that would be good.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 21:57                                         ` Danny Milosavljevic
@ 2016-08-29 22:00                                           ` David Craven
  2016-08-29 22:14                                             ` Danny Milosavljevic
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-08-29 22:00 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

>> 1. Pick out your changes that are related to renaming grub to
>> bootloader and add a shim for the uboot parts. That should be enough
>> to get vm's booting.

> Yes. Note that Ludo said that it might make sense to separate the build side (gnu/build/install.scm and gnu/build/vm.sc) from the host side (other stuff) also for the patches.

So do you want me to take a stab at it or do you want to do it? =)

For parts two and three I'd have to rely on you, since I don't have
access to hardware to actually test it...

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 21:45                                       ` Danny Milosavljevic
@ 2016-08-29 22:04                                         ` Danny Milosavljevic
  0 siblings, 0 replies; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 22:04 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

Before I forget it again - maybe it makes sense to always generate and install both the U-Boot and the Grub configuration file. While the bootloaders are [probably] mutually exclusive, I don't think that the config files are!

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 22:00                                           ` David Craven
@ 2016-08-29 22:14                                             ` Danny Milosavljevic
  2016-08-30 15:33                                               ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Danny Milosavljevic @ 2016-08-29 22:14 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Tue, 30 Aug 2016 00:00:35 +0200
David Craven <david@craven.ch> wrote:

> >> 1. Pick out your changes that are related to renaming grub to
> >> bootloader and add a shim for the uboot parts. That should be enough
> >> to get vm's booting.  
> 
> > Yes. Note that Ludo said that it might make sense to separate the build side (gnu/build/install.scm and gnu/build/vm.sc) from the host side (other stuff) also for the patches.  
> 
> So do you want me to take a stab at it or do you want to do it? =)

If possible, it would be great if you took care about the first part. I've done all that I know how to do there and I think it should be mostly fine already. Also, most of the renaming should be straightforward anyway. Looking back, maybe I *shouldn't* have renamed anything - it's just cosmetic and makes the patch look scary :)

The functionally important parts are the build-side procedure (install-u-boot), the config data objects (u-boot-configuration) and the selection logic in gnu/system.scm (*bootloader-configuration-*). It's actually no big deal.

> For parts two and three I'd have to rely on you, since I don't have
> access to hardware to actually test it...

No problem. I have 3 ARM boards here that I can test it on. They are quite slow - so testing means ~ 3 days of waiting-for-it-to-finish-compiling. But I don't have to sit next to it and wait :)

I do think that the extlinux.conf generation is finished as well. I will test it, though.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: How does install-grub work?
  2016-08-29 22:14                                             ` Danny Milosavljevic
@ 2016-08-30 15:33                                               ` David Craven
  0 siblings, 0 replies; 69+ messages in thread
From: David Craven @ 2016-08-30 15:33 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

I'm making some progress. The culprit for the grub error was:

(let ((inputs
-                '#$(append (list qemu parted grub e2fsprogs)
+                '#$(append (list qemu parted e2fsprogs)

There is more work involved than I thought. Support for
cross-compiling stuff like
/gnu/store/2z7jlxzhyll5i9imiizsyvfygsa88k55-activate-service.drv needs
to work somehow. That gets us at least guix system build working.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-08-27  8:31   ` David Craven
@ 2016-08-30 19:07     ` Eric Bavier
  2016-09-16  5:03       ` Eric Bavier
  0 siblings, 1 reply; 69+ messages in thread
From: Eric Bavier @ 2016-08-30 19:07 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Sat, 27 Aug 2016 10:31:44 +0200
David Craven <david@craven.ch> wrote:

> > Is the purpose of this patch to make importers return licenses with this
> > prefix or is there another use case?  
> 
> Yes that's the intention. I was only thinking about the python
> importer, but this will affect all importers.
> 

I don't think this needs to happen.  Whether or not the symbol in the
'license' field of a package needs the 'license:' prefix depends on
the module where the package definition is placed.  I'm not convinced
that globally applying the prefix is useful.

`~Eric

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-08-30 19:07     ` Eric Bavier
@ 2016-09-16  5:03       ` Eric Bavier
  2016-09-16  7:29         ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Eric Bavier @ 2016-09-16  5:03 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Tue, 30 Aug 2016 14:07:48 -0500
Eric Bavier <ericbavier@openmailbox.org> wrote:

> On Sat, 27 Aug 2016 10:31:44 +0200
> David Craven <david@craven.ch> wrote:
> 
> > > Is the purpose of this patch to make importers return licenses with this
> > > prefix or is there another use case?    
> > 
> > Yes that's the intention. I was only thinking about the python
> > importer, but this will affect all importers.
> >   
> 
> I don't think this needs to happen.  Whether or not the symbol in the
> 'license' field of a package needs the 'license:' prefix depends on
> the module where the package definition is placed.  I'm not convinced
> that globally applying the prefix is useful.

I just wanted to point out that this will not work for any cpan modules
that are destined for (gnu packages perl) if they don't use the Perl
license.

`~Eric

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-09-16  5:03       ` Eric Bavier
@ 2016-09-16  7:29         ` David Craven
  2016-09-16 15:40           ` Eric Bavier
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-09-16  7:29 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

> I just wanted to point out that this will not work for any cpan modules
> that are destined for (gnu packages perl) if they don't use the Perl
> license.

I think that gnu/packages/perl.scm should be updated to use the
license: prefix. I think that the importer should suggest a best
practice.

WDYT?

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-09-16  7:29         ` David Craven
@ 2016-09-16 15:40           ` Eric Bavier
  2016-09-16 15:47             ` David Craven
  0 siblings, 1 reply; 69+ messages in thread
From: Eric Bavier @ 2016-09-16 15:40 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On 2016-09-16 02:29, David Craven wrote:
>> I just wanted to point out that this will not work for any cpan 
>> modules
>> that are destined for (gnu packages perl) if they don't use the Perl
>> license.
> 
> I think that gnu/packages/perl.scm should be updated to use the
> license: prefix. I think that the importer should suggest a best
> practice.
> 
> WDYT?

AFAIK we haven't established module-level global symbol prefixing as 
best practice.  In gnu/packages/perl.scm it's unnecessary.

-- 
`~Eric

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-09-16 15:40           ` Eric Bavier
@ 2016-09-16 15:47             ` David Craven
  2016-09-16 17:02               ` Eric Bavier
  0 siblings, 1 reply; 69+ messages in thread
From: David Craven @ 2016-09-16 15:47 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

> AFAIK we haven't established module-level global symbol prefixing as best
> practice.  In gnu/packages/perl.scm it's unnecessary.

It's a fact that if we don't establish a best practice, the (generic)
importer code won't fit all importer implementations. Maybe you could
have been a bit more vocal about this at the time. Constructively -
what do you expect me to do about this?

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-09-16 15:47             ` David Craven
@ 2016-09-16 17:02               ` Eric Bavier
  2016-09-19 13:06                 ` Ludovic Courtès
  0 siblings, 1 reply; 69+ messages in thread
From: Eric Bavier @ 2016-09-16 17:02 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On 2016-09-16 10:47, David Craven wrote:
>> AFAIK we haven't established module-level global symbol prefixing as 
>> best
>> practice.  In gnu/packages/perl.scm it's unnecessary.
> 
> It's a fact that if we don't establish a best practice, the (generic)
> importer code won't fit all importer implementations. Maybe you could
> have been a bit more vocal about this at the time. Constructively -
> what do you expect me to do about this?

I'll correct myself now in my assertion that this change broke `guix 
import cpan`, which uses its own string->license procedure.  Indeed, 
apparently the only user of the string->license and license->symbol in 
(guix import utils) is the pypi importer.

My suggestion would be to move those procedures back into (guix import 
pypi).  I don't think they are as generic as their inclusion in (guix 
import utils) might suggest.  The strings they accept are specific to 
pypi.

Perhaps what might also be done is to clarify in the documentation that 
the importers are not meant to be "dumpers": their output is not 
intended to be dumped directly into package modules and pushed upstream, 
and that editing will most likely need to take place.  Maybe adding a 
'guix-import' command to guix.el could improve on this situation in 
particular, by using geiser to detect proper symbol prefixes, since it 
could have an understanding of what module the imported package is 
destined for.

-- 
`~Eric

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix.
  2016-09-16 17:02               ` Eric Bavier
@ 2016-09-19 13:06                 ` Ludovic Courtès
  0 siblings, 0 replies; 69+ messages in thread
From: Ludovic Courtès @ 2016-09-19 13:06 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

Hello!

Eric Bavier <ericbavier@openmailbox.org> skribis:

> My suggestion would be to move those procedures back into (guix import
> pypi).  I don't think they are as generic as their inclusion in (guix
> import utils) might suggest.  The strings they accept are specific to
> pypi.

I’m late, but I agree.  Different repos (PyPI, CPAN, etc.) use different
strings to denote licenses—similar but subtly different.  So we should
probably not try to factorize too much here.

> Perhaps what might also be done is to clarify in the documentation
> that the importers are not meant to be "dumpers": their output is not
> intended to be dumped directly into package modules and pushed
> upstream, and that editing will most likely need to take place.  Maybe
> adding a 'guix-import' command to guix.el could improve on this
> situation in particular, by using geiser to detect proper symbol
> prefixes, since it could have an understanding of what module the
> imported package is destined for.

Yeah.  It already says that the output “is a package definition, or a
template thereof”, which should be good enough, no?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH 04/11] gnu: Add python-nltk.
  2016-08-22 13:20           ` [PATCH 04/11] gnu: Add python-nltk David Craven
  2016-08-27  8:39             ` Danny Milosavljevic
@ 2016-10-24 21:15             ` Leo Famulari
  1 sibling, 0 replies; 69+ messages in thread
From: Leo Famulari @ 2016-10-24 21:15 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

On Mon, Aug 22, 2016 at 03:20:11PM +0200, David Craven wrote:
> * gnu/packages/python.scm (python-nltk): New variable.
> (python2-nltk): New variable.

This is failing its test suite on core-updates:

https://hydra.gnu.org/build/1550846

Apparently it wants some extra data to run the tests:

  Resource 'corpora/gutenberg' not found.  Please use the NLTK
  Downloader to obtain the resource:  >>> nltk.download()
  Searched in:
    - '/homeless-shelter/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'

^ permalink raw reply	[flat|nested] 69+ messages in thread

end of thread, other threads:[~2016-10-24 21:15 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 18:37 [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
2016-08-05 18:37 ` [PATCH 03/12] gnu: python: Import guix licenses with #:prefix license: David Craven
2016-08-05 18:37 ` [PATCH 04/12] gnu: python: Add python-binaryornot David Craven
2016-08-08 20:37   ` Leo Famulari
2016-08-22 12:05     ` David Craven
2016-08-22 12:14       ` David Craven
2016-08-22 13:20         ` [PATCH 01/11] import: utils: Symbols from 'license->symbol' have a license: prefix David Craven
2016-08-22 13:20           ` [PATCH 02/11] gnu: python: Import guix licenses with #:prefix license: David Craven
2016-08-26 20:55             ` David Craven
2016-08-22 13:20           ` [PATCH 03/11] gnu: Add python-binaryornot David Craven
2016-08-22 13:20           ` [PATCH 04/11] gnu: Add python-nltk David Craven
2016-08-27  8:39             ` Danny Milosavljevic
2016-10-24 21:15             ` Leo Famulari
2016-08-22 13:20           ` [PATCH 05/11] gnu: Add python-pymongo David Craven
2016-08-22 13:20           ` [PATCH 06/11] gnu: Add python-sh David Craven
2016-08-27  8:42             ` Danny Milosavljevic
2016-08-28 12:28               ` David Craven
2016-08-29 10:31                 ` Guix with U-Boot Danny Milosavljevic
2016-08-29 11:25                   ` David Craven
2016-08-29 14:12                     ` David Craven
2016-08-29 14:19                       ` Danny Milosavljevic
2016-08-29 16:51                         ` David Craven
2016-08-29 17:20                           ` Danny Milosavljevic
2016-08-29 17:52                             ` Danny Milosavljevic
2016-08-29 18:10                               ` Danny Milosavljevic
2016-08-29 17:38                           ` Danny Milosavljevic
2016-08-29 18:16                           ` Danny Milosavljevic
2016-08-29 18:20                             ` David Craven
2016-08-29 18:56                               ` David Craven
2016-08-29 19:04                                 ` Danny Milosavljevic
2016-08-29 18:57                               ` How does install-grub work? Danny Milosavljevic
2016-08-29 20:29                                 ` David Craven
2016-08-29 20:50                                   ` Danny Milosavljevic
2016-08-29 20:54                                     ` David Craven
2016-08-29 21:19                                       ` David Craven
2016-08-29 21:57                                         ` Danny Milosavljevic
2016-08-29 22:00                                           ` David Craven
2016-08-29 22:14                                             ` Danny Milosavljevic
2016-08-30 15:33                                               ` David Craven
2016-08-29 21:45                                       ` Danny Milosavljevic
2016-08-29 22:04                                         ` Danny Milosavljevic
2016-08-22 13:20           ` [PATCH 07/11] gnu: Add python-schematics David Craven
2016-08-22 13:20           ` [PATCH 08/11] gnu: Add python-publicsuffix David Craven
2016-08-22 13:20           ` [PATCH 09/11] gnu: Add python-publicsuffix2 David Craven
2016-08-22 13:20           ` [PATCH 10/11] gnu: Add python-url David Craven
2016-08-22 13:20           ` [PATCH 11/11] gnu: Add python-ipaddress David Craven
2016-08-05 18:37 ` [PATCH 05/12] gnu: python: Add python-nltk David Craven
2016-08-05 18:37 ` [PATCH 06/12] gnu: python: Add python-pymongo David Craven
2016-08-08 20:36   ` Leo Famulari
2016-08-08 20:39     ` Leo Famulari
2016-08-05 18:37 ` [PATCH 07/12] gnu: python: Add python-sh David Craven
2016-08-05 18:37 ` [PATCH 08/12] gnu: python: Add python-schematics David Craven
2016-08-05 18:37 ` [PATCH 09/12] gnu: python: Add python-publicsuffix David Craven
2016-08-05 18:37 ` [PATCH 10/12] gnu: python: Add python-publicsuffix2 David Craven
2016-08-05 18:37 ` [PATCH 11/12] gnu: python: Add python-url David Craven
2016-08-05 18:37 ` [PATCH 12/12] gnu: python: Add python-ipaddress David Craven
2016-08-05 18:50   ` Leo Famulari
2016-08-06 12:52     ` David Craven
2016-08-06 15:57       ` Danny Milosavljevic
2016-08-07  0:20       ` Leo Famulari
2016-08-27  6:43 ` [PATCH 02/12] import: utils: Symbols from 'license->symbol' have a license: prefix Ricardo Wurmus
2016-08-27  8:31   ` David Craven
2016-08-30 19:07     ` Eric Bavier
2016-09-16  5:03       ` Eric Bavier
2016-09-16  7:29         ` David Craven
2016-09-16 15:40           ` Eric Bavier
2016-09-16 15:47             ` David Craven
2016-09-16 17:02               ` Eric Bavier
2016-09-19 13:06                 ` Ludovic Courtès

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).