unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>, 74542@debbugs.gnu.org
Cc: Josselin Poiret <dev@jpoiret.xyz>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>,
	Mathieu Othacehe <othacehe@gnu.org>,
	Ludovic Court?s <ludo@gnu.org>,
	Tobias Geerinckx-Rice <me@tobias.gr>,
	Christopher Baines <guix@cbaines.net>
Subject: [bug#74542] [PATCH 04/11] build: Add ‘--development’ option.
Date: Tue, 26 Nov 2024 16:26:25 +0100	[thread overview]
Message-ID: <87o7222ezi.fsf@gmail.com> (raw)
In-Reply-To: <7c530a62370853828f181db011cb2f12fdc78847.1732615193.git.ludo@gnu.org>

Hi,

Here the oneline commit message is:

     build: Add ‘--development’ option.

when elsewhere in the same series, it reads:

     guix build: Add ‘--dependents’.

I suggest consistency; ’build:’ or ’guix build:’ for both.

On Tue, 26 Nov 2024 at 11:33, Ludovic Courtès <ludo@gnu.org> wrote:

> +  ;; Process OPTS in "the right order", meaning that if the user typed
> +  ;; "-D hello", arrange to see the 'development? option before the "hello"
> +  ;; spec.
> +  (let loop ((opts (reverse opts))
> +             (type 'regular)
> +             (result '()))
> +    (define (for-type obj)
> +      ;; Return a list of objects corresponding to OBJ adjusted for TYPE.
> +      (match type
> +        ('regular
> +         (list obj))
> +        ('development
> +         (if (package? obj)
> +             (map manifest-entry-item
> +                  (manifest-entries
> +                   (package->development-manifest obj system)))
> +             obj))))

Well, the loop seems overcomplicated but nothing better to propose. ;-)

> +    (match opts
> +      (()
> +       (reverse result))
> +      ((head . tail)
> +       (match head
> +         (('argument . (? string? spec))
> +          (cond ((derivation-path? spec)
> +                 (catch 'system-error
> +                   (lambda ()
> +                     ;; Ask for absolute file names so that .drv file
> +                     ;; names passed from the user to 'read-derivation'
> +                     ;; are absolute when it returns.
> +                     (let ((spec (canonicalize-path spec)))
> +                       (loop tail 'regular
> +                             (cons (read-derivation-from-file spec)
> +                                   result))))
> +                   (lambda args
> +                     ;; Non-existent .drv files can be substituted down
> +                     ;; the road, so don't error out.
> +                     (if (= ENOENT (system-error-errno args))
> +                         (loop tail 'regular result)
> +                         (apply throw args)))))
> +                ((store-path? spec)
> +                 ;; Nothing to do; maybe for --log-file.
> +                 (loop tail type result))
> +                (else
> +                 (loop tail 'regular
> +                       (append (for-type (specification->package spec))
> +                               result)))))
> +         (('file . file)
> +          (let ((file (or (and (string-suffix? ".json" file)
> +                               (json->scheme-file file))
> +                          file)))
> +            (loop tail 'regular
> +                  (append (append-map
> +                           for-type
> +                           (ensure-list (load* file (make-user-module '()))))
> +                          result))))
> +         (('manifest . manifest)
> +          (loop tail 'regular
> +                (append (map manifest-entry-item
> +                             (manifest-entries
> +                              (load* manifest
> +                                     (make-user-module '((guix profiles)
> +                                                         (gnu))))))
> +                        result)))
> +         (('expression . str)
> +          (loop tail 'regular
> +                (append (append-map for-type (ensure-list (read/eval str)))
> +                        result)))
> +         (('argument . (? derivation? drv))
> +          (loop tail 'regular (cons drv result)))

Since you are at it, why not move this pattern close to the other
pattern matching ’argument’ too?


Cheers,
simon




  reply	other threads:[~2024-11-26 15:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 10:32 [bug#74542] [PATCH 00/11] Improved tooling for package updates Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 01/11] transformations: Export ‘package-with-upstream-version’ Ludovic Courtès
2024-11-26 15:00   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 02/11] gnu-maintenance: ‘import-html-release’ doesn’t abort upon HTTP 404 Ludovic Courtès
2024-11-26 15:09   ` Simon Tournier
2024-11-26 17:16     ` Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 03/11] gnu-maintenance: Savannah/Xorg updaters no longer abort on network errors Ludovic Courtès
2024-11-26 15:12   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 04/11] build: Add ‘--development’ option Ludovic Courtès
2024-11-26 15:26   ` Simon Tournier [this message]
2024-11-26 10:33 ` [bug#74542] [PATCH 05/11] packages: Factorize ‘all-packages’ Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 06/11] guix build: Add ‘--dependents’ Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 07/11] import: gnome: Keep going upon HTTP errors Ludovic Courtès
2024-11-26 15:26   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 08/11] gnu-maintenance: ‘gnu-ftp’ updater excludes GnuPG-hosted packages Ludovic Courtès
2024-11-26 15:28   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 09/11] gnu: Update updater properties for GnuPG-related packages Ludovic Courtès
2024-11-26 15:28   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 10/11] guix build: Validate that the file passed to ‘-m’ returns a manifest Ludovic Courtès
2024-11-26 15:36   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 11/11] etc: Add upgrade manifest Ludovic Courtès
2024-11-26 15:49   ` Simon Tournier
2024-11-26 17:18     ` Ludovic Courtès
2024-11-26 14:42 ` [bug#74542] [PATCH 00/11] Improved tooling for package updates Ludovic Courtès
2024-11-26 16:04   ` Simon Tournier
2024-11-26 14:59 ` Simon Tournier
2024-11-26 17:21   ` Ludovic Courtès
2024-11-26 16:32 ` Suhail Singh
2024-11-26 17:23   ` 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=87o7222ezi.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=74542@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=me@tobias.gr \
    --cc=othacehe@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).