unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 74979@debbugs.gnu.org
Cc: "Christopher Baines" <guix@cbaines.net>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#74979] [PATCH 2/4] scripts: style: Sort more kinds of package definitions.
Date: Thu, 19 Dec 2024 20:33:05 +0100	[thread overview]
Message-ID: <addf23b3b65e09a039a11a2d9dddeb2c6109a9a1.1734636205.git.herman@rimm.ee> (raw)
In-Reply-To: <cover.1734636205.git.herman@rimm.ee>

* guix/scripts/style.scm (order-packages): Match comments before package
S-exp. and its fields.  Match in let.  Match package/inherit.

Change-Id: I48a5976930501c20415b5413966b5294958bc23b
---
 guix/scripts/style.scm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 4b704ddfb7..6f07f6c3b9 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -503,13 +503,14 @@ (define (order-packages lst)
 share a name are placed with versions in descending order."
   (define (package-fields pkg)
     (match pkg
-      ((('define-public _ expr) _ ...)
+      ((('define-public pkg _ ... (or ('let _ expr) expr)) _ ...)
        (match expr
-         ((or ('package _ ('name name) ('version version) _ ...)
-              ('package ('name name) ('version version) _ ...))
-          (values name version))
-         (_ (values #f #f))))
-      (_ (values #f #f))))
+         (((or 'package 'package/inherit) fields ...)
+          (let ((name (and=> (assoc-ref fields 'name) first))
+                (version (and=> (assoc-ref fields 'version) first)))
+            (values name version)))
+         (_ (and (values #f #f)))))
+      (_ (and (values #f #f)))))
 
   (define (package>? lst1 lst2)
     (let-values (((name1 version1) (package-fields lst1))
-- 
2.45.2





  parent reply	other threads:[~2024-12-19 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 19:31 [bug#74979] [PATCH 0/4] scripts: style: Sort more kinds of package Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 1/4] scripts: style: Refactor order-packages Herman Rimm via Guix-patches via
2024-12-19 19:33 ` Herman Rimm via Guix-patches via [this message]
2024-12-19 19:33 ` [bug#74979] [PATCH 3/4] scripts: style: Only sort packages with string literal name Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 4/4] scripts: style: Warn about unmatched package definitions Herman Rimm via Guix-patches via

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=addf23b3b65e09a039a11a2d9dddeb2c6109a9a1.1734636205.git.herman@rimm.ee \
    --to=guix-patches@gnu.org \
    --cc=74979@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=herman@rimm.ee \
    --cc=ludo@gnu.org \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=zimon.toutoune@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).