[PATCH v3 1/2] scripts: Add sort-makefile-lines.py to sort Makefile variables.

Carlos O'Donell carlos@redhat.com
Wed May 10 15:07:43 GMT 2023


On 5/10/23 08:42, Alejandro Colomar wrote:
> I believe you're looking for a version sort(1).

Yes, sort -V does work, the downside is the integration to handle the blocks
of text in the Makefile.

> I don't know how easy it is to call sort(1) in this script, but it
> would probably simplify a big part of it.  And it would also make
> unnecessary the renaming of things like 'tst-mutex7robust'.

You don't *need* to rename any tests in the new version of the code, I took
out the error case and just sort as the new function sorts (like sort -V does).

> If using `sort -V` here is complex, maybe it's easier to write a
> shell script.

I would want to use bash with arrays to handle lines and processing the start
and end blocks. It could be possible to do it in an equivalent number of lines,
but I think the standalone python is easier to read and maintain (less shell
quoting issues with lines of text).

Any objection to the proposed python?

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list