GNU bug report logs - #42289
recursive import does not dort alphabetically

Previous Next

Package: guix;

Reported by: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Date: Thu, 9 Jul 2020 07:54:02 UTC

Severity: normal

To reply to this bug, email your comments to 42289 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 09 Jul 2020 07:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 09 Jul 2020 07:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: bug-guix <bug-guix <at> gnu.org>
Subject: recursive import does not dort alphabetically
Date: Thu, 9 Jul 2020 09:53:05 +0200
In most gnu/packages/*.scm files are (expected to be) sorted alphabetically.

Now when importing some packages recursivly, packages are output in
order of the dependency graph, thus authors need to sort them manually.

Example (requires the hex.pm importer from
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42180>:

$ ./pre-inst-env guix import hexpm -r idna | grep define-public
(define-public erlang-unicode-util-compat
(define-public erlang-idna
$ ./pre-inst-env guix import hexpm -r idna | grep define-public |
LC_ALL=C sort --check
sort: -:2: disorder: (define-public erlang-idna

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 09 Jul 2020 09:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>, 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 09 Jul 2020 11:36:23 +0200
Dear,

On Thu, 09 Jul 2020 at 09:53, Hartmut Goebel <h.goebel <at> crazy-compilers.com> wrote:
> In most gnu/packages/*.scm files are (expected to be) sorted
> alphabetically.

Do you mean the package definitions in gnu/packages/foo.scm?
Because they are generally not alphabetically sorted.  Well, it really
depends on which module, from what I see.


All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 09 Jul 2020 11:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: zimoun <zimon.toutoune <at> gmail.com>, 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 9 Jul 2020 13:26:03 +0200
Am 09.07.20 um 11:36 schrieb zimoun:
> Do you mean the package definitions in gnu/packages/foo.scm?

Yes.

> Because they are generally not alphabetically sorted.

Most file I've been working on ask for sorting alphabetically. (And IMHO
this is a good recommendation to follow.)

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 09 Jul 2020 14:03:01 GMT) Full text and rfc822 format available.

Message #14 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 9 Jul 2020 16:02:37 +0200
On Thu, 9 Jul 2020 at 13:26, Hartmut Goebel
<h.goebel <at> crazy-compilers.com> wrote:

> > Because they are generally not alphabetically sorted.
>
> Most file I've been working on ask for sorting alphabetically. (And IMHO
> this is a good recommendation to follow.)

Well, I get:

295 gnu/packages/unsorted-file.scm
204 gnu/packages/sorted-file.scm

And the top 10 bigger files are unsorted:

--8<---------------cut here---------------start------------->8---
crates-io.scm
sort: -:6: disorder: (define-public rust-afl-0.4
emacs-xyz.scm
sort: -:2: disorder: (define-public emacs-ac-geiser
cran.scm
sort: -:3: disorder: (define-public r-dot
python-xyz.scm
sort: -:2: disorder: (define-public python-colorlog
bioinformatics.scm
sort: -:9: disorder: (define-public blasr-libcpp
haskell-xyz.scm
sort: -:238: disorder: (define-public ghc-llvm-hs
java.scm
sort: -:2: disorder: (define-public drip
games.scm
sort: -:13: disorder: (define-public foobillard++
lisp-xyz.scm
sort: -:2: disorder: (define-public cl-alexandria
perl.scm
sort: -:17: disorder: (define-public perl-b-hooks-endofscope
--8<---------------cut here---------------end--------------->8---

BTW, I agree that alphabetical sorting is a good recommendation.

All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 09 Jul 2020 17:41:01 GMT) Full text and rfc822 format available.

Message #17 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 42289 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 9 Jul 2020 13:39:55 -0400
On Thu, Jul 09, 2020 at 01:26:03PM +0200, Hartmut Goebel wrote:
> Most file I've been working on ask for sorting alphabetically. (And IMHO
> this is a good recommendation to follow.)

What are the benefits of sorting packages?

The ordering of packages is not usually important to the machine, and
humans can search for the package names.

I think that sorting the packages is not necessarily desired, especially
for modules where a lot of packages may be imported (e.g. Rust). It
makes the Git diffs harder to understand and work with when merging or
rebasing, compared to just adding the new packages at the end of the
file.

In cases where packages are inherited to create multiple package
versions, alphanumerical sorting breaks the inheritance [0], although
inheritance is problematic in its own right and we should probably stop
using it.

[0] See <https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00040.html>




Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Wed, 15 Jul 2020 19:11:02 GMT) Full text and rfc822 format available.

Message #20 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 42289 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Wed, 15 Jul 2020 21:10:45 +0200
Am 09.07.20 um 19:39 schrieb Leo Famulari:
> What are the benefits of sorting packages?

Many modules are sorted and some packages even contain a comment asking
for being sorted. So I had the impression this is good practice.

Also scanning through the file is easier for humans if packages are
sorted - depends on personal work style.


-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 16 Jul 2020 11:36:01 GMT) Full text and rfc822 format available.

Message #23 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>,
 Leo Famulari <leo <at> famulari.name>
Cc: 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 16 Jul 2020 13:35:23 +0200
Dear Hartmut,

On Wed, 15 Jul 2020 at 21:10, Hartmut Goebel <h.goebel <at> crazy-compilers.com> wrote

> Many modules are sorted and some packages even contain a comment asking
> for being sorted. So I had the impression this is good practice.

I am not sure by the "many". :-)
Even gnu/packages/crate-io.scm which explicitly asks:

;;; Please: Try to add new module packages in alphabetic order.

and it is not really sorted. :-)

  cat crates-io.scm | grep 'define-public' | sort --check
  sort: -:6: disorder: (define-public rust-afl-0.5


> Also scanning through the file is easier for humans if packages are
> sorted - depends on personal work style.

It appears to me as a "good practise" too.  On the other hand,
personally I always scan the packages with "ag" (inside Emacs).


However, it is not the point since your initial request is about
alphabetical sort of "guix import"; which seems better than arbitrary
order (dependency order).  Whatever if gnu/packages/foo.scm is sorted or
not.

If "guix import" returns an alphanumerical sorted list, it is easier and
it does not bother the unsorted modules since the packages are new.

All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 16 Jul 2020 11:43:01 GMT) Full text and rfc822 format available.

Message #26 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: zimoun <zimon.toutoune <at> gmail.com>,
 Hartmut Goebel <h.goebel <at> crazy-compilers.com>,
 Leo Famulari <leo <at> famulari.name>
Cc: 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 16 Jul 2020 07:41:58 -0400
Le 16 juillet 2020 07:35:23 GMT-04:00, zimoun <zimon.toutoune <at> gmail.com> a écrit :
>Dear Hartmut,
>
>On Wed, 15 Jul 2020 at 21:10, Hartmut Goebel
><h.goebel <at> crazy-compilers.com> wrote
>
>> Many modules are sorted and some packages even contain a comment
>asking
>> for being sorted. So I had the impression this is good practice.
>
>I am not sure by the "many". :-)
>Even gnu/packages/crate-io.scm which explicitly asks:
>
>;;; Please: Try to add new module packages in alphabetic order.
>
>and it is not really sorted. :-)
>
>  cat crates-io.scm | grep 'define-public' | sort --check
>  sort: -:6: disorder: (define-public rust-afl-0.5
>
>
>> Also scanning through the file is easier for humans if packages are
>> sorted - depends on personal work style.
>
>It appears to me as a "good practise" too.  On the other hand,
>personally I always scan the packages with "ag" (inside Emacs).
>
>
>However, it is not the point since your initial request is about
>alphabetical sort of "guix import"; which seems better than arbitrary
>order (dependency order).  Whatever if gnu/packages/foo.scm is sorted
>or
>not.

The advantage of dependency-sorting is that it makes it easier to add packages one by one without breaking anything. If they are alphabetically sorted, which package do you add first? What if the first one depends on another imported package? Your first commit will be broken because of a reference to an unexisting package.

>
>If "guix import" returns an alphanumerical sorted list, it is easier
>and
>it does not bother the unsorted modules since the packages are new.
>
>All the best,
>simon





Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Thu, 16 Jul 2020 18:25:01 GMT) Full text and rfc822 format available.

Message #29 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 42289 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Thu, 16 Jul 2020 14:23:51 -0400
On Wed, Jul 15, 2020 at 09:10:45PM +0200, Hartmut Goebel wrote:
> Many modules are sorted and some packages even contain a comment asking
> for being sorted. So I had the impression this is good practice.
> 
> Also scanning through the file is easier for humans if packages are
> sorted - depends on personal work style.

To clarify, I don't think that sorting packages alphanumerically is bad
or good. It's largely a matter of taste, and I don't think we need to
make a policy either way.




Information forwarded to bug-guix <at> gnu.org:
bug#42289; Package guix. (Tue, 08 Mar 2022 10:23:02 GMT) Full text and rfc822 format available.

Message #32 received at 42289 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 42289 <at> debbugs.gnu.org
Subject: Re: bug#42289: recursive import does not dort alphabetically
Date: Tue, 08 Mar 2022 10:19:01 +0100
Hi Hartmut,

On jeu., 09 juil. 2020 at 09:53, Hartmut Goebel <h.goebel <at> crazy-compilers.com> wrote:
> In most gnu/packages/*.scm files are (expected to be) sorted alphabetically.

While I agree with this recommendation to sort alphabetically
gnu/packages/*.scm...

> Now when importing some packages recursivly, packages are output in
> order of the dependency graph, thus authors need to sort them manually.

...I think it is not a good idea to sort alphabetically the output of
the importers, because:

 1. the packages have to be added dependency-sorted,
 2. since each imported package is not alphabetically adjacent in the
 larger collection of already available packages, the user still needs
 to find the correct location.

Therefore, I am in favor to close this issue as wontfix notabug.  WDYT?


Cheers,
simon




This bug report was last modified 3 years and 97 days ago.

Previous Next


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