Re: [PATCH] gnu-maintenance: Add 'find-package-with-attrs' and '%package-list'.

2013-02-22 Thread Ludovic Courtès
Hi,

Nikita Karetnikov nik...@karetnikov.org skribis:

 This patch adds a procedure to fetch information from Womb.

Nice!

 scheme@(guile-user) ,use (guix gnu-maintenance)
 scheme@(guile-user) (find-package-with-attrs guix)
 $1 = (package: guix logo: /software/guix/graphics/guix-logo.small.png 
 doc-category: Sysadmin doc-summary: Managing installed software packages 
 and versions doc-url: none gplv3-status: should-be-ok activity-status: 
 newpkg/20121117)

Instead of adding a new procedure, what about having this one replace
‘official-gnu-packages’?  It does basically the same, just provides more
info.

Also, I think it should process fields, and return an alist, or even
better, a ‘gnu-package-descriptor’ record (say).

  (define-record-type gnu-package-descriptor
gnu-package-descriptor?
(gnu-package-descriptor name logo-url doc-category ...)
...
)

  (official-gnu-packages)
  = (#gnu-package-descriptor name: guix logo-url: http://...; ...# ...)

WDYT?

 Also, it should be possible to get a single attribute (e.g.,
 'doc-summary'), not all of them.  I'll implement that later.

It has to read all of the Womb file anyway, so better return all the
information (like above), and let code filter what it wants.

 The goal is to use this procedure from 'guix import'.

Cool!

 +(define %package-list
 +  (string-split (http-fetch %package-list-url) #\nl))

Please don’t make it a global variable.  Instead, fetch it when it’s
asked.  We could have some sort of a cache eventually, if we happen to
call it several times in a row.

Also, instead of fetching it entirely in memory, rather use ‘http-get*’
(Guile 2.0.7) or ‘(http-get ... #:streaming? #t)’ (Guile 2.0.8) to get
an input port to the file.

Then you can write a loop that processes the package list line-by-line
(using ‘read-line’ from (ice-9 rdelim)), with a basic state machine to
determine if you’ve reach the end of a package descriptor.

 +(define (find-package-with-attrs package)
 +  Return a list that contains PACKAGE and its attributes.
 +  (define (split-womb-packages xs ys)
 +;; Return a list of lists; each inner list represents a package.
 +(define (tail lst)
 +  (if (null-list? lst)
 +  lst
 +  (cdr lst)))
 +
 +(cond ((null-list? ys) (filter (lambda (lst)
 + (not (null-list? lst)))
 +   xs))
 +  (else (let-values (((xs' ys') (span (lambda (str)
 +(not (string-null? str)))
 +  ys)))
 +  (split-womb-packages (append xs (list xs'))
 +   (tail ys'))

In general, you should use ‘match’ from (ice-9 match) for these things.
It will make your life brighter.  :-)

HTH,
Ludo’.



Re: GSoC?

2013-02-22 Thread Ludovic Courtès
Cyril Roelandt tipec...@gmail.com skribis:

 I don't have any experience with GSoC either, but I'm wondering
 whether Google will allow us to submit a list of projects since Guix
 is a really young project. Does every project have to apply on its
 own, or can GNU apply ?

GNU is applying as an organization, so this would be under GNU’s umbrella.

 One project that would be suitable, because it’s orthogonal and
 challenging yet doable, is some sort of a Hydra rewrite in Guile.

 How hard is it to port Guix to other architectures ?

Until we have cross-compilation it’s tedious.  But that’s not
sufficiently motivating or ambitious for GSoC, IMO.

 Could this be a GSoC project ? How about packaging a huge piece of
 software (I'm thinking about GNOME/KDE, for instance) ?

Yes, sounds like a good idea.

Ludo’.



Re: Toward 0.2

2013-02-22 Thread Ludovic Courtès
Nikita Karetnikov nik...@karetnikov.org skribis:

 With the recently-added ‘package-output’ (singular):

 scheme@(guile-user) (package-output s binutils out)
 $2 = /nix/store/bfh5c2a4is27jdmc811fp6g0jfac7fiw-binutils-2.22
 scheme@(guile-user) (package-output s binutils lib)
 $3 = /nix/store/n29brzqlhjkzww51labk9anx493gl4d3-binutils-2.22-lib

 What's the value of 's' here?

(define s (open-connection))

 There is no explanation in the docstrings of 'package-derivation',
 'package-cross-derivation', and 'package-output'.

For the ‘store’ parameter you mean?  We could add one, but this is a
convention shared by (guix derivations) and (guix packages), so I’m not
sure docstrings should be “cluttered” this way.

 Are you sure that it's OK to have 'package-output' and 'package-outputs'
 in the same module?  Can we rename one?

I agree we should be caution with this sort of names, but I’ve
considered it OK.  There’s a tension between the length and expressivity
of a name.

Ludo’.



Re: New “guix pull” command

2013-02-22 Thread Ludovic Courtès
Andreas Enge andr...@enge.fr skribis:

 The following error occurs for me with the latest git version:

 $ guix pull
 starting download of `guix-file.CFKlaG' from 
 `http://hydra.gnu.org/job/guix/master/tarball/latest/download'...
 following redirection to `http://hydra.gnu.org:3000/build/7168/download'...
 following redirection to 
 `http://hydra.gnu.org:3000/build/7168/download/1/guix-0.2.tar.gz'...
 [now one minute of waiting, then]

If you’re using Guile 2.0.7+, a progress report is displayed; nothing
gets displayed for earlier Guile versions, though.

 the following derivation will be built:
/nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv
 error: build failed: build of `/nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-
 guix-latest.drv' failed

Can you run

  guix build /nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv

and post the log?

Thanks,
Ludo’.



Re: New “guix pull” command

2013-02-22 Thread Andreas Enge
Am Freitag, 22. Februar 2013 schrieb Ludovic Courtès:
 Can you run
   guix build /nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv
 and post the log?

Unpacking og guix-0.2, then:

Backtrace:
In ice-9/boot-9.scm:
2786: 19 [try-module-autoload (guix build download) #f]
2131: 18 [save-module-excursion #procedure 2b069c0 at 
ice-9/boot-9.scm:2787:17 ()]
2797: 17 [#procedure 2b069c0 at ice-9/boot-9.scm:2787:17 ()]
In unknown file:
   ?: 16 [primitive-load-path guix/build/download #f]
In ice-9/eval.scm:
 494: 15 [#procedure 1ee17a0 at ice-9/eval.scm:488:4 (exp) #]
In ice-9/psyntax.scm:
1101: 14 [expand-top-sequence (#) () (#) ...]
1259: 13 [#procedure 351cde0 at ice-9/psyntax.scm:1067:36 ()]
1611: 12 [expand-simple-lambda (# . #) () (()) ...]
1532: 11 [parse ((# . #)) (#(syntax-object log # ...)) ...]
In ice-9/boot-9.scm:
 623: 10 [map #procedure 3521150 at ice-9/psyntax.scm:1533:66 (x) ((# . 
#))]
In ice-9/psyntax.scm:
2120: 9 [expand-let (let # # # ...) (# # #) (# # #) ...]
In ice-9/boot-9.scm:
 623: 8 [map #procedure 351eb80 at ice-9/psyntax.scm:2120:49 (x) (#)]
In ice-9/psyntax.scm:
1257: 7 [#procedure 351eb80 at ice-9/psyntax.scm:2120:49 (x) #]
1186: 6 [syntax-type (make-session connection-end/client) (# # #) (# # #) 
...]
 579: 5 [syntax-type make-session (# # #) (# # #) ...]
 292: 4 [get-global-definition-hook make-session (hygiene guix build 
download)]
In unknown file:
   ?: 3 [module-variable #directory (guix build download) 3243e10 make-
session]
In ice-9/boot-9.scm:
2732: 2 [b #autoload (gnutls) 350b870 make-session #f]
In unknown file:
   ?: 1 [scm-error misc-error #f ...]
In ice-9/boot-9.scm:
 106: 0 [#procedure 2a4e280 at ice-9/boot-9.scm:97:6 (thrown-k . args) 
misc-error ...]

ice-9/boot-9.scm:106:20: In procedure #procedure 2a4e280 at 
ice-9/boot-9.scm:97:6 (thrown-k . args):
ice-9/boot-9.scm:106:20: missing interface for module (gnutls)
copying and compiling Guix to `/nix/store/2bzasrj9g4qh562jrm2fg56x7bk3276f-
guix-latest'...
builder for `/nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv' 
failed with exit code 1
@ build-failed /nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv 
/nix/store/2bzasrj9g4qh562jrm2fg56x7bk3276f-guix-latest 1 builder for 
`/nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv' failed with 
exit code 1
error: build failed: build of `/nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-
guix-latest.drv' failed

Andreas



Re: GSoC?

2013-02-22 Thread Ludovic Courtès
Andreas Enge andr...@enge.fr skribis:

 Am Freitag, 22. Februar 2013 schrieb Ludovic Courtès:
 Cyril Roelandt tipec...@gmail.com skribis:
  Could this be a GSoC project ? How about packaging a huge piece of
  software (I'm thinking about GNOME/KDE, for instance) ?
 Yes, sounds like a good idea.

 Actually, I wondered if this was sufficiently ambitious and motivating...

Of course that’s questionable.  :-)  It’s surely less motivating than a
Hydra-like thing.

Ludo’.



Re: New “guix pull” command

2013-02-22 Thread Ludovic Courtès
Andreas Enge andr...@enge.fr skribis:

 Am Freitag, 22. Februar 2013 schrieb Ludovic Courtès:
 Can you run
   guix build /nix/store/7pp5x6b3ikz6vnvrdlr836bjp4sbgbg8-guix-latest.drv
 and post the log?

 Unpacking og guix-0.2, then:

[...]

?: 3 [module-variable #directory (guix build download) 3243e10 make-
 session]
 In ice-9/boot-9.scm:
 2732: 2 [b #autoload (gnutls) 350b870 make-session #f]
 In unknown file:
?: 1 [scm-error misc-error #f ...]
 In ice-9/boot-9.scm:
  106: 0 [#procedure 2a4e280 at ice-9/boot-9.scm:97:6 (thrown-k . args) 
 misc-error ...]

 ice-9/boot-9.scm:106:20: In procedure #procedure 2a4e280 at 
 ice-9/boot-9.scm:97:6 (thrown-k . args):
 ice-9/boot-9.scm:106:20: missing interface for module (gnutls)

I believe this is fixed by 7b50c68 (which is like 855a8ad).
Can you confirm?

(Note how the file system introduces non-determinism in a way that can
have a concrete effect: the bug above would show up only if
guix/build/download.scm wasn’t built when guix/scripts/download.scm was
compiled, which depends on the order in which files were traversed.)

Ludo’.



Re: New “guix pull” command

2013-02-22 Thread Andreas Enge
Am Freitag, 22. Februar 2013 schrieb Ludovic Courtès:
 I believe this is fixed by 7b50c68 (which is like 855a8ad).
 Can you confirm?

Yes, it is working now. Thanks!

Andreas



Re: #!/usr/bin/env perl

2013-02-22 Thread Ludovic Courtès
Andreas Enge andr...@enge.fr skribis:

 Am Samstag, 26. Januar 2013 schrieb Ludovic Courtès:
 The function you want to patch ;-) is ‘patch-shebang’ in
 build/utils.scm.  Since that entails a full rebuild, that’s something
 for a new ‘core-updates’ branch.

 Please find attached a patch for review. I tested it on a few example 
 files, but not yet with a real packet - I am waiting for the full rebuild 
 ;-)

Heh, thanks.

 --- a/guix/build/utils.scm
 +++ b/guix/build/utils.scm
 @@ -426,7 +426,7 @@ bytes transferred and the continuation of the transfer as 
 a thunk.
   (stat:mtimensec stat)))
  
  (define patch-shebang
 -  (let ((shebang-rx (make-regexp ^[[:blank:]]*([[:graph:]]+)(.*)$)))
 +  (let ((shebang-rx (make-regexp 
 ^[[:blank:]]*([[:graph:]]+)[[:blank:]]*([[:graph:]]*)(.*)$)))

I think it should be a + after the second [[:blank:]], because there
should be space between the interpreter name and its argument.

  (lambda* (file
#:optional
(path (search-path-as-string-list (getenv PATH)))
 @@ -465,16 +465,27 @@ FILE are kept unchanged.
 (let ((line (false-if-exception (read-line p
   (and= (and line (regexp-exec shebang-rx line))
  (lambda (m)
 -  (let* ((cmd (match:substring m 1))
 - (bin (search-path path (basename cmd
 +  (let* ((first (match:substring m 1))
 + (second (match:substring m 2))
 + (third (match:substring m 3))

What about more descriptive names like ‘interp’, ‘arg1’, and ‘rest’?

 + (has-env (string=? (string-pad first 4) 
 /env))

Rather (has-env? (string-suffix? /env interp)).

 +(if has-env
 +  (begin

Please align with the ‘h’ here...

 +(patch p bin
 +  (string-append   second 
 third)

... and with the ‘p’ here.

Modulo these details, looks good to me, so feel free to push!

Thanks,
Ludo’.



Re: #!/usr/bin/env perl

2013-02-22 Thread Andreas Enge
Am Samstag, 23. Februar 2013 schrieb Ludovic Courtès:
  (make-regexp
  ^[[:blank:]]*([[:graph:]]+)[[:blank:]]*([[:graph:]]*)(.*)$)))
 
 I think it should be a + after the second [[:blank:]], because there
 should be space between the interpreter name and its argument.

Sometimes, there is no space at all: In
#!/usr/bin/perl
for instance, when there is no argument. Then the + version would fail. 
With *, it works as expected.

 What about more descriptive names like ‘interp’, ‘arg1’, and ‘rest’?

Maybe. I did not choose descriptive names because the real interpreter is 
sometimes the first, sometimes the second piece. But your suggestion looks 
good.

 Rather (has-env? (string-suffix? /env interp)).

Ok, thanks.

  +(if has-env
  +  (begin
 Please align with the ‘h’ here...
  +(patch p bin
  +  (string-append   second
  third)
 ... and with the ‘p’ here.

Ok. The annoying thing with this way of indenting is that lines become very 
long very quickly; I like keeping them at less than 80 characters.

Andreas