GNU logs - #70499, boring messages


Message sent to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#70499] [PATCH] utils: Add find-unordered-packages procedure.
Resent-From: Herman Rimm <herman@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
Resent-Date: Sun, 21 Apr 2024 18:01:12 +0000
Resent-Message-ID: <handler.70499.B.171372244813267 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 70499
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 70499 <at> debbugs.gnu.org
Cc: Herman Rimm <herman@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.171372244813267
          (code B ref -1); Sun, 21 Apr 2024 18:01:12 +0000
Received: (at submit) by debbugs.gnu.org; 21 Apr 2024 18:00:48 +0000
Received: from localhost ([127.0.0.1]:44092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rybUU-0003QU-Aa
	for submit <at> debbugs.gnu.org; Sun, 21 Apr 2024 14:00:46 -0400
Received: from lists.gnu.org ([2001:470:142::17]:33940)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <herman@HIDDEN>) id 1rybUK-0003Ok-Ss
 for submit <at> debbugs.gnu.org; Sun, 21 Apr 2024 14:00:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <herman@HIDDEN>) id 1rybTz-00006Z-T1
 for guix-patches@HIDDEN; Sun, 21 Apr 2024 14:00:07 -0400
Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]
 helo=email.rimm.ee)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
 (Exim 4.90_1) (envelope-from <herman@HIDDEN>) id 1rybTx-0004kE-Ia
 for guix-patches@HIDDEN; Sun, 21 Apr 2024 14:00:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman;
 t=1713722399;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:
 content-transfer-encoding:content-transfer-encoding;
 bh=P4Hc2P0rNwb3axplX6ma8y5czDIXuQiiAas7NzZ4X6Q=;
 b=JztqxP5fGU3KeWXJyFeEErLkWayvhmtkFL2r++s3Y1mFveJxt1QZsM0yUzEuL4CniXkrcJ
 RXMkaaESUGewPkDaGsFPhID/JlFMHjHlc3YnVm8/akatHnmLafknMgo+63sk6YuAi8sobI
 awKTE0aeFgsoJD19QAsB0mXOeF2MqWIgyzrV9qSFvW0Gix6sULod5LLOU5+VbVhF+3T8z1
 QHMKZo42IOoa7JXd4sevFa0D44UU1D0BDlE61FWJ48TvtalB6Momecl1+BiOAp8I7KuQAL
 XfTI5MZ/Kwixwh9gIadplY6fSppYlWr2QmgFxyicPeXy+dovjrskQKpiZRrWUg==
Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 058b0cdc
 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); 
 Sun, 21 Apr 2024 17:59:58 +0000 (UTC)
From: Herman Rimm <herman@HIDDEN>
Date: Sun, 21 Apr 2024 19:59:49 +0200
Message-ID: <1f19f015e714d68c84cd91618b1340365c8363bb.1713722288.git.herman@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@HIDDEN;
 helo=email.rimm.ee
X-Spam_score_int: 16
X-Spam_score: 1.6
X-Spam_bar: +
X-Spam_report: (1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,
 DKIM_SIGNED=0.1, RCVD_IN_PBL=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

* guix/utils.scm (find-unordered-packages): Add and export procedure.
* tests/utils.scm ("find-unordered-packages"): Add test.

Change-Id: I26ea0fca7d428b192711f75ff3cf5e5a4416b1b6
---
Hello,

I added a procedure which returns the line numbers where packages break
from alphabetical order, e.g.:

  scheme@(guix-user)> (lset-xor eqv? (find-unordered-packages
  "gnu/packages/crates-io.scm"))
  $1 = (626 1153 2693 2715 2840 4074 4139 4187 6099 6243 6382 6896 7677
  9465 10346 11424 12089 12552 12676 12887 16147 16364 16897 18195 18260
  19912 21335 22489 22792 23898 24344 24801 25443 25492 26591 27832
  27944 31206 32365 32502 32609 32770 34281 34913 36192 36320 36621
  36718 36828 37511 38169 39000 39360 39684 40921 41153 41459 41501
  42121 42803 42910 44318 44585 46435 47350 47456 47709 48043 49624
  49905 51084 51216 51560 53586 54473 57062 58925 59048 59134 59584
  59664 59702 59914 62399 66006 66266 66391 68003 68200 68244 70292
  70321 71660 71686 71761 72643 73746 73880 74434 74459 77309 77646
  78136 79569 81722 81896 83802 85617 87167 89037 92212)

It could be extended to also expect package versions in decreasing
order. Maybe I can use it to sort packages automatically later. 

Cheers,
Herman
 guix/utils.scm  | 21 +++++++++++++++++++++
 tests/utils.scm | 19 +++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/guix/utils.scm b/guix/utils.scm
index d8ce6ed886..f690618306 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -148,6 +148,7 @@ (define-module (guix utils)
             delete-expression
             insert-expression
             find-definition-insertion-location
+            find-unordered-packages
 
             filtered-port
             decompressed-port
@@ -531,6 +532,26 @@ (define (find-definition-insertion-location file term)
            (and (not (eof-object? syntax))
                 (syntax-source syntax))))))))
 
+(define (find-unordered-packages file)
+  "Return the line numbers of top-level package definitions whose name
+alphabetically preceeds the previous name."
+  (call-with-input-file file
+    (lambda (port)
+      (let loop ((lst '())
+                 (previous-name ""))
+        (match (read-syntax port)
+          ((? eof-object?)
+           (reverse! lst))
+          (exp
+            (match (syntax->datum exp)
+              (('define-public _ (or ('package _ ('name name) _ ...)
+                                     ('package ('name name) _ ...)))
+               (loop (if (string< name previous-name)
+                         (cons (assoc-ref (syntax-source exp) 'line) lst)
+                         lst)
+                     name))
+              (_ (loop lst previous-name)))))))))
+
 
 ;;;
 ;;; Keyword arguments.
diff --git a/tests/utils.scm b/tests/utils.scm
index 462e43e2b1..8956ea5420 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -303,6 +303,25 @@ (define-public package-2\n  'package)\n"
            (find-definition-insertion-location temp-file term))
          (list 'package 'package-1 'package-2))))
 
+(test-equal "find-unordered-packages"
+  (list 7)
+  (begin
+    (call-with-output-file temp-file
+      (lambda (port)
+        (display "
+(define-public rust-addr2line-0.19
+  (package
+    (inherit rust-addr2line-0.21)
+    (name \"rust-addr2line\")
+    (version \"0.19.0\")))
+
+(define-public rust-addchain-0.2
+  (package
+    (name \"rust-addchain\")
+    (version \"0.2.0\")))
+" port)))
+    (find-unordered-packages temp-file)))
+
 (test-equal "string-distance"
   '(0 1 1 5 5)
   (list

base-commit: a1d711c92e119f6b5b8e99a620cdba92a4ca3bfb
-- 
2.41.0





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Herman Rimm <herman@HIDDEN>
Subject: bug#70499: Acknowledgement ([PATCH] utils: Add find-unordered-packages
 procedure.)
Message-ID: <handler.70499.B.171372244813267.ack <at> debbugs.gnu.org>
References: <1f19f015e714d68c84cd91618b1340365c8363bb.1713722288.git.herman@HIDDEN>
X-Gnu-PR-Message: ack 70499
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 70499 <at> debbugs.gnu.org
Date: Sun, 21 Apr 2024 18:01:15 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

As you requested using X-Debbugs-CC, your message was also forwarded to
  Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>,=
 Ludovic Court=C3=A8s <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, =
Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN=
om>, Tobias Geerinckx-Rice <me@HIDDEN>
(after having been given a bug report number, if it did not have one).

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 70499 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
70499: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70499
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#70499] [PATCH] utils: Add find-unordered-packages procedure.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 01 May 2024 10:32:01 +0000
Resent-Message-ID: <handler.70499.B70499.171455946518622 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70499
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Herman Rimm <herman@HIDDEN>
Cc: Josselin Poiret <dev@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN>, 70499 <at> debbugs.gnu.org
Received: via spool by 70499-submit <at> debbugs.gnu.org id=B70499.171455946518622
          (code B ref 70499); Wed, 01 May 2024 10:32:01 +0000
Received: (at 70499) by debbugs.gnu.org; 1 May 2024 10:31:05 +0000
Received: from localhost ([127.0.0.1]:36648 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s27Ev-0004qI-5F
	for submit <at> debbugs.gnu.org; Wed, 01 May 2024 06:31:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36128)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1s27Er-0004pv-Qc
 for 70499 <at> debbugs.gnu.org; Wed, 01 May 2024 06:31:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1s27EK-00058Z-L8; Wed, 01 May 2024 06:30:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=C2FJzYHUcxdmPTbw3okK19E8JplzycTD1Qoy0VrUdo0=; b=q4MvBQSmOLYVJD1Ptc6H
 v1h1bDfSmN0/k879SVp+N+4RLn/Et6ft5DKccRnVYG1eHBiFcz0MQ5w4q4kDOFi9JPlwuLb0bDx9w
 aJv27VeVk92AXmdx1Tm7Hldec/YjA3+zBrHFKiS7bjcPtVw0di9jgPm/33sBVExO4l2dCmC7B96H9
 BpTw2HP8pjPI4brHbe1LkTuuVw8lht9VTAeqcmb5/cU0D0CWt892UMuvEE1Le/2G8dfFoS5FX9g4s
 vj2MfkTi4yn8R8TQCeUAl1VuZe5YrT0I5+QcmGfEefY5LAuN6elE1iJRya9Pr8DWzvbhgmMo92TTz
 82QPhb/K3oEHnQ==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <1f19f015e714d68c84cd91618b1340365c8363bb.1713722288.git.herman@HIDDEN>
 (Herman Rimm's message of "Sun, 21 Apr 2024 19:59:49 +0200")
References: <1f19f015e714d68c84cd91618b1340365c8363bb.1713722288.git.herman@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Tridi 13 =?UTF-8?Q?Flor=C3=A9al?= an 232 de la
 =?UTF-8?Q?R=C3=A9volution,?= jour du
 =?UTF-8?Q?B=C3=A2ton-d'or?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Wed, 01 May 2024 12:30:20 +0200
Message-ID: <87o79p7rk3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Herman,

Herman Rimm <herman@HIDDEN> skribis:

> * guix/utils.scm (find-unordered-packages): Add and export procedure.
> * tests/utils.scm ("find-unordered-packages"): Add test.
>
> Change-Id: I26ea0fca7d428b192711f75ff3cf5e5a4416b1b6
> ---
> Hello,
>
> I added a procedure which returns the line numbers where packages break
> from alphabetical order, e.g.:
>
>   scheme@(guix-user)> (lset-xor eqv? (find-unordered-packages
>   "gnu/packages/crates-io.scm"))
>   $1 =3D (626 1153 2693 2715 2840 4074 4139 4187 6099 6243 6382 6896 7677
>   9465 10346 11424 12089 12552 12676 12887 16147 16364 16897 18195 18260
>   19912 21335 22489 22792 23898 24344 24801 25443 25492 26591 27832
>   27944 31206 32365 32502 32609 32770 34281 34913 36192 36320 36621
>   36718 36828 37511 38169 39000 39360 39684 40921 41153 41459 41501
>   42121 42803 42910 44318 44585 46435 47350 47456 47709 48043 49624
>   49905 51084 51216 51560 53586 54473 57062 58925 59048 59134 59584
>   59664 59702 59914 62399 66006 66266 66391 68003 68200 68244 70292
>   70321 71660 71686 71761 72643 73746 73880 74434 74459 77309 77646
>   78136 79569 81722 81896 83802 85617 87167 89037 92212)
>
> It could be extended to also expect package versions in decreasing
> order. Maybe I can use it to sort packages automatically later.=20

Nice.  Do you plan to use this procedure in a command-line tool?

> +(define (find-unordered-packages file)
> +  "Return the line numbers of top-level package definitions whose name
> +alphabetically preceeds the previous name."

My first thought when seeing the name is that this was returning a list
of packages, and then I wondered how it differed from =E2=80=98fold-package=
s=E2=80=99
and the likes.

Maybe call it =E2=80=98package-definition-alphabetical-sort-breakage=E2=80=
=99 or
something like that?

Thanks,
Ludo=E2=80=99.





Last modified: Wed, 1 May 2024 10:45:02 UTC

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