unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42289: recursive import does not dort alphabetically
@ 2020-07-09  7:53 Hartmut Goebel
  2020-07-09  9:36 ` zimoun
  2022-03-08  9:19 ` zimoun
  0 siblings, 2 replies; 10+ messages in thread
From: Hartmut Goebel @ 2020-07-09  7:53 UTC (permalink / raw)
  To: 42289

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@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09  7:53 bug#42289: recursive import does not dort alphabetically Hartmut Goebel
@ 2020-07-09  9:36 ` zimoun
  2020-07-09 11:26   ` Hartmut Goebel
  2022-03-08  9:19 ` zimoun
  1 sibling, 1 reply; 10+ messages in thread
From: zimoun @ 2020-07-09  9:36 UTC (permalink / raw)
  To: Hartmut Goebel, 42289

Dear,

On Thu, 09 Jul 2020 at 09:53, Hartmut Goebel <h.goebel@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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09  9:36 ` zimoun
@ 2020-07-09 11:26   ` Hartmut Goebel
  2020-07-09 14:02     ` zimoun
  2020-07-09 17:39     ` Leo Famulari
  0 siblings, 2 replies; 10+ messages in thread
From: Hartmut Goebel @ 2020-07-09 11:26 UTC (permalink / raw)
  To: zimoun, 42289

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@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09 11:26   ` Hartmut Goebel
@ 2020-07-09 14:02     ` zimoun
  2020-07-09 17:39     ` Leo Famulari
  1 sibling, 0 replies; 10+ messages in thread
From: zimoun @ 2020-07-09 14:02 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 42289

On Thu, 9 Jul 2020 at 13:26, Hartmut Goebel
<h.goebel@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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09 11:26   ` Hartmut Goebel
  2020-07-09 14:02     ` zimoun
@ 2020-07-09 17:39     ` Leo Famulari
  2020-07-15 19:10       ` Hartmut Goebel
  1 sibling, 1 reply; 10+ messages in thread
From: Leo Famulari @ 2020-07-09 17:39 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 42289

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>




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09 17:39     ` Leo Famulari
@ 2020-07-15 19:10       ` Hartmut Goebel
  2020-07-16 11:35         ` zimoun
  2020-07-16 18:23         ` Leo Famulari
  0 siblings, 2 replies; 10+ messages in thread
From: Hartmut Goebel @ 2020-07-15 19:10 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 42289

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@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-15 19:10       ` Hartmut Goebel
@ 2020-07-16 11:35         ` zimoun
  2020-07-16 11:41           ` Julien Lepiller
  2020-07-16 18:23         ` Leo Famulari
  1 sibling, 1 reply; 10+ messages in thread
From: zimoun @ 2020-07-16 11:35 UTC (permalink / raw)
  To: Hartmut Goebel, Leo Famulari; +Cc: 42289

Dear Hartmut,

On Wed, 15 Jul 2020 at 21:10, Hartmut Goebel <h.goebel@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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-16 11:35         ` zimoun
@ 2020-07-16 11:41           ` Julien Lepiller
  0 siblings, 0 replies; 10+ messages in thread
From: Julien Lepiller @ 2020-07-16 11:41 UTC (permalink / raw)
  To: zimoun, Hartmut Goebel, Leo Famulari; +Cc: 42289

Le 16 juillet 2020 07:35:23 GMT-04:00, zimoun <zimon.toutoune@gmail.com> a écrit :
>Dear Hartmut,
>
>On Wed, 15 Jul 2020 at 21:10, Hartmut Goebel
><h.goebel@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-15 19:10       ` Hartmut Goebel
  2020-07-16 11:35         ` zimoun
@ 2020-07-16 18:23         ` Leo Famulari
  1 sibling, 0 replies; 10+ messages in thread
From: Leo Famulari @ 2020-07-16 18:23 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 42289

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.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42289: recursive import does not dort alphabetically
  2020-07-09  7:53 bug#42289: recursive import does not dort alphabetically Hartmut Goebel
  2020-07-09  9:36 ` zimoun
@ 2022-03-08  9:19 ` zimoun
  1 sibling, 0 replies; 10+ messages in thread
From: zimoun @ 2022-03-08  9:19 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 42289

Hi Hartmut,

On jeu., 09 juil. 2020 at 09:53, Hartmut Goebel <h.goebel@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




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-08 10:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  7:53 bug#42289: recursive import does not dort alphabetically Hartmut Goebel
2020-07-09  9:36 ` zimoun
2020-07-09 11:26   ` Hartmut Goebel
2020-07-09 14:02     ` zimoun
2020-07-09 17:39     ` Leo Famulari
2020-07-15 19:10       ` Hartmut Goebel
2020-07-16 11:35         ` zimoun
2020-07-16 11:41           ` Julien Lepiller
2020-07-16 18:23         ` Leo Famulari
2022-03-08  9:19 ` zimoun

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).