From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <rekado@elephly.net>
Cc: 28251@debbugs.gnu.org
Subject: [bug#28251] [PATCH 2/3] import: Add generic data to package converter.
Date: Mon, 04 Sep 2017 15:04:10 +0200 [thread overview]
Message-ID: <87vaky399x.fsf@gnu.org> (raw)
In-Reply-To: <20170827160046.29049-2-rekado@elephly.net> (Ricardo Wurmus's message of "Sun, 27 Aug 2017 18:00:45 +0200")
Hello!
Ricardo Wurmus <rekado@elephly.net> skribis:
> * guix/import/utils.scm (build-system-modules, guix-modules): New variables.
> (lookup-build-system-by-name, specs->package-lists, convert-source,
> data->guix-package): New procedures.
[...]
> +(define build-system-modules
> + (all-modules (map (lambda (entry)
> + `(,entry . "guix/build-system"))
> + %load-path)))
> +
> +(define guix-modules
> + (all-modules (map (lambda (entry)
> + `(,entry . "guix"))
> + %load-path)))
‘all-modules’ causes a directory traversal, so it should not be called
at the top level. The solution is to turn these two things in a promise
or a thunk or probably an ‘mlambda’ thunk (depending on whether they are
expected to be called frequently.)
> +(define (lookup-build-system-by-name name)
> + (fold-module-public-variables (lambda (obj result)
Docstring please. :-)
> +(define (specs->package-lists specs)
> + (map (lambda (spec)
> + (let ((pkg (specification->package spec)))
> + (list (package-name pkg) pkg)))
> + specs))
This should probably use ‘specification->package+output’ so that one can
use specs like “hwloc:lib”.
> +(define (convert-source source)
Maybe ‘source-spec->object’?
> + (match source
> + ((? string? file) (local-file file))
> + (#f #f)
> + (orig (let ((sha (match (car (assoc-ref orig "sha256"))
> + (("base32" . value)
> + (base32 value))
> + (_ #f))))
> + (origin
> + (method (match (assoc-ref orig "method")
> + ("url-fetch" (@ (guix download) url-fetch))
> + ("git-fetch" (@ (guix git-download) git-fetch))
> + ("svn-fetch" (@ (guix svn-download) svn-fetch))
> + ("hg-fetch" (@ (guix hg-download) hg-fetch))
> + (_ #f)))
> + (uri (assoc-ref orig "uri"))
> + (sha256 sha))))))
Though as discussed earlier, I’m unsure about exposing “url-fetch” and
co. in the spec that people write.
> +(define (data->guix-package meta)
Maybe ‘alist->package’?
Ludo’.
next prev parent reply other threads:[~2017-09-04 13:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-27 15:58 [bug#28251] [PATCH 0/3] Add generic JSON importer Ricardo Wurmus
2017-08-27 16:00 ` [bug#28251] [PATCH 1/3] packages: Add package->code Ricardo Wurmus
2017-08-27 16:00 ` [bug#28251] [PATCH 2/3] import: Add generic data to package converter Ricardo Wurmus
2017-09-04 13:04 ` Ludovic Courtès [this message]
2017-08-27 16:00 ` [bug#28251] [PATCH 3/3] import: Add JSON importer Ricardo Wurmus
2017-09-04 13:04 ` Ludovic Courtès
2017-09-01 15:55 ` [bug#28251] [PATCH 1/3] packages: Add package->code Ludovic Courtès
2017-09-28 11:19 ` bug#28251: " Ricardo Wurmus
2017-08-28 12:27 ` [bug#28251] [PATCH 0/3] Add generic JSON importer Ricardo Wurmus
2017-09-01 15:35 ` Ludovic Courtès
2017-09-28 11:23 ` Ricardo Wurmus
2017-09-28 19:58 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vaky399x.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=28251@debbugs.gnu.org \
--cc=rekado@elephly.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.