Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/sets distrib/sets/list-fmt: sort commented entries l...
details: https://anonhg.NetBSD.org/src/rev/3b1eb9fc839f
branches: trunk
changeset: 952727:3b1eb9fc839f
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Feb 15 23:00:03 2021 +0000
description:
distrib/sets/list-fmt: sort commented entries like regular entries
Seen in lists/modules/ad.aarch64, among others. These lines are not
intended as comments but as regular entries that just happen to be
commented out.
This is the same as how pkglint treats commented variable assignments,
which take part in aligning blocks of variable assignments even though
they are syntactically comments.
diffstat:
distrib/sets/fmt-list | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diffs (49 lines):
diff -r dc2e7472a6c5 -r 3b1eb9fc839f distrib/sets/fmt-list
--- a/distrib/sets/fmt-list Mon Feb 15 22:39:46 2021 +0000
+++ b/distrib/sets/fmt-list Mon Feb 15 23:00:03 2021 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: fmt-list,v 1.3 2020/11/02 20:14:01 rillig Exp $
+-- $NetBSD: fmt-list,v 1.4 2021/02/15 23:00:03 rillig Exp $
--[[
@@ -106,10 +106,10 @@
local function parse_entry(line)
local category_align, prefix, fullname, flags_align, category, flags =
- line:match("^((%-?)(%.%S*)%s+)((%S+)%s+)(%S+)$")
+ line:match("^(([#%-]?)(%.%S*)%s+)((%S+)%s+)(%S+)$")
if fullname == nil then
category_align, prefix, fullname, category =
- line:match("^((%-?)(%.%S*)%s+)(%S+)$")
+ line:match("^(([#%-]?)(%.%S*)%s+)(%S+)$")
end
if fullname == nil then
prefix, fullname = line:match("^(%-)(%.%S*)$")
@@ -153,6 +153,16 @@
assert_equals(entry.category, "category")
assert_equals(entry.flags_col, 16)
assert_equals(entry.flags, "flags")
+
+ entry = parse_entry("#./dirname/filename\tcat\tflags")
+ assert_equals(entry.prefix, "#")
+ assert_equals(entry.fullname, "./dirname/filename")
+ assert_equals(entry.dirname, "./dirname")
+ assert_equals(entry.basename, "filename")
+ assert_equals(entry.category_col, 24)
+ assert_equals(entry.category, "cat")
+ assert_equals(entry.flags_col, 8)
+ assert_equals(entry.flags, "flags")
end)
@@ -397,6 +407,8 @@
if line ~= prev_line then
prev_line = line
f:write(line, "\n")
+ else
+ --print(string.format("%s: duplicate entry: %s", fname, line))
end
end
Home |
Main Index |
Thread Index |
Old Index