public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sort-makefile-lines.py: Allow '_' in name and "^# name"
@ 2024-02-15 11:27 H.J. Lu
  2024-02-15 12:16 ` Florian Weimer
  2024-02-15 12:25 ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: H.J. Lu @ 2024-02-15 11:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: carlos

'_' is used in Makefile variable names and many variables end with
"^# name".  Relax sort-makefile-lines.py to allow '_' in name and
"^# name" as variable end.  This fixes BZ #31385.
---
 scripts/sort-makefile-lines.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/sort-makefile-lines.py b/scripts/sort-makefile-lines.py
index f65ee40e27..ea02412d67 100755
--- a/scripts/sort-makefile-lines.py
+++ b/scripts/sort-makefile-lines.py
@@ -129,7 +129,7 @@ def sort_makefile_lines():
     for i in range(len(lines)):
         # Look for things like "var = \", "var := \" or "var += \"
         # to start the sorted list.
-        var = re.search(r'^([a-zA-Z0-9-]*) [\+:]?\= \\$', lines[i])
+        var = re.search(r'^([a-zA-Z0-9-_]*) [\+:]?\= \\$', lines[i])
         if var:
             # Remember the index and the name.
             startmarks.append((i, var.group(1)))
@@ -139,8 +139,8 @@ def sort_makefile_lines():
     # must have the matching comment name for it to be valid.
     rangemarks = []
     for sm in startmarks:
-        # Look for things like "  # var" to end the sorted list.
-        reg = r'^  # ' + sm[1] + r'$'
+        # Look for things like "^ *# var" to end the sorted list.
+        reg = r'^ *# ' + sm[1] + r'$'
         for j in range(sm[0] + 1, len(lines)):
             if re.search(reg, lines[j]):
                 # Remember the block to sort (inclusive).
-- 
2.43.0


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

end of thread, other threads:[~2024-02-15 12:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 11:27 [PATCH] sort-makefile-lines.py: Allow '_' in name and "^# name" H.J. Lu
2024-02-15 12:16 ` Florian Weimer
2024-02-15 12:19   ` H.J. Lu
2024-02-15 12:24     ` Carlos O'Donell
2024-02-15 12:29       ` H.J. Lu
2024-02-15 12:25 ` Andreas Schwab

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