GNU bug report logs - #74979
[PATCH 0/4] scripts: style: Sort more kinds of package

Previous Next

Package: guix-patches;

Reported by: Herman Rimm <herman <at> rimm.ee>

Date: Thu, 19 Dec 2024 19:33:02 UTC

Severity: normal

Tags: moreinfo, patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Herman Rimm <herman <at> rimm.ee>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>, 74979 <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: [bug#74979] [PATCH 0/4] scripts: style: Sort more kinds of package
Date: Mon, 23 Dec 2024 18:28:39 +0100
Hi Herman,

Herman Rimm <herman <at> rimm.ee> skribis:

> The warnings added in [PATCH 4/4] are emitted multiple times.  How
> should I prevent that?  Or should I put them behind a --verbose option?

Not sure, do you have an example on how to trigger it?

> +++ b/guix/scripts/style.scm
> @@ -508,9 +508,15 @@ (define (order-packages lst)
>           (((or 'package 'package/inherit) fields ...)
>            (let ((name (and=> (assoc-ref fields 'name) first))
>                  (version (and=> (assoc-ref fields 'version) first)))
> +            (if (and name version)
> +                (unless (and (string? name) (string? version))
> +                  (warning (G_ "non-string name/version for ~a~%") pkg))
> +                (warning (G_ "package fields not found for ~a~%") pkg))
>              (values name version)))
> -         (_ (and (values #f #f)))))
> -      (_ (and (values #f #f)))))
> +         (_ (and (warning (G_ "package record missing for ~a~%") pkg)
> +                 (values #f #f)))))
> +      (_ (and (info (G_ "not sorting top-level S-exp.: ~a~%") pkg)
> +              (values #f #f)))))

You shouldn’t rely on the return value of ‘info’, ‘warning’, etc.:
they’re not specified (that’s generally the case for procedures called
for side effects only).

So I’d recommend:

  (begin
    (info …)
    (values #f #f))

(You don’t even need ‘begin’ in this context.)

The other patches LGTM, though perhaps ‘tests/guix-style.sh’ could be
augmented a bit to cover the new cases?

Thanks,
Ludo’.




This bug report was last modified 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.