diff mbox

WIP Java certificates

Message ID 87k2hpgz18.fsf@gnu.org
State New
Headers show

Commit Message

Ludovic Courtès June 16, 2016, 11:21 a.m. UTC
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> As soon as I add
>
>      #:use-module (gnu packages certs)
>
> to the module definition of “(gnu packages java)” Guix complains with
> errors that are usually indicative of a module loop.  Attached is a
> patch to master.
>
> Here are the errors I get when trying to build the package:
>
> ~~~~~~~~~~~~~~~~~~~~~~~
> ./pre-inst-env guix build java-nss-certs-keystore
> guix build: warning: failed to load '(gnu packages abiword)':
> ERROR: In procedure module-lookup: Unbound variable: nss
> guix build: warning: failed to load '(gnu packages avr)':
> ERROR: In procedure module-lookup: Unbound variable: gnu-make
> guix build: warning: failed to load '(gnu packages bioinformatics)':
> ERROR: In procedure module-lookup: Unbound variable: perl-libwww
> guix build: warning: failed to load '(gnu packages make-bootstrap)':
> ERROR: no binding `%final-inputs' in module (gnu packages commencement)
> guix build: warning: failed to load '(gnu packages mate)':
> ERROR: In procedure module-lookup: Unbound variable: gtk+
> guix build: warning: failed to load '(gnu packages unrtf)':
> ERROR: In procedure module-lookup: Unbound variable: coreutils
> guix build: error: java-nss-certs-keystore: unknown package
> ~~~~~~~~~~~~~~~~~~~~~~~

First, a debugging trick:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guile
GNU Guile 2.0.11.156-c3f95-dirty
Copyright (C) 1995-2016 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (load "gnu/packages/abiword.scm")
gnu/packages/certs.scm:75:10: In procedure #<procedure 3dc3ea0 ()>:
gnu/packages/certs.scm:75:10: In procedure module-lookup: Unbound variable: nss

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(gnu packages certs) [1]> ,bt
In ice-9/boot-9.scm:
   2401:4417 (save-module-excursion #<procedure 29b0680 at ice-9/boot-9.scm:4045:3 ()>)
   4052:9416 (#<procedure 29b0680 at ice-9/boot-9.scm:4045:3 ()>)
In unknown file:
         415 (load-compiled/vm "/home/ludo/src/guix/gnu/packages/abiword.go")
In gnu/packages/abiword.scm:
     20:0414 (#<procedure 28ef240 ()>)
In ice-9/boot-9.scm:
   2951:4413 (define-module* (gnu packages abiword) #:filename "gnu/packages/abiword.scm" #:pure #f #:version #f …)

[...]

In unknown file:
          64 (primitive-load-path "gnu/packages/gnuzilla" #<procedure 3b232c0 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/gnuzilla.scm:
     23:0 63 (#<procedure 3b402e0 ()>)
In ice-9/boot-9.scm:
   2951:4 62 (define-module* (gnu packages gnuzilla) #:filename "gnu/packages/gnuzilla.scm" #:pure #f #:version # …)
  2926:10 61 (resolve-imports (((srfi srfi-1) #:hide (zip)) ((gnu packages)) ((guix licenses) #:prefix #) ((…)) …))
   2864:2 60 (resolve-interface (gnu packages gstreamer) #:select #f #:hide #<variable 3b57280 value: ()> # #f # …)
  2789:10 59 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 58 (try-module-autoload (gnu packages gstreamer) #f)
   2401:4 57 (save-module-excursion #<procedure 3b13270 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 56 (#<procedure 3b13270 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          55 (primitive-load-path "gnu/packages/gstreamer" #<procedure 3b593e0 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/gstreamer.scm:
     23:0 54 (#<procedure 3b65640 ()>)
In ice-9/boot-9.scm:
   2951:4 53 (define-module* (gnu packages gstreamer) #:filename "gnu/packages/gstreamer.scm" #:pure #f #:version …)
  2926:10 52 (resolve-imports (((guix licenses) #:select (lgpl2.0+ lgpl2.1+ bsd-2 bsd-3 gpl2+)) ((guix #)) (#) …))
   2864:2 51 (resolve-interface (gnu packages cdrom) #:select #f #:hide #<variable 3b661b0 value: ()> #:prefix #f …)
  2789:10 50 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 49 (try-module-autoload (gnu packages cdrom) #f)
   2401:4 48 (save-module-excursion #<procedure 3b20ea0 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 47 (#<procedure 3b20ea0 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          46 (primitive-load-path "gnu/packages/cdrom" #<procedure 3b68ae0 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/cdrom.scm:
     24:0 45 (#<procedure 3b75960 ()>)
In ice-9/boot-9.scm:
   2951:4 44 (define-module* (gnu packages cdrom) #:filename "gnu/packages/cdrom.scm" #:pure #f #:version #f # # …)
  2926:10 43 (resolve-imports (((guix download)) ((guix packages)) ((guix licenses) #:select (lgpl2.1+ # # …)) …))
   2864:2 42 (resolve-interface (gnu packages wget) #:select #f #:hide #<variable 3b96900 value: ()> #:prefix #f …)
  2789:10 41 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 40 (try-module-autoload (gnu packages wget) #f)
   2401:4 39 (save-module-excursion #<procedure 3b20600 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 38 (#<procedure 3b20600 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          37 (primitive-load-path "gnu/packages/wget" #<procedure 3b8c120 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/wget.scm:
     20:0 36 (#<procedure 3b95c20 ()>)
In ice-9/boot-9.scm:
   2951:4 35 (define-module* (gnu packages wget) #:filename "gnu/packages/wget.scm" #:pure #f #:version #f # () # …)
  2926:10 34 (resolve-imports (((guix licenses)) ((gnu packages libidn)) ((gnu packages python)) ((gnu # #)) # …))
   2864:2 33 (resolve-interface (gnu packages web) #:select #f #:hide #<variable 3b9c5e0 value: ()> #:prefix #f # …)
  2789:10 32 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 31 (try-module-autoload (gnu packages web) #f)
   2401:4 30 (save-module-excursion #<procedure 3b20480 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 29 (#<procedure 3b20480 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          28 (primitive-load-path "gnu/packages/web" #<procedure 3b95480 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/web.scm:
     32:0 27 (#<procedure 3c0d6e0 ()>)
In ice-9/boot-9.scm:
   2951:4 26 (define-module* (gnu packages web) #:filename "gnu/packages/web.scm" #:pure #f #:version #f # () # # …)
  2926:10 25 (resolve-imports (((ice-9 match)) ((guix licenses) #:prefix l:) ((guix packages)) ((guix #)) ((…)) …))
   2864:2 24 (resolve-interface (gnu packages statistics) #:select #f #:hide #<variable 3cb5c00 value: ()> # #f # …)
  2789:10 23 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 22 (try-module-autoload (gnu packages statistics) #f)
   2401:4 21 (save-module-excursion #<procedure 3c643f0 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 20 (#<procedure 3c643f0 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          19 (primitive-load-path "gnu/packages/statistics" #<procedure 3cb2120 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/statistics.scm:
     25:0 18 (#<procedure 3cdc940 ()>)
In ice-9/boot-9.scm:
   2951:4 17 (define-module* (gnu packages statistics) #:filename "gnu/packages/statistics.scm" #:pure #f # #f # …)
  2926:10 16 (resolve-imports (((guix licenses) #:prefix license:) ((guix packages)) ((guix download)) ((# #)) …))
   2864:2 15 (resolve-interface (gnu packages java) #:select #f #:hide #<variable 3405b40 value: ()> #:prefix #f …)
  2789:10 14 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16 13 (try-module-autoload (gnu packages java) #f)
   2401:4 12 (save-module-excursion #<procedure 33527e0 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22 11 (#<procedure 33527e0 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
          10 (primitive-load-path "gnu/packages/java" #<procedure 335d9e0 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/java.scm:
     21:0  9 (#<procedure 33f6800 ()>)
In ice-9/boot-9.scm:
   2951:4  8 (define-module* (gnu packages java) #:filename "gnu/packages/java.scm" #:pure #f #:version #f # () # …)
  2926:10  7 (resolve-imports (((guix licenses) #:prefix license:) ((gnu packages certs)) ((guix packages)) (#) …))
   2864:2  6 (resolve-interface (gnu packages certs) #:select #f #:hide #<variable 360cfe0 value: ()> #:prefix #f …)
  2789:10  5 (#<procedure 2214640 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> (…) …)
  3065:16  4 (try-module-autoload (gnu packages certs) #f)
   2401:4  3 (save-module-excursion #<procedure 3352300 at ice-9/boot-9.scm:3066:17 ()>)
  3085:22  2 (#<procedure 3352300 at ice-9/boot-9.scm:3066:17 ()>)
In unknown file:
           1 (primitive-load-path "gnu/packages/certs" #<procedure 3dc0660 at ice-9/boot-9.scm:3072:32 ()>)
In gnu/packages/certs.scm:
    75:10  0 (#<procedure 3dc3ea0 ()>)
scheme@(gnu packages certs) [1]> ,error
gnu/packages/certs.scm:75:10: In procedure #<procedure 3dc3ea0 ()>:
gnu/packages/certs.scm:75:10: In procedure module-lookup: Unbound variable: nss
--8<---------------cut here---------------end--------------->8---

The problem is that certs.scm references ‘nss’ from (gnu packages
gnuzilla) at the top level.

However, it turns out that adding this #:use-module line means that
gnuzilla.scm now indirectly depends on certs.scm.

When we load (gnu packages abiword), we end up loading gnuzilla.scm
first, which then loads certs.scm; however, at that point, ‘nss’ isn’t
bound yet in (gnu packages gnuzilla), hence the error.

The solution is to not do cross-reference top-level references.

That is, ‘nss-certs’ should be defined in the same module as ‘nss’, or
it could simply not inherit from ‘nss’, which is probably since it
doesn’t share much with ‘nss’ (patch below.)

Thoughts?

Obviously this circular dependency story is not as nice as we’d like to,
but that’s how Guile works currently.  In an ideal world, Guile would
not have to evaluate the whole module upfront when it loads it.

Thanks,
Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/certs.scm b/gnu/packages/certs.scm
index dd7d339..9967cd2 100644
--- a/gnu/packages/certs.scm
+++ b/gnu/packages/certs.scm
@@ -24,7 +24,6 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
-  #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages python)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages tls))
@@ -71,8 +70,20 @@ 
    (home-page "http://pkgs.fedoraproject.org/cgit/ca-certificates.git/")))
 
 (define-public nss-certs
-  (package (inherit nss) ; to reuse the source, version and some metadata
+  (package
     (name "nss-certs")
+    (version "3.23")
+    (source (origin
+              (method url-fetch)
+              (uri (let ((version-with-underscores
+                          (string-join (string-split version #\.) "_")))
+                     (string-append
+                      "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
+                      "releases/NSS_" version-with-underscores "_RTM/src/"
+                      "nss-" version ".tar.gz")))
+              (sha256
+               (base32
+                "1kqidv91icq96m9m8zx50n7px08km2l88458rkgyjwcn3kiq7cwl"))))
     (build-system gnu-build-system)
     (outputs '("out"))
     (native-inputs
@@ -124,4 +135,7 @@ 
     (synopsis "CA certificates from Mozilla")
     (description
       "This package provides certificates for Certification Authorities (CA)
-taken from the NSS package and thus ultimately from the Mozilla project.")))
+taken from the NSS package and thus ultimately from the Mozilla project.")
+    (home-page
+     "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
+    (license license:mpl2.0)))