unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Eric Bavier <bavier@member.fsf.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 2/2] guix: build: Add transitive source building.
Date: Thu, 26 Feb 2015 18:03:40 +0100	[thread overview]
Message-ID: <87r3tc61w3.fsf@gnu.org> (raw)
In-Reply-To: <1424800441-21696-2-git-send-email-bavier@member.fsf.org> (Eric Bavier's message of "Tue, 24 Feb 2015 11:54:01 -0600")

Eric Bavier <bavier@member.fsf.org> 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.

[...]

> +@item --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’.

  reply	other threads:[~2015-02-26 17:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 17:54 [PATCH 1/2] packages: Getting unpatched origin derivations Eric Bavier
2015-02-24 17:54 ` [PATCH 2/2] guix: build: Add transitive source building Eric Bavier
2015-02-26 17:03   ` Ludovic Courtès [this message]
2015-02-26 16:52 ` [PATCH 1/2] packages: Getting unpatched origin derivations Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2015-04-24 13:19 [PATCH 2/2] guix: build: Add transitive source building Eric Bavier
2015-04-24 13:19 ` Eric Bavier
2015-05-01 20:14   ` 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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3tc61w3.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bavier@member.fsf.org \
    --cc=guix-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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