[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnulib-tool.py: Fix sorting of modules when --local-dir is used.
From: |
Collin Funk |
Subject: |
[PATCH] gnulib-tool.py: Fix sorting of modules when --local-dir is used. |
Date: |
Mon, 25 Mar 2024 22:27:53 -0700 |
User-agent: |
Mozilla Thunderbird |
The Coreutils test case fails because of this diff (in part at least):
--- ./test-coreutils-1.result/m4/gnulib-comp.m4 2024-03-25 19:19:30.371888468
-0700
+++ tmp116344-result/m4/gnulib-comp.m4 2024-03-25 20:17:01.642173500 -0700
@@ -42,6 +42,7 @@
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_PROG_AR_RANLIB])
+ AC_REQUIRE([AM_PROG_CC_C_O])
# Code from module absolute-header:
# Code from module accept:
# Code from module accept-tests:
@@ -104,7 +105,6 @@
# Code from module btoc32-tests:
# Code from module btowc:
# Code from module btowc-tests:
- # Code from module buffer-lcm:
# Code from module builtin-expect:
# Code from module byteswap:
# Code from module byteswap-tests:
@@ -170,8 +170,6 @@
# Code from module chown:
# Code from module chown-tests:
# Code from module chownat:
- # Code from module cl-strtod:
- # Code from module cl-strtold:
I don't want to send 200 lines of diff, but these are all placed at
the end by gnulib-tool.py. This seems to be because gnulib-tool.sh
sorts by module name, but gnulib-tool.py sorts by file path.
Since gnulib-tool.py stores --local-dir modules relative to destdir
and non --local-dir modules as absolute paths (not sure if this is
*always* true) they are sorted differently.
For gnulib-tool.py:
/home/collin/modules/zzz < gl/modules/aaa
but for gnulib-tool.sh:
zzz > aaa
The solution to this would be to change GLModule.__lt__() to use the
module name instead of the file path [1]. I feel that, for
consistency, all of the comparison operators should be changed in that
case. This seems to be the intended behavior when I read the
"Extending Gnulib" section of the manual [2]. The module name is a
unique identifier and the process for choosing the actual module
description file is given by the --local-dir ordering, correct?
As a side effect of using the module name, calling this function
repeatedly is really slow:
def getName(self):
pattern = re.compile(joinpath('modules', '(.*)$'))
result = pattern.findall(self.path)[0]
return result
Before:
$ time env GNULIB_TOOL_IMPL=py ./test-all.sh
real 0m6.189s
user 0m3.326s
sys 0m2.936s
After:
$ time env GNULIB_TOOL_IMPL=py ./test-all.sh
real 0m23.791s
user 0m20.847s
sys 0m2.950s
But that is an easy fix. I just have to figure out how to write it so
that it isn't ugly. :)
[1] https://docs.python.org/3/howto/sorting.html#odds-and-ends
[2] https://www.gnu.org/software/gnulib/manual/gnulib.html#Extending-Gnulib
Collin
0001-gnulib-tool.py-Fix-sorting-of-modules-when-local-dir.patch
Description: Text Data
- [PATCH] gnulib-tool.py: Fix sorting of modules when --local-dir is used.,
Collin Funk <=
- [PATCH] gnulib-tool.py: Store the module name instead of computing it., Collin Funk, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Bruno Haible, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Collin Funk, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Bruno Haible, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Collin Funk, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Bruno Haible, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Collin Funk, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Bruno Haible, 2024/03/26
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Collin Funk, 2024/03/31
- Re: [PATCH] gnulib-tool.py: Store the module name instead of computing it., Bruno Haible, 2024/03/31