pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/pkglint
Module Name: pkgsrc
Committed By: rillig
Date: Sun Oct 2 14:39:37 UTC 2022
Modified Files:
pkgsrc/pkgtools/pkglint: Makefile
pkgsrc/pkgtools/pkglint/files: mklines.go options_test.go pkgsrc.go
substcontext.go tools.go util.go varalignblock.go vardefs.go
Log Message:
pkgtools/pkglint: update to 22.3.0
Changes since 22.2.7:
Pkglint no longer wrongly warns about package options from optional or
required option groups. Fixes PR 57038.
To generate a diff of this commit:
cvs rdiff -u -r1.730 -r1.731 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.74 -r1.75 pkgsrc/pkgtools/pkglint/files/mklines.go
cvs rdiff -u -r1.25 -r1.26 pkgsrc/pkgtools/pkglint/files/options_test.go \
pkgsrc/pkgtools/pkglint/files/tools.go
cvs rdiff -u -r1.66 -r1.67 pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.39 -r1.40 pkgsrc/pkgtools/pkglint/files/substcontext.go
cvs rdiff -u -r1.83 -r1.84 pkgsrc/pkgtools/pkglint/files/util.go
cvs rdiff -u -r1.19 -r1.20 pkgsrc/pkgtools/pkglint/files/varalignblock.go
cvs rdiff -u -r1.105 -r1.106 pkgsrc/pkgtools/pkglint/files/vardefs.go
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/pkglint/Makefile
diff -u pkgsrc/pkgtools/pkglint/Makefile:1.730 pkgsrc/pkgtools/pkglint/Makefile:1.731
--- pkgsrc/pkgtools/pkglint/Makefile:1.730 Mon Sep 26 18:40:18 2022
+++ pkgsrc/pkgtools/pkglint/Makefile Sun Oct 2 14:39:36 2022
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.730 2022/09/26 18:40:18 bsiegert Exp $
+# $NetBSD: Makefile,v 1.731 2022/10/02 14:39:36 rillig Exp $
-PKGNAME= pkglint-22.2.7
-PKGREVISION= 1
+PKGNAME= pkglint-22.3.0
CATEGORIES= pkgtools
MAINTAINER= rillig%NetBSD.org@localhost
Index: pkgsrc/pkgtools/pkglint/files/mklines.go
diff -u pkgsrc/pkgtools/pkglint/files/mklines.go:1.74 pkgsrc/pkgtools/pkglint/files/mklines.go:1.75
--- pkgsrc/pkgtools/pkglint/files/mklines.go:1.74 Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/mklines.go Sun Oct 2 14:39:37 2022
@@ -368,6 +368,22 @@ func (mklines *MkLines) defineVar(mkline
func (mklines *MkLines) collectPlistVars() {
// TODO: The PLIST_VARS code above looks very similar.
for _, mkline := range mklines.mklines {
+
+ // In options.mk, add option groups to PKG_SUPPORTED_OPTIONS.
+ if mkline.IsInclude() && mkline.IncludedFile() == "../../mk/bsd.options.mk" {
+ mklines.allVars.def("PKG_SUPPORTED_OPTIONS", mkline)
+ supported := mklines.allVars.vs["PKG_SUPPORTED_OPTIONS"]
+ optional := mklines.allVars.LastValue("PKG_OPTIONS_OPTIONAL_GROUPS")
+ required := mklines.allVars.LastValue("PKG_OPTIONS_REQUIRED_GROUPS")
+
+ for _, opt := range mkline.ValueFields(optional) {
+ supported.value += mklines.allVars.LastValue("PKG_OPTIONS_GROUP." + opt)
+ }
+ for _, opt := range mkline.ValueFields(required) {
+ supported.value += mklines.allVars.LastValue("PKG_OPTIONS_GROUP." + opt)
+ }
+ }
+
if mkline.IsVarassign() {
switch mkline.Varcanon() {
case "PLIST_VARS":
Index: pkgsrc/pkgtools/pkglint/files/options_test.go
diff -u pkgsrc/pkgtools/pkglint/files/options_test.go:1.25 pkgsrc/pkgtools/pkglint/files/options_test.go:1.26
--- pkgsrc/pkgtools/pkglint/files/options_test.go:1.25 Fri Jul 31 22:39:36 2020
+++ pkgsrc/pkgtools/pkglint/files/options_test.go Sun Oct 2 14:39:37 2022
@@ -423,6 +423,69 @@ func (s *Suite) Test_CheckLinesOptionsMk
"WARN: options.mk:5: Option \"two\" should be handled below in an .if block.")
}
+// https://gnats.netbsd.org/57038
+func (s *Suite) Test_CheckLinesOptionsMk__PLIST_VARS_based_on_groups(c *check.C) {
+ t := s.Init(c)
+
+ t.SetUpOption("one", "")
+ t.SetUpOption("two", "")
+ t.SetUpOption("opt-one", "")
+ t.SetUpOption("opt-two", "")
+ t.SetUpOption("req-one", "")
+ t.SetUpOption("req-two", "")
+ t.SetUpPackage("category/package")
+ t.CreateFileLines("mk/bsd.options.mk")
+ t.SetUpFileMkLines("category/package/options.mk",
+ MkCvsID,
+ "",
+ "PKG_OPTIONS_VAR=\tPKG_OPTIONS.package",
+ "PKG_SUPPORTED_OPTIONS+=\tone two",
+ "",
+ "PKG_OPTIONS_OPTIONAL_GROUPS+=\topt",
+ "PKG_OPTIONS_GROUP.opt+=\t\topt-one opt-two",
+ "",
+ "PKG_OPTIONS_REQUIRED_GROUPS+=\treq",
+ "PKG_OPTIONS_GROUP.req+=\t\treq-one req-two",
+ "",
+ // bsd.options.mk adds the options from the groups to
+ // PKG_SUPPORTED_OPTIONS. So does MkLines.collectPlistVars.
+ ".include \"../../mk/bsd.options.mk\"",
+ "",
+ // All 6 options are added at this point.
+ "PLIST_VARS+=\t${PKG_SUPPORTED_OPTIONS}",
+ "",
+ // Only the 'one' options are covered properly, the 'two'
+ // options produce warnings, to demonstrate that all cases of
+ // option groups are covered.
+ ".if ${PKG_OPTIONS:Mone}",
+ "PLIST.one=\tyes",
+ ".endif",
+ ".if ${PKG_OPTIONS:Mopt-one}",
+ "PLIST.opt-one=\tyes",
+ ".endif",
+ ".if ${PKG_OPTIONS:Mreq-one}",
+ "PLIST.req-one=\tyes",
+ ".endif")
+ t.Chdir("category/package")
+ t.FinishSetUp()
+
+ G.Check(".")
+
+ t.CheckOutputLines(
+ "WARN: options.mk:14: \"two\" is added to PLIST_VARS, "+
+ "but PLIST.two is not defined in this file.",
+ "WARN: options.mk:14: \"opt-two\" is added to PLIST_VARS, "+
+ "but PLIST.opt-two is not defined in this file.",
+ "WARN: options.mk:14: \"req-two\" is added to PLIST_VARS, "+
+ "but PLIST.req-two is not defined in this file.",
+ "WARN: options.mk:4: Option \"two\" "+
+ "should be handled below in an .if block.",
+ "WARN: options.mk:7: Option \"opt-two\" "+
+ "should be handled below in an .if block.",
+ "WARN: options.mk:10: Option \"req-two\" "+
+ "should be handled below in an .if block.")
+}
+
// A few packages (such as www/w3m) define several options that are
// handled by a single .if block in the lower part.
func (s *Suite) Test_CheckLinesOptionsMk__combined_option_handling(c *check.C) {
Index: pkgsrc/pkgtools/pkglint/files/tools.go
diff -u pkgsrc/pkgtools/pkglint/files/tools.go:1.25 pkgsrc/pkgtools/pkglint/files/tools.go:1.26
--- pkgsrc/pkgtools/pkglint/files/tools.go:1.25 Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/tools.go Sun Oct 2 14:39:37 2022
@@ -14,7 +14,7 @@ type Tool struct {
Name string // e.g. "sed", "gzip"
Varname string // e.g. "SED", "GZIP_CMD"
- // Some of the very simple tools (echo, printf, test) differ in their implementations.
+ // Some basic tools (echo, printf, test) differ in their implementations.
//
// When bmake encounters a "simple" command line, it bypasses the
// call to a shell (see devel/bmake/files/compat.c:/useShell/).
Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.66 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.67
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.66 Sat Jan 1 12:44:25 2022
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go Sun Oct 2 14:39:37 2022
@@ -438,7 +438,7 @@ func (src *Pkgsrc) checkRemovedAfterLast
for _, change := range wrong {
// The original line of the change is not available anymore.
- // Therefore it is necessary to load the whole file again.
+ // Therefore, it is necessary to load the whole file again.
lines := Load(change.Location.Filename, MustSucceed)
line := lines.Lines[change.Location.lineno-1]
line.Errorf("Package %s must either exist or be marked as removed.", change.Pkgpath.String())
@@ -1127,7 +1127,7 @@ func (src *Pkgsrc) guessVariableType(var
// looked up from the pkgsrc infrastructure.
//
// As of May 2019, pkglint only distinguishes plain variables and
- // list variables, but not "unknown". Therefore the above patterns
+ // list variables, but not "unknown". Therefore, the above patterns
// must take precedence over this rule, because otherwise, list
// variables from the infrastructure would be guessed to be plain
// variables.
Index: pkgsrc/pkgtools/pkglint/files/substcontext.go
diff -u pkgsrc/pkgtools/pkglint/files/substcontext.go:1.39 pkgsrc/pkgtools/pkglint/files/substcontext.go:1.40
--- pkgsrc/pkgtools/pkglint/files/substcontext.go:1.39 Sat Jun 20 07:00:44 2020
+++ pkgsrc/pkgtools/pkglint/files/substcontext.go Sun Oct 2 14:39:37 2022
@@ -526,7 +526,7 @@ func (b *substBlock) suggestSubstVars(mk
fix.Apply()
// At this point the number of SUBST_SED assignments is one
- // less than before. Therefore it is possible to adjust the
+ // less than before. Therefore, it is possible to adjust the
// assignment operators on them. It's probably not worth the
// effort, though.
@@ -607,7 +607,8 @@ func (*substBlock) extractVarname(token
}
func (b *substBlock) isComplete() bool {
- return b.allSeen().hasAll(ssStage | ssFiles | ssTransform)
+ seen := b.allSeen()
+ return seen.hasAll(ssStage | ssFiles | ssTransform)
}
func (b *substBlock) hasSeen(part substSeen) bool {
@@ -789,6 +790,6 @@ func (s *substSeen) has(part substSeen)
return *s&part != 0
}
-func (s substSeen) hasAll(other substSeen) bool { return s&other == other }
-func (s *substSeen) addAll(other substSeen) { *s |= other }
-func (s *substSeen) retainAll(other substSeen) { *s &= other }
+func (s *substSeen) hasAll(other substSeen) bool { return *s&other == other }
+func (s *substSeen) addAll(other substSeen) { *s |= other }
+func (s *substSeen) retainAll(other substSeen) { *s &= other }
Index: pkgsrc/pkgtools/pkglint/files/util.go
diff -u pkgsrc/pkgtools/pkglint/files/util.go:1.83 pkgsrc/pkgtools/pkglint/files/util.go:1.84
--- pkgsrc/pkgtools/pkglint/files/util.go:1.83 Sun Jan 16 19:14:52 2022
+++ pkgsrc/pkgtools/pkglint/files/util.go Sun Oct 2 14:39:37 2022
@@ -275,7 +275,7 @@ func assertNotNil(obj interface{}) {
}
}
-// assert checks that the condition is true. Otherwise it terminates the
+// assert checks that the condition is true. Otherwise, it terminates the
// process with a fatal error message, prefixed with "Pkglint internal error".
//
// This method must only be used for programming errors.
@@ -286,7 +286,7 @@ func assert(cond bool) {
}
}
-// assertf checks that the condition is true. Otherwise it terminates the
+// assertf checks that the condition is true. Otherwise, it terminates the
// process with a fatal error message, prefixed with "Pkglint internal error".
//
// This method must only be used for programming errors.
@@ -434,7 +434,7 @@ func alignWith(str, other string) string
}
// alignmentTo returns the whitespace that is necessary to
-// bring str to the same width as other.
+// bring str to the same width as the other one.
func alignmentTo(str, other string) string {
strWidth := tabWidth(str)
otherWidth := tabWidth(other)
Index: pkgsrc/pkgtools/pkglint/files/varalignblock.go
diff -u pkgsrc/pkgtools/pkglint/files/varalignblock.go:1.19 pkgsrc/pkgtools/pkglint/files/varalignblock.go:1.20
--- pkgsrc/pkgtools/pkglint/files/varalignblock.go:1.19 Sun Mar 15 11:31:24 2020
+++ pkgsrc/pkgtools/pkglint/files/varalignblock.go Sun Oct 2 14:39:37 2022
@@ -466,7 +466,7 @@ func (l *varalignMkLine) isMultiEmpty()
// rightMargin calculates the column in which the continuation backslashes
// should be placed.
-// In addition it returns whether the right margin is already in its
+// In addition, it returns whether the right margin is already in its
// canonical form.
func (l *varalignMkLine) rightMargin() (ok bool, margin int) {
restIndex := condInt(l.infos[0].value == "", 1, 0)
Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.105 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.106
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.105 Sun Jul 24 20:07:20 2022
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go Sun Oct 2 14:39:37 2022
@@ -1926,8 +1926,8 @@ func (reg *VarTypeRegistry) parsePermiss
// more general. Most variables that can be used at load time
// can also be used at run time.
//
- // Using a variable at load time is a special access that
- // applies to fewer variables. Therefore it comes last.
+ // Using a variable at load time occurs rarely, and it
+ // applies to fewer variables. Therefore, it comes last.
remove("use", aclpUse)
remove("use-loadtime", aclpUseLoadtime)
Home |
Main Index |
Thread Index |
Old Index