unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Package Definitions and Maintenance
@ 2017-04-02  9:44 Thomas Sigurdsen
  2017-04-02 10:56 ` ng0
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Sigurdsen @ 2017-04-02  9:44 UTC (permalink / raw)
  To: help-guix@gnu.org

Hi Guix!

I'm sending two threads with the same intro, read below the line for the
questions.

I've been playing around with guixsd on my day-to-day work laptop for a month
or so now and have to say I'm thoroughly happy about how everything is put
together and mostly _just works_.

I'll note that I'm still very much learning guile and scheme. But the manual
(https://www.gnu.org/software/guile/manual/) is amazing.

-------------------------------------------------------------------------------------------------

I have tried writing some package definitions
(https://notabug.org/thomassgn/guixsd-configuration/src/master/modules/tms/).
But I can not get it to even pass evaluation and I don't understand what is
meant by 'procedure #f'. Assuming I somewhere have a value that should eval
to a procedure but evals to false instead - I just don't understand where.

The first warning about freetype I don't understand how to get around
also. I've attached my output from running 'guix package -i wkhtmltopdf' at
the end.

I'm also curious: I'm happy to contribute the package definitions I write to
guix; but I don't think I'm a reliable maintainer. That is, I don't know if I
will have the capacity to update the definitions as upstream changes with time
(I'm not reliable like that). Should I still send patches with package
definitions?

My entire configuration with homemade modules can be found at:
https://notabug.org/thomassgn/guixsd-configuration


WARNING: (wkhtmltopdf): `freetype' imported from both (guix licenses) and
(gnu packages fontutils) Backtrace:
In ice-9/boot-9.scm:
4056: 19 [#<procedure 1148900 at ice-9/boot-9.scm:4051:3 ()>]
1727: 18 [%start-stack load-stack ...]
1732: 17 [#<procedure 115cb10 ()>]
In unknown file:
   ?: 16 [primitive-load
"/gnu/store/0icg6mr0cw74srvp39hms8fvh3s821yf-guix-0.12.0-7.aabe/bin/.guix-real"]
In guix/ui.scm: 1228: 15 [run-guix-command package "-i" "wkhtmltopdf"]
In ice-9/boot-9.scm:
 160: 14 [catch srfi-34 #<procedure 1b71c00 at guix/ui.scm:432:2 ()> ...]
 160: 13 [catch system-error ...]
In guix/scripts/package.scm:
 896: 12 [#<procedure 1b71c20 at guix/scripts/package.scm:884:4 ()>]
 863: 11 [process-actions #<build-daemon 256.97 1b722c0> (# # # # ...)]
In guix/ui.scm:
 729: 10 [show-manifest-transaction # # # ...]
In srfi/srfi-1.scm:
 598: 9 [map #<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output
item)> ...] In guix/ui.scm:
 658: 8 [#<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output item)>
"wkhtmltopdf" ...] In guix/packages.scm:
1134: 7 [package-output # # "out" ...]
 786: 6 [cache! #<weak-key-hash-table 1a3da00 339/443> # # ...]
1092: 5 [thunk]
1024: 4 [bag->derivation # # #]
In srfi/srfi-1.scm:
 573: 3 [map #<procedure 356a150 at guix/packages.scm:1026:30 (t-1331428)> #]
In guix/packages.scm:
 846: 2 [expand-input # # # ...]
In guix/store.scm:
1176: 1 [#<procedure 1a404a0 at guix/store.scm:1175:26 (store . args)> #
# ...] In unknown file:
   ?: 0 [#f # "x86_64-linux" #f]

ERROR: In procedure #f:
ERROR: Wrong type to apply: #f

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

* Re: Package Definitions and Maintenance
  2017-04-02  9:44 Package Definitions and Maintenance Thomas Sigurdsen
@ 2017-04-02 10:56 ` ng0
  2017-04-03 13:21 ` Ludovic Courtès
  2017-04-03 13:42 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: ng0 @ 2017-04-02 10:56 UTC (permalink / raw)
  To: Thomas Sigurdsen; +Cc: help-guix@gnu.org

Hi Thomas,

Thomas Sigurdsen transcribed 3.0K bytes:
> Hi Guix!
> 
> I'm sending two threads with the same intro, read below the line for the
> questions.
> 
> I've been playing around with guixsd on my day-to-day work laptop for a month
> or so now and have to say I'm thoroughly happy about how everything is put
> together and mostly _just works_.
> 
> I'll note that I'm still very much learning guile and scheme. But the manual
> (https://www.gnu.org/software/guile/manual/) is amazing.
> 
> -------------------------------------------------------------------------------------------------
> 
> I have tried writing some package definitions
> (https://notabug.org/thomassgn/guixsd-configuration/src/master/modules/tms/).
> But I can not get it to even pass evaluation and I don't understand what is
> meant by 'procedure #f'. Assuming I somewhere have a value that should eval
> to a procedure but evals to false instead - I just don't understand where.
> 
> The first warning about freetype I don't understand how to get around
> also. I've attached my output from running 'guix package -i wkhtmltopdf' at
> the end.
> 
> I'm also curious: I'm happy to contribute the package definitions I write to
> guix; but I don't think I'm a reliable maintainer. That is, I don't know if I
> will have the capacity to update the definitions as upstream changes with time
> (I'm not reliable like that). Should I still send patches with package
> definitions?

Yes, we do not enforce a person per package becomes the maintainer
policy. The packages are collectively maintained, and while there are
people who pick groups of packages for various reasons they look after,
everyone has the freedom to update and care for the packages.
 
> My entire configuration with homemade modules can be found at:
> https://notabug.org/thomassgn/guixsd-configuration
> 
> 
> WARNING: (wkhtmltopdf): `freetype' imported from both (guix licenses) and
> (gnu packages fontutils) Backtrace:
> In ice-9/boot-9.scm:
> 4056: 19 [#<procedure 1148900 at ice-9/boot-9.scm:4051:3 ()>]
> 1727: 18 [%start-stack load-stack ...]
> 1732: 17 [#<procedure 115cb10 ()>]
> In unknown file:
>    ?: 16 [primitive-load
> "/gnu/store/0icg6mr0cw74srvp39hms8fvh3s821yf-guix-0.12.0-7.aabe/bin/.guix-real"]
> In guix/ui.scm: 1228: 15 [run-guix-command package "-i" "wkhtmltopdf"]
> In ice-9/boot-9.scm:
>  160: 14 [catch srfi-34 #<procedure 1b71c00 at guix/ui.scm:432:2 ()> ...]
>  160: 13 [catch system-error ...]
> In guix/scripts/package.scm:
>  896: 12 [#<procedure 1b71c20 at guix/scripts/package.scm:884:4 ()>]
>  863: 11 [process-actions #<build-daemon 256.97 1b722c0> (# # # # ...)]
> In guix/ui.scm:
>  729: 10 [show-manifest-transaction # # # ...]
> In srfi/srfi-1.scm:
>  598: 9 [map #<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output
> item)> ...] In guix/ui.scm:
>  658: 8 [#<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output item)>
> "wkhtmltopdf" ...] In guix/packages.scm:
> 1134: 7 [package-output # # "out" ...]
>  786: 6 [cache! #<weak-key-hash-table 1a3da00 339/443> # # ...]
> 1092: 5 [thunk]
> 1024: 4 [bag->derivation # # #]
> In srfi/srfi-1.scm:
>  573: 3 [map #<procedure 356a150 at guix/packages.scm:1026:30 (t-1331428)> #]
> In guix/packages.scm:
>  846: 2 [expand-input # # # ...]
> In guix/store.scm:
> 1176: 1 [#<procedure 1a404a0 at guix/store.scm:1175:26 (store . args)> #
> # ...] In unknown file:
>    ?: 0 [#f # "x86_64-linux" #f]
> 
> ERROR: In procedure #f:
> ERROR: Wrong type to apply: #f
> 
> 

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

* Re: Package Definitions and Maintenance
  2017-04-02  9:44 Package Definitions and Maintenance Thomas Sigurdsen
  2017-04-02 10:56 ` ng0
@ 2017-04-03 13:21 ` Ludovic Courtès
  2017-04-03 13:42 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2017-04-03 13:21 UTC (permalink / raw)
  To: Thomas Sigurdsen; +Cc: help-guix@gnu.org

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

Hello!

Thomas Sigurdsen <thomas.sigurdsen@gmail.com> skribis:

> I've been playing around with guixsd on my day-to-day work laptop for a month
> or so now and have to say I'm thoroughly happy about how everything is put
> together and mostly _just works_.
>
> I'll note that I'm still very much learning guile and scheme. But the manual
> (https://www.gnu.org/software/guile/manual/) is amazing.

Cool, thanks for the kind words!

> I have tried writing some package definitions
> (https://notabug.org/thomassgn/guixsd-configuration/src/master/modules/tms/).
> But I can not get it to even pass evaluation and I don't understand what is
> meant by 'procedure #f'. Assuming I somewhere have a value that should eval
> to a procedure but evals to false instead - I just don't understand where.

[...]

> 1024: 4 [bag->derivation # # #]
> In srfi/srfi-1.scm:
>  573: 3 [map #<procedure 356a150 at guix/packages.scm:1026:30 (t-1331428)> #]
> In guix/packages.scm:
>  846: 2 [expand-input # # # ...]
> In guix/store.scm:
> 1176: 1 [#<procedure 1a404a0 at guix/store.scm:1175:26 (store . args)> #
> # ...] In unknown file:
>    ?: 0 [#f # "x86_64-linux" #f]
>
> ERROR: In procedure #f:
> ERROR: Wrong type to apply: #f

This backtrace is indeed terrible.

I just cloned your repo and then did:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build -L /tmp/guixsd-configuration/modules/tms/ wkhtmltopdf
WARNING: (wkhtmltopdf): `freetype' imported from both (guix licenses) and (gnu packages fontutils)
Backtrace:
In ice-9/boot-9.scm:
    834:9 19 (catch _ _ #<procedure 7fd510b63a88 at guix/ui.scm:433:2 (key c)> _)
    834:9 18 (catch _ _ #<procedure 7fd510b63aa0 at guix/ui.scm:490:6 (key proc format-string format-args . res…> …)
In guix/scripts/build.scm:
   700:24 17 (_)
    629:4 16 (options->derivations _ _)
In srfi/srfi-1.scm:
   679:15 15 (append-map _ _ . _)
   592:17 14 (map1 (#<package wkhtmltopdf@0.12.4 /tmp/guixsd-configuration/modules/tms/wkhtmltopdf.scm:13 1b656…>))
In guix/scripts/build.scm:
   634:30 13 (_ _)
In guix/packages.scm:
   789:14 12 (cache! #<weak-table 353/443> #<package wkhtmltopdf@0.12.4 /tmp/guixsd-configuration/modules/tms/w…> …)
In unknown file:
          11 (_ #<procedure thunk ()> #<procedure list _> #<undefined>)
In guix/packages.scm:
  1096:22 10 (thunk)
  1029:25  9 (bag->derivation #<build-daemon 256.97 f52fc0> #<<bag> name: "wkhtmltopdf-0.12.4" system: "x86_64-…> …)
In srfi/srfi-1.scm:
   592:29  8 (map1 (("python" #<package python-wrapper@3.5.3 gnu/packages/python.scm:384 1bf9a80>) ("source" …) …))
   592:29  7 (map1 (("source" #<origin "http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4.ta…>) …))
   592:29  6 (map1 (("fontconfig" #<package fontconfig@2.12.1 gnu/packages/fontutils.scm:226 1f7d6c0>) ("f…" …) …))
   592:29  5 (map1 (("freetype" #<package freetype@2.7.1 gnu/packages/fontutils.scm:49 1f7da80>) ("libpng" #) # …))
   592:29  4 (map1 (("libpng" #<package libpng@1.6.28 gnu/packages/image.scm:67 1702900>) ("zlib" #<<licens…>) …))
   592:17  3 (map1 (("zlib" #<<license> name: "Zlib" uri: "http://www.gzip.org/zlib/zlib_license.html" comm…>) …))
In guix/packages.scm:
   849:16  2 (expand-input _ _ _ _ _)
In guix/store.scm:
  1177:50  1 (_ #<build-daemon 256.97 f52fc0> #<<license> name: "Zlib" uri: "http://www.gzip.org/zlib/zlib_lice…> …)
In unknown file:
           0 (_ #<<license> name: "Zlib" uri: "http://www.gzip.org/zlib/zlib_license.html" comment: "https://ww…> …)

ERROR: ERROR: Wrong type to apply: #f
--8<---------------cut here---------------end--------------->8---

(I’m using Guile 2.2 here, which produces a nicer backtrace.)

The warning at the top gives a hint: there’s a name clash between
bindings exported by the (guix licenses) module and those exported by
(gnu packages fontutils).

The bottom of the backtrace is also interesting: we’re getting a
<license> object here, where we really want a <package>.  The same
occurs with ‘openssl’.

To address that, you need to remap the (guix licenses) bindings to avoid
the name clash, and to import the right modules for ‘zlib’ and ‘openssl’
(see the patch below).  Once that is done, ‘guix build’ evaluates the
module nicely.

HTH!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 788 bytes --]

diff --git a/modules/tms/wkhtmltopdf.scm b/modules/tms/wkhtmltopdf.scm
index 66e41e5..07eb7e0 100644
--- a/modules/tms/wkhtmltopdf.scm
+++ b/modules/tms/wkhtmltopdf.scm
@@ -3,9 +3,11 @@
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system python)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages compression) ;zlib
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages tls)         ;openssl
   #:use-module (gnu packages xorg)
   #:use-module (srfi srfi-1))
 
@@ -55,5 +57,5 @@ thing.
 
 GUIX Specific: C library is untested")
     (home-page "http://wkhtmltopdf.org/")
-    (license gpl3+)))
+    (license license:gpl3+)))
 

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

* Re: Package Definitions and Maintenance
  2017-04-02  9:44 Package Definitions and Maintenance Thomas Sigurdsen
  2017-04-02 10:56 ` ng0
  2017-04-03 13:21 ` Ludovic Courtès
@ 2017-04-03 13:42 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2017-04-03 13:42 UTC (permalink / raw)
  To: Thomas Sigurdsen; +Cc: help-guix@gnu.org

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

Thomas Sigurdsen <thomas.sigurdsen@gmail.com> skribis:

> WARNING: (wkhtmltopdf): `freetype' imported from both (guix licenses) and
> (gnu packages fontutils) Backtrace:
> In ice-9/boot-9.scm:
> 4056: 19 [#<procedure 1148900 at ice-9/boot-9.scm:4051:3 ()>]
> 1727: 18 [%start-stack load-stack ...]
> 1732: 17 [#<procedure 115cb10 ()>]
> In unknown file:
>    ?: 16 [primitive-load
> "/gnu/store/0icg6mr0cw74srvp39hms8fvh3s821yf-guix-0.12.0-7.aabe/bin/.guix-real"]
> In guix/ui.scm: 1228: 15 [run-guix-command package "-i" "wkhtmltopdf"]
> In ice-9/boot-9.scm:
>  160: 14 [catch srfi-34 #<procedure 1b71c00 at guix/ui.scm:432:2 ()> ...]
>  160: 13 [catch system-error ...]
> In guix/scripts/package.scm:
>  896: 12 [#<procedure 1b71c20 at guix/scripts/package.scm:884:4 ()>]
>  863: 11 [process-actions #<build-daemon 256.97 1b722c0> (# # # # ...)]
> In guix/ui.scm:
>  729: 10 [show-manifest-transaction # # # ...]
> In srfi/srfi-1.scm:
>  598: 9 [map #<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output
> item)> ...] In guix/ui.scm:
>  658: 8 [#<procedure 4bd45c0 at guix/ui.scm:653:9 (name version output item)>
> "wkhtmltopdf" ...] In guix/packages.scm:
> 1134: 7 [package-output # # "out" ...]
>  786: 6 [cache! #<weak-key-hash-table 1a3da00 339/443> # # ...]
> 1092: 5 [thunk]
> 1024: 4 [bag->derivation # # #]
> In srfi/srfi-1.scm:
>  573: 3 [map #<procedure 356a150 at guix/packages.scm:1026:30 (t-1331428)> #]
> In guix/packages.scm:
>  846: 2 [expand-input # # # ...]
> In guix/store.scm:
> 1176: 1 [#<procedure 1a404a0 at guix/store.scm:1175:26 (store . args)> #
> # ...] In unknown file:
>    ?: 0 [#f # "x86_64-linux" #f]

The attached patch slightly improves the situation:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build -L /tmp/guixsd-configuration/modules/tms/ wkhtmltopdf
WARNING: (wkhtmltopdf): `freetype' imported from both (guix licenses) and (gnu packages fontutils)
guix build: error: #<<license> name: "Zlib" uri: "http://www.gzip.org/zlib/zlib_license.html" comment: "https://www.gnu.org/licenses/license-list#ZLib">: invalid G-expression input
--8<---------------cut here---------------end--------------->8---

The downside is that there’s no source location info here, and it’s
talking about g-expressions when all the user cares about is packages in
this case.

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3353 bytes --]

diff --git a/guix/gexp.scm b/guix/gexp.scm
index 1b8e43e99..80d8f735b 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -26,6 +26,8 @@
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-9 gnu)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
   #:export (gexp
             gexp?
@@ -84,7 +86,13 @@
             gexp-compiler?
             lower-object
 
-            lower-inputs))
+            lower-inputs
+
+            &gexp-error
+            gexp-error?
+            &gexp-input-error
+            gexp-input-error?
+            gexp-error-invalid-input))
 
 ;;; Commentary:
 ;;;
@@ -140,6 +148,14 @@
   (lower      gexp-compiler-lower)
   (expand     gexp-compiler-expand))              ;#f | DRV -> sexp
 
+(define-condition-type &gexp-error &error
+  gexp-error?)
+
+(define-condition-type &gexp-input-error &gexp-error
+  gexp-input-error?
+  (input gexp-error-invalid-input))
+
+
 (define %gexp-compilers
   ;; 'eq?' mapping of record type descriptor to <gexp-compiler>.
   (make-hash-table 20))
@@ -177,8 +193,11 @@ procedure to expand it; otherwise return #f."
 corresponding to OBJ for SYSTEM, cross-compiling for TARGET if TARGET is true.
 OBJ must be an object that has an associated gexp compiler, such as a
 <package>."
-  (let ((lower (lookup-compiler obj)))
-    (lower obj system target)))
+  (match (lookup-compiler obj)
+    (#f
+     (raise (condition (&gexp-input-error (input obj)))))
+    (lower
+     (lower obj system target))))
 
 (define-syntax define-gexp-compiler
   (syntax-rules (=> compiler expander)
diff --git a/guix/packages.scm b/guix/packages.scm
index 61171b834..d865dd5ad 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -31,7 +31,6 @@
   #:use-module (guix memoization)
   #:use-module (guix build-system)
   #:use-module (guix search-paths)
-  #:use-module (guix gexp)
   #:use-module (guix sets)
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
@@ -1226,4 +1225,7 @@ outside of the store) or SOURCE itself (if SOURCE is already a store item.)"
         ((? string? file)
          (add-to-store store (basename file) #t "sha256" file))
         (_
+         ;; XXX: 'lower' can throw '&gexp-input-error'.  From a UI viewpoint,
+         ;; this is better than a wrong-type-arg error, but it's not ideal
+         ;; because gexps don't have source location information yet.
          (lower store source system))))))
diff --git a/guix/ui.scm b/guix/ui.scm
index 345bf490b..b3c94795f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -26,6 +26,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix ui)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix store)
   #:use-module (guix config)
@@ -448,6 +449,10 @@ interpreted."
                       (location->string loc)
                       (package-full-name package)
                       (build-system-name system))))
+            ((gexp-input-error? c)
+             (let ((input (package-error-invalid-input c)))
+               (leave (_ "~s: invalid G-expression input~%")
+                      (gexp-error-invalid-input c))))
             ((profile-not-found-error? c)
              (leave (_ "profile '~a' does not exist~%")
                     (profile-error-profile c)))

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

end of thread, other threads:[~2017-04-03 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-02  9:44 Package Definitions and Maintenance Thomas Sigurdsen
2017-04-02 10:56 ` ng0
2017-04-03 13:21 ` Ludovic Courtès
2017-04-03 13:42 ` Ludovic Courtès

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