pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkgtools/pkglint: update to 20.4.2
details: https://anonhg.NetBSD.org/pkgsrc/rev/ee3d4d2ed5e3
branches: trunk
changeset: 449238:ee3d4d2ed5e3
user: rillig <rillig%pkgsrc.org@localhost>
date: Mon Mar 22 23:26:30 2021 +0000
description:
pkgtools/pkglint: update to 20.4.2
Changes since 20.4.1:
Error out on package directories that differ only in case. This ensures
that pkgsrc can be used on case-insensitive file systems as well, such
as on macOS or Windows.
diffstat:
pkgtools/pkglint/Makefile | 4 ++--
pkgtools/pkglint/files/category.go | 21 ++++++++++++++++++---
pkgtools/pkglint/files/category_test.go | 29 +++++++++++++++++++++++++++++
pkgtools/pkglint/files/logging.go | 3 +++
pkgtools/pkglint/files/package_test.go | 3 +--
5 files changed, 53 insertions(+), 7 deletions(-)
diffs (127 lines):
diff -r b2577639e2d5 -r ee3d4d2ed5e3 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon Mar 22 22:35:45 2021 +0000
+++ b/pkgtools/pkglint/Makefile Mon Mar 22 23:26:30 2021 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.680 2021/03/20 23:32:43 rillig Exp $
+# $NetBSD: Makefile,v 1.681 2021/03/22 23:26:30 rillig Exp $
-PKGNAME= pkglint-20.4.1
+PKGNAME= pkglint-20.4.2
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
diff -r b2577639e2d5 -r ee3d4d2ed5e3 pkgtools/pkglint/files/category.go
--- a/pkgtools/pkglint/files/category.go Mon Mar 22 22:35:45 2021 +0000
+++ b/pkgtools/pkglint/files/category.go Mon Mar 22 23:26:30 2021 +0000
@@ -1,6 +1,9 @@
package pkglint
-import "netbsd.org/pkglint/textproc"
+import (
+ "netbsd.org/pkglint/textproc"
+ "strings"
+)
func CheckdirCategory(dir CurrPath) {
if trace.Tracing {
@@ -53,6 +56,7 @@
}
seen := make(map[RelPath]*MkLine)
+ seenLower := make(map[string]subdir)
for !mlex.EOF() {
mkline := mlex.CurrentMkLine()
@@ -76,6 +80,15 @@
}
seen[sub] = mkline
+ lowerSub := strings.ToLower(sub.String())
+ if lower := seenLower[lowerSub]; lower.line != nil && lower.name != sub {
+ mkline.Errorf("On case-insensitive file systems, "+
+ "%q is the same as %q from %s.",
+ sub, lower.name, mkline.RelMkLine(lower.line))
+ } else {
+ seenLower[lowerSub] = subdir{sub, mkline}
+ }
+
if len(mSubdirs) > 0 {
if prev := mSubdirs[len(mSubdirs)-1].name; sub < prev {
mkline.Warnf("%q should come before %q.", sub, prev)
@@ -127,9 +140,11 @@
fRest = fRest[1:]
} else if len(fRest) == 0 || mRest[0].name < fRest[0] {
- if !fCheck[mRest[0].name] {
+ mName := mRest[0].name
+ if !fCheck[mName] &&
+ seenLower[strings.ToLower(mName.String())].name == mName {
fix := mRest[0].line.Autofix()
- fix.Errorf("%q does not contain a package.", mRest[0].name)
+ fix.Errorf("%q does not contain a package.", mName)
fix.Delete()
fix.Apply()
}
diff -r b2577639e2d5 -r ee3d4d2ed5e3 pkgtools/pkglint/files/category_test.go
--- a/pkgtools/pkglint/files/category_test.go Mon Mar 22 22:35:45 2021 +0000
+++ b/pkgtools/pkglint/files/category_test.go Mon Mar 22 23:26:30 2021 +0000
@@ -437,3 +437,32 @@
t.CheckOutputLines(
"ERROR: Makefile:5: \"sub2\" does not contain a package.")
}
+
+func (s *Suite) Test_CheckdirCategory__case_insensitive_file_system(c *check.C) {
+ t := s.Init(c)
+
+ t.SetUpPackage("category/PACKAGE")
+ t.SetUpPackage("category/Package") // may overwrite PACKAGE
+ t.SetUpPackage("category/package") // may overwrite PACKAGE
+ t.CreateFileLines("mk/misc/category.mk")
+ t.CreateFileLines("category/Makefile",
+ MkCvsID,
+ "",
+ "COMMENT=\tCategory comment",
+ "",
+ "SUBDIR+=\tPACKAGE",
+ "SUBDIR+=\tPackage",
+ "SUBDIR+=\tpackage",
+ "",
+ ".include \"../mk/misc/category.mk\"")
+ t.Chdir("category")
+ t.FinishSetUp()
+
+ G.Check(".")
+
+ t.CheckOutputLines(
+ "ERROR: Makefile:6: On case-insensitive file systems, "+
+ "\"Package\" is the same as \"PACKAGE\" from line 5.",
+ "ERROR: Makefile:7: On case-insensitive file systems, "+
+ "\"package\" is the same as \"PACKAGE\" from line 5.")
+}
diff -r b2577639e2d5 -r ee3d4d2ed5e3 pkgtools/pkglint/files/logging.go
--- a/pkgtools/pkglint/files/logging.go Mon Mar 22 22:35:45 2021 +0000
+++ b/pkgtools/pkglint/files/logging.go Mon Mar 22 23:26:30 2021 +0000
@@ -295,6 +295,9 @@
if !filename.IsEmpty() {
filename = filename.CleanPath()
}
+ if filename == "." {
+ filename = NewCurrPath("")
+ }
if G.Profiling && format != autofixFormat {
l.histo.Add(format, 1)
}
diff -r b2577639e2d5 -r ee3d4d2ed5e3 pkgtools/pkglint/files/package_test.go
--- a/pkgtools/pkglint/files/package_test.go Mon Mar 22 22:35:45 2021 +0000
+++ b/pkgtools/pkglint/files/package_test.go Mon Mar 22 23:26:30 2021 +0000
@@ -3210,9 +3210,8 @@
G.Check(".")
- // TODO: Remove the ".:", it is more confusing than helpful.
t.CheckOutputLines(
- "NOTE: .: Please only commit changes " +
+ "NOTE: Please only commit changes " +
"that maintainer%example.org@localhost would approve.")
}
Home |
Main Index |
Thread Index |
Old Index