unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: 26652@debbugs.gnu.org
Subject: bug#26652: [PATCH 1/2] profiles: Add manifest->packages.
Date: Wed, 26 Apr 2017 01:47:12 +0900	[thread overview]
Message-ID: <87bmrkph7z.fsf@gmail.com> (raw)
In-Reply-To: <20170425125810.7373-1-m.othacehe@gmail.com>

Hi Mathieu!

Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * guix/profiles.scm (manifest->packages): New exported procedure.
> ---
>  guix/profiles.scm | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index eb172ef45..157445407 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -8,6 +8,7 @@
>  ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
>  ;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
>  ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -94,6 +95,7 @@
>              profile-manifest
>              package->manifest-entry
>              packages->manifest
> +            manifest->packages
>              ca-certificate-bundle
>              %default-profile-hooks
>              profile-derivation
> @@ -203,6 +205,14 @@ denoting a specific output of a package."
>            (package->manifest-entry package)))
>          packages)))
>  
> +(define (manifest->packages manifest)
> +  "Return the list of packages in MANIFEST."
> +  (delete-duplicates
> +   (filter-map (lambda (entry)
> +                 (let ((item (manifest-entry-item entry)))
> +                   (if (package? item) item #f)))
> +               (manifest-entries manifest))))
> +
>  (define (manifest->gexp manifest)
>    "Return a representation of MANIFEST as a gexp."
>    (define (entry->gexp entry)

The filter-map part seems problematic, IIUC. You might end up with an
`#f' in your list of packages, no? Maybe you could use something like:

(delete-duplicates
 (filter package? (map manifest-entry-item (manifest-entries manifest))))

Disclaimer: I haven't tested it.

Maxim

  parent reply	other threads:[~2017-04-25 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 12:58 bug#26652: [PATCH 0/2] fresh: add -m manifest option Mathieu Othacehe
2017-04-25 13:00 ` bug#26652: [PATCH 1/2] profiles: Add manifest->packages Mathieu Othacehe
2017-04-25 13:00   ` bug#26652: [PATCH 2/2] scripts: refresh: Add -m manifest option Mathieu Othacehe
2017-05-03 20:04     ` Ludovic Courtès
2017-05-04 11:46       ` Mathieu Othacehe
2017-04-25 16:47   ` Maxim Cournoyer [this message]
2017-04-25 17:00     ` bug#26652: [PATCH 1/2] profiles: Add manifest->packages Mathieu Othacehe
2017-04-25 18:50       ` Maxim Cournoyer
2017-05-03 19:59   ` Ludovic Courtès
2017-05-04 10:22 ` bug#26652: [PATCH] scripts: refresh: Add -m manifest option Mathieu Othacehe
2017-06-02 16:35   ` Ludovic Courtès
2017-06-04  7:09     ` Mathieu Othacehe

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=87bmrkph7z.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=26652@debbugs.gnu.org \
    --cc=m.othacehe@gmail.com \
    /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).