[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] guix: build: Add transitive source building.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 2/2] guix: build: Add transitive source building. |
Date: |
Thu, 26 Feb 2015 18:03:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Eric Bavier <address@hidden> skribis:
> * guix/scripts/build.scm (%options): Add --sources option.
> (package-sources, package-direct-sources)
> (package-transitive-sources, package-source-derivations): New
> procedures.
> (options->derivations)[--sources]: Use them.
> * doc/guix.texi (Invoking guix build): Document --sources option.
> * tests/guix-build.sh: Add tests.
[...]
> address@hidden --sources
> +An extension of the @code{--source} option. If a package's source is
What about starting with a couple of sentences that better describe what
it does and what the use case is, like:
Fetch and return the source of @var{package-or-derivation} and all
their dependencies, recursively. This is a handy way to obtain a
local copy of all the source code needed to build @var{packages},
allowing you to eventually build them even without network access.
BTW, what happens when one passes arguments that are not packages?
Like:
guix build --sources /gnu/store/...-foo.drv
> + --sources[=TYPE] build source derivations; TYPE may optionally be one
> + of \"package\", \"all\" (default), or
> \"transitive\"."))
No period.
> +(define (package-sources package)
This procedure appears to be unused (and is awkward anyway ;-)).
> +(define (package-direct-sources package)
> + "Return all source origins associated with PACKAGE; including origins in
> +PACKAGE's inputs."
> + `(,@(or (and=> (package-source package) list) '())
> + ,@(filter-map (match-lambda
> + ((_ (? origin? orig) _ ...)
> + orig)
> + (_ #f))
> + (package-direct-inputs package))))
> +
> +(define (package-transitive-sources package)
> + "Return PACKAGE's direct sources, and its input sources, recursively."
> + (delete-duplicates
> + (concatenate (filter-map (match-lambda
> + ((_ (? origin? orig) _ ...)
> + (list orig))
> + ((_ (? package? p) _ ...)
> + (package-direct-sources p))
> + (_ #f))
> + (bag-transitive-inputs
> + (package->bag package))))))
Perhaps these two could go to (guix packages), with a test in
tests/packages.scm. (That can be done after this patch is in.)
> +# foo.tar.gz
> +guix build -d -S foo
> +guix build -d -S foo | grep -e 'foo\.tar\.gz'
Nice tests, thanks for taking the time!
Ludo’.