getsolus / ypkg

Modern, declarative, structured build format
https://getsol.us
GNU General Public License v3.0
22 stars 11 forks source link

ybump, yupdate: use max line length of input yaml for output width #46

Closed Staudey closed 11 months ago

Staudey commented 11 months ago

This uses the maximum line length to set the output width for the yaml dump in ybump and yupdate. This avoids having to set a ridiculously large width parameter (there is no way to have it accept arbitrary widths). Without this the scripts mess up formatting for e.g. very long descriptions (or any other line/value longer than 200 characters), which then leads to errors during the package build or other operations.

One could also parse each element of the yaml to find the largest one, but I couldn't quite figure that one out without it getting a bit too complicated

Disadvantage here is that it read the input file twice (once to get the "raw" lines, ones to parse it into a yaml dict). It still happens in the blink of an eye, but it's of course not ideal.

Example akonadi:

ybump result before:

ybump result after: