Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2024-03-12 Thread Paride Legovini
On 2024-03-12 00:33, Johannes Schauer Marin Rodrigues wrote:
> Hi,
> 
> On Wed, 6 Mar 2024 11:04:01 +0100 Paride Legovini  wrote:
>> On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung  wrote:
>>> Time to join this discussion. The current default was the preference of
>>> the author 14 years ago. My taste has change a bit since then. I am open
>>> to change the default. --trailing-comma for wrapped lines is a good
>>> idea, --short-indent is okay. I don't like --wrap-always in case there
>>> are only two or three entries.
>>>
>>> The new default should not only based on the preference, but also on
>>> what is used the most. Can someone collect the information: which teams
>>> use which options, how many packages use what?
>>
>> I did some unscientific research on codesearch looking for d/changelog 
>> entries
>> mentioning `wrap-and-sort -` (i.e. wrap-and-sort with some options). This is
>> the query:
>>
>> https://codesearch.debian.net/search?q=path%3Adebian%2Fchangelog+wrap-and-sort+-=1
>>
>> Apparently -a is the single most used option, very often used together with
>> -s and -t. I found similar results by searching GitHub:
>>
>> https://github.com/search?q=path%3Adebian%2Fchangelog+%22wrap-and-sort+-%22=code
>>
>> Looks like salsa (GitLab Free) doesn't allow to do instance-wide code 
>> searches.
> 
> I disagree that the new default should be what is used the most. For example
> debhelper versions do not become the default only after they are used the 
> most.
> The thing that makes switching defaults easier for debhelper is the explicit
> opt-in for a new debhelper compat version which we don't have for 
> wrap-and-sort
> and I think it would very much be over-engineering to add such a feature for
> something that is, in my opinion, of very little consequence. Furthermore, I
> would not be surprised if many people using wrap-and-sort use the default
> expecting that this is what is most well-liked by the project (because why 
> else
> would it be the default?). The question was asked in this email sub-thread:
> 
> https://lists.debian.org/161289428547.4135738.4002254931040787...@auryn.jones.dk
> 
> In that thread, same as in this bug, -ast was proposed as the default and
> unless I missed something, there were no objections on debian-devel. Some even
> argued, to make -b the default as well. So instead of asking "what is used
> most" I'd like to ask, are there users of wrap-and-sort without -ast who would
> be strongly against having to pass -AST to overwrite a potential new default?
> 
> That being said, I downloaded all debian/control files for all 36832 source
> packages in Debian and ran the following shell script on them to figure out 
> how
> many source packages comply with which wrap-and-sort set of options:
> 
> for p in control/*; do
>   rm -f debian/control;
>   ln -s "../$p" debian/control;
>   for opt in "" -a -as -ast -astb -at -atb -ab -s -st -stb -sb -t -tb -b; 
> do
>   wrap-and-sort --dry-run --file=debian/control $opt \
>   | grep --quiet debian/control \
>   || echo $p >> w-a-s$opt;
>   done
> done
> 
> It's of course still not possible to say whether a control file adheres to a
> certain wrap-and-sort formatting style by accident or intentionally. Also,
> packages can easily fall in multiple categories at the same time, for example
> packages with only a single binary package which comply with -ast will
> automatically also comply with -astb. There are also packages which comply 
> with
> -ast as well as with no options at all simply because they have no
> Build-Depends nor Depends fields in debian/control. Here is the result sorted
> by popularity in ascending order:
> 
> 96 wrap-and-sort -st
> 96 wrap-and-sort -stb
>434 wrap-and-sort -as
>465 wrap-and-sort -tb
>489 wrap-and-sort -t
>579 wrap-and-sort -atb
>641 wrap-and-sort -at
>   1341 wrap-and-sort -sb
>   1405 wrap-and-sort -s
>   2381 wrap-and-sort -astb
>   2705 wrap-and-sort -ast
>   2732 wrap-and-sort -b
>   3020 wrap-and-sort
>   3950 wrap-and-sort -ab
>   4089 wrap-and-sort -a
> 
> So, wrap-and-sort -ast is very popular but it is not as popular as the current
> default.

Hi josch and thanks for this analysis. I'll try to recap where we are at this
point, focusing only on -ast (I'll ignore -bk here).

1. This bug (#895570) requests -ast to be the default. The proposal received
mostly positive feedback, however bdrung doesn't like -a in case there are
only two or three entries. He also thinks we should consider what is already
popular.

--> Looks like everybody likes (or is ok with) having -st by default.

2. Using codesearch I looked for what options are the most popular when
w-a-s is mentioned with options in d/changelog. Looks like the most
popular option is -a (often together with others).

3. josch checked how many src packages in the archive are already compliant
with a w-a-s option set, and found results which agree with 

Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2024-03-11 Thread Johannes Schauer Marin Rodrigues
Hi,

On Wed, 6 Mar 2024 11:04:01 +0100 Paride Legovini  wrote:
> On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung  wrote:
> > Time to join this discussion. The current default was the preference of
> > the author 14 years ago. My taste has change a bit since then. I am open
> > to change the default. --trailing-comma for wrapped lines is a good
> > idea, --short-indent is okay. I don't like --wrap-always in case there
> > are only two or three entries.
> > 
> > The new default should not only based on the preference, but also on
> > what is used the most. Can someone collect the information: which teams
> > use which options, how many packages use what?
> 
> I did some unscientific research on codesearch looking for d/changelog entries
> mentioning `wrap-and-sort -` (i.e. wrap-and-sort with some options). This is
> the query:
> 
> https://codesearch.debian.net/search?q=path%3Adebian%2Fchangelog+wrap-and-sort+-=1
> 
> Apparently -a is the single most used option, very often used together with
> -s and -t. I found similar results by searching GitHub:
> 
> https://github.com/search?q=path%3Adebian%2Fchangelog+%22wrap-and-sort+-%22=code
> 
> Looks like salsa (GitLab Free) doesn't allow to do instance-wide code 
> searches.

I disagree that the new default should be what is used the most. For example
debhelper versions do not become the default only after they are used the most.
The thing that makes switching defaults easier for debhelper is the explicit
opt-in for a new debhelper compat version which we don't have for wrap-and-sort
and I think it would very much be over-engineering to add such a feature for
something that is, in my opinion, of very little consequence. Furthermore, I
would not be surprised if many people using wrap-and-sort use the default
expecting that this is what is most well-liked by the project (because why else
would it be the default?). The question was asked in this email sub-thread:

https://lists.debian.org/161289428547.4135738.4002254931040787...@auryn.jones.dk

In that thread, same as in this bug, -ast was proposed as the default and
unless I missed something, there were no objections on debian-devel. Some even
argued, to make -b the default as well. So instead of asking "what is used
most" I'd like to ask, are there users of wrap-and-sort without -ast who would
be strongly against having to pass -AST to overwrite a potential new default?

That being said, I downloaded all debian/control files for all 36832 source
packages in Debian and ran the following shell script on them to figure out how
many source packages comply with which wrap-and-sort set of options:

for p in control/*; do
rm -f debian/control;
ln -s "../$p" debian/control;
for opt in "" -a -as -ast -astb -at -atb -ab -s -st -stb -sb -t -tb -b; 
do
wrap-and-sort --dry-run --file=debian/control $opt \
| grep --quiet debian/control \
|| echo $p >> w-a-s$opt;
done
done

It's of course still not possible to say whether a control file adheres to a
certain wrap-and-sort formatting style by accident or intentionally. Also,
packages can easily fall in multiple categories at the same time, for example
packages with only a single binary package which comply with -ast will
automatically also comply with -astb. There are also packages which comply with
-ast as well as with no options at all simply because they have no
Build-Depends nor Depends fields in debian/control. Here is the result sorted
by popularity in ascending order:

96 wrap-and-sort -st
96 wrap-and-sort -stb
   434 wrap-and-sort -as
   465 wrap-and-sort -tb
   489 wrap-and-sort -t
   579 wrap-and-sort -atb
   641 wrap-and-sort -at
  1341 wrap-and-sort -sb
  1405 wrap-and-sort -s
  2381 wrap-and-sort -astb
  2705 wrap-and-sort -ast
  2732 wrap-and-sort -b
  3020 wrap-and-sort
  3950 wrap-and-sort -ab
  4089 wrap-and-sort -a

So, wrap-and-sort -ast is very popular but it is not as popular as the current
default.

Do with that data what you wish. :)

Thanks!

cheers, josch

signature.asc
Description: signature


Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2024-03-06 Thread Paride Legovini
Hi Benjamin,

On Sun, 03 Mar 2024 16:26:41 +0100 Benjamin Drung  wrote:
> Time to join this discussion. The current default was the preference of
> the author 14 years ago. My taste has change a bit since then. I am open
> to change the default. --trailing-comma for wrapped lines is a good
> idea, --short-indent is okay. I don't like --wrap-always in case there
> are only two or three entries.
> 
> The new default should not only based on the preference, but also on
> what is used the most. Can someone collect the information: which teams
> use which options, how many packages use what?

I did some unscientific research on codesearch looking for d/changelog entries
mentioning `wrap-and-sort -` (i.e. wrap-and-sort with some options). This is
the query:

https://codesearch.debian.net/search?q=path%3Adebian%2Fchangelog+wrap-and-sort+-=1

Apparently -a is the single most used option, very often used together with
-s and -t. I found similar results by searching GitHub:

https://github.com/search?q=path%3Adebian%2Fchangelog+%22wrap-and-sort+-%22=code

Looks like salsa (GitLab Free) doesn't allow to do instance-wide code searches.

> When we change the default, the parameters to disable those again need
> some short options.

If we want short parameters for the --no- parameters I think the
most sensible option are capital letters (e.g. -T for --no-trailing-comma).
In [1] I added the --no- options using argparse.BooleanOptionalAction,
which we won't be able to use if we also want short options (we'll need a
full parser.add_argument() definition for each I believe). Less nice but
not a deal breaker.

As not all the people reading the bug may know, there is now a MR aiming at
changing the defaults [2].

Cheers,

Paride

[1] https://salsa.debian.org/debian/devscripts/-/merge_requests/390
[2] https://salsa.debian.org/debian/devscripts/-/merge_requests/392



Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2024-03-03 Thread Benjamin Drung
On Thu, 12 Apr 2018 15:23:47 -0400 Daniel Kahn Gillmor
 wrote:
> Package: devscripts
> Version: 2.18.1
> Severity: wishlist
> 
> Thanks for wrap-and-sort!  It's great to have nice canonicalized-form
> debian packaging.
> 
> Using wrap-and-sort with -ast provides the simplest, cleanest diffs as
> things change, while still producing an easy-to-read debian/control.
> 
> I think these three options (--wrap-always, --short-indent,
> --trailing-comma) should be the default.  (this might mean adding
> inverted options for the people who really insist on using
> wrap-and-sort in some other way).

Time to join this discussion. The current default was the preference of
the author 14 years ago. My taste has change a bit since then. I am open
to change the default. --trailing-comma for wrapped lines is a good
idea, --short-indent is okay. I don't like --wrap-always in case there
are only two or three entries.

The new default should not only based on the preference, but also on
what is used the most. Can someone collect the information: which teams
use which options, how many packages use what?

When we change the default, the parameters to disable those again need
some short options.

-- 
Benjamin Drung
Debian & Ubuntu Developer



Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2018-04-23 Thread Daniel Kahn Gillmor
On Mon 2018-04-23 14:10:02 +0200, Dominique Dumont wrote:
> I do believe that we should have one so tool writers can have a reference to 
> implement and people would not see changes when using different formatting or 
> generation tools (e.g dh-make-perl, cme, wrap-and-sort). 

makes sense to me.

> That said, I think that having formatting options (like --wrap-always --short-
> indent) kind of defeat that purpose because people have different ideas on 
> what looks best.

sure, but they're all wrong except for me, right? :P

> Back to cme and wrap-and-sort, I'd really like to converge on formatting so 
> that both tools provide the same output (I've already changed the way 
> dependencies are sorted to match wrap-and-sort algorithm).
>  
> If we allow formatting options, these options should be saved in a file 
> (should that be a local or global conf file ? or both ?) so that cme and wrap-
> and-sort can produce the same result with a simple command.

perhaps the options could go someplace like debian/source/canonicalize ?

--dkg



Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2018-04-23 Thread Dominique Dumont
Hi

Sorry for the late reply

On Thursday, 12 April 2018 21:43:02 CEST Mattia Rizzolo wrote:
> > Thanks for wrap-and-sort!  It's great to have nice canonicalized-form
> > debian packaging.
> 
> You should also check out cme :)

I can only agree :-D

> > I think these three options (--wrap-always, --short-indent,
> > --trailing-comma) should be the default.
> 
> I'd like to converge togethre with cme, so I'm CCing its maintainer to
> see whether he has an opinion.  If so I'd clone the bug so he can do it
> as well.

I don't have a very strong opinion on what should be the canonical format of 
debian control files.

I do believe that we should have one so tool writers can have a reference to 
implement and people would not see changes when using different formatting or 
generation tools (e.g dh-make-perl, cme, wrap-and-sort). 

That said, I think that having formatting options (like --wrap-always --short-
indent) kind of defeat that purpose because people have different ideas on 
what looks best.

Back to cme and wrap-and-sort, I'd really like to converge on formatting so 
that both tools provide the same output (I've already changed the way 
dependencies are sorted to match wrap-and-sort algorithm).
 
If we allow formatting options, these options should be saved in a file 
(should that be a local or global conf file ? or both ?) so that cme and wrap-
and-sort can produce the same result with a simple command.

> (TTBOMK cme doesn't allow configuring this detail, it only does the
> equivalent of plain `wrap-and-sort` in this regard).

yes. Some part of cme are generic (for cme dpkg, cme ssh, cme systemd...) and 
do not support formatting options.

I'm currently simplifying the reader/writer classes (aka backend) so adding 
formatting options to cme should be easier.

I've cc'ed debian-perl team, they often have good ideas to smooth packaging 
workflow.

Thoughts ?

All the best

Dod



Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2018-04-12 Thread Mattia Rizzolo
Hi Daniel,

On Thu, Apr 12, 2018 at 03:23:47PM -0400, Daniel Kahn Gillmor wrote:
> Thanks for wrap-and-sort!  It's great to have nice canonicalized-form
> debian packaging.

You should also check out cme :)

> Using wrap-and-sort with -ast provides the simplest, cleanest diffs as
> things change, while still producing an easy-to-read debian/control.

I agree, that's also the one I love the most ^^

> I think these three options (--wrap-always, --short-indent,
> --trailing-comma) should be the default.

I'd like to converge togethre with cme, so I'm CCing its maintainer to
see whether he has an opinion.  If so I'd clone the bug so he can do it
as well.
(TTBOMK cme doesn't allow configuring this detail, it only does the
equivalent of plain `wrap-and-sort` in this regard).

-- 
regards,
Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540  .''`.
more about me:  https://mapreri.org : :'  :
Launchpad user: https://launchpad.net/~mapreri  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-


signature.asc
Description: PGP signature


Bug#895570: devscripts: wrap-and-sort should default to -ast (--wrap-always, --short-indent, --trailing-comma)

2018-04-12 Thread Daniel Kahn Gillmor
Package: devscripts
Version: 2.18.1
Severity: wishlist

Thanks for wrap-and-sort!  It's great to have nice canonicalized-form
debian packaging.

Using wrap-and-sort with -ast provides the simplest, cleanest diffs as
things change, while still producing an easy-to-read debian/control.

I think these three options (--wrap-always, --short-indent,
--trailing-comma) should be the default.  (this might mean adding
inverted options for the people who really insist on using
wrap-and-sort in some other way).

  --dkg

-- Package-specific info:

--- /etc/devscripts.conf ---

--- ~/.devscripts ---
DEBSIGN_KEYID=0EE5BE979282D80B9F7540F1CCD2ED94D21739E9

-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'oldstable'), 
(200, 'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages devscripts depends on:
ii  dpkg-dev  1.19.0.5
ii  libc6 2.27-3
ii  libfile-homedir-perl  1.002-1
ii  perl  5.26.1-5
ii  python3   3.6.4-1
ii  sensible-utils0.0.12

Versions of packages devscripts recommends:
ii  apt 1.6~beta1
ii  at  3.1.20-3.1
ii  curl7.58.0-2
ii  dctrl-tools 2.24-2+b1
ii  debian-keyring  2018.03.24
ii  dput-ng [dput]  1.18
ii  dupload 2.9.1
ii  equivs  2.1.0
ii  fakeroot1.22-2
ii  file1:5.32-2
ii  gnupg   2.2.5-1
ii  gnupg2  2.2.5-1
ii  libdistro-info-perl 0.18
ii  libdpkg-perl1.19.0.5
ii  libencode-locale-perl   1.05-1
pn  libgit-wrapper-perl 
pn  liblist-compare-perl
ii  liblwp-protocol-https-perl  6.07-2
pn  libsoap-lite-perl   
ii  liburi-perl 1.73-1
ii  libwww-perl 6.33-1
pn  licensecheck
ii  lintian 2.5.81
ii  man-db  2.8.2-1
ii  patch   2.7.6-2
ii  patchutils  0.3.4-2
ii  python3-apt 1.6.0~rc2
ii  python3-debian  0.1.32
ii  python3-magic   2:0.4.15-1
ii  python3-requests2.18.4-2
pn  python3-unidiff 
pn  python3-xdg 
ii  strace  4.21-1
ii  unzip   6.0-21
ii  wdiff   1.2.2-2
ii  wget1.19.4-1
ii  xz-utils5.2.2-1.3

Versions of packages devscripts suggests:
pn  adequate   
ii  autopkgtest5.2
pn  bls-standalone 
ii  build-essential12.4
pn  check-all-the-things   
pn  cvs-buildpackage   
ii  devscripts-el  36.4
ii  diffoscope 93
pn  disorderfs 
pn  dose-extra 
pn  duck   
ii  faketime   0.9.7-2
pn  gnuplot
ii  gpgv   2.2.5-1
ii  gpgv2  2.2.5-1
ii  heirloom-mailx [mailx] 12.5-4
pn  how-can-i-help 
pn  libauthen-sasl-perl
pn  libfile-desktopentry-perl  
pn  libnet-smtps-perl  
pn  libterm-size-perl  
ii  libtimedate-perl   2.3000-2
pn  libyaml-syck-perl  
ii  mailutils [mailx]  1:3.4-1
ii  mozilla-devscripts 0.47
pn  mutt   
ii  openssh-client [ssh-client]1:7.7p1-2
pn  piuparts   
ii  postgresql-client-10 [postgresql-client]   10.3-2
ii  postgresql-client-9.5 [postgresql-client]  9.5.4-3
ii  postgresql-client-9.6 [postgresql-client]  9.6.5-1
ii  quilt  0.63-8.2
pn  ratt   
ii  reprotest  0.7.7
ii  svn-buildpackage   0.8.6
ii  w3m0.5.3-36

-- no debconf information