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:           Mon Jun  1 20:49:54 UTC 2020

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: buildlink3.go buildlink3_test.go
            check_test.go distinfo.go line.go lines.go mkassignchecker.go
            mkline.go mklinechecker.go mklinechecker_test.go mkvarusechecker.go
            mkvarusechecker_test.go package.go patches.go path.go path_test.go
            pkglint.go pkgsrc.go plist.go tools.go util.go vardefs.go
            vartype.go vartypecheck.go vartypecheck_test.go

Log Message:
pkgtools/pkglint: update to 20.1.12

Changes since 20.1.11:

The file bsd.pkg.mk must only ever be included by package Makefiles
directly, not by other Makefile fragments.  Seen in www/w3m.

The variable BUILDLINK_PREFIX.* should only be used for packages that
have actually been included by the package.  This catches the use of
BUILDLINK_PREFIX.libiconv, which should have been iconv instead.

Allow comments before line 3 in buildlink3.mk files. This is necessary
for mariadb55-client since its buildlink identifier is mysql-client,
which is so non-obvious that it needs to be documented.


To generate a diff of this commit:
cvs rdiff -u -r1.650 -r1.651 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.35 -r1.36 pkgsrc/pkgtools/pkglint/files/buildlink3.go
cvs rdiff -u -r1.43 -r1.44 pkgsrc/pkgtools/pkglint/files/buildlink3_test.go
cvs rdiff -u -r1.70 -r1.71 pkgsrc/pkgtools/pkglint/files/check_test.go
cvs rdiff -u -r1.44 -r1.45 pkgsrc/pkgtools/pkglint/files/distinfo.go
cvs rdiff -u -r1.46 -r1.47 pkgsrc/pkgtools/pkglint/files/line.go
cvs rdiff -u -r1.13 -r1.14 pkgsrc/pkgtools/pkglint/files/lines.go
cvs rdiff -u -r1.7 -r1.8 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
cvs rdiff -u -r1.79 -r1.80 pkgsrc/pkgtools/pkglint/files/mkline.go
cvs rdiff -u -r1.67 -r1.68 pkgsrc/pkgtools/pkglint/files/mklinechecker.go
cvs rdiff -u -r1.61 -r1.62 \
    pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go
cvs rdiff -u -r1.8 -r1.9 pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go
cvs rdiff -u -r1.10 -r1.11 \
    pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go \
    pkgsrc/pkgtools/pkglint/files/path.go
cvs rdiff -u -r1.90 -r1.91 pkgsrc/pkgtools/pkglint/files/package.go
cvs rdiff -u -r1.41 -r1.42 pkgsrc/pkgtools/pkglint/files/patches.go
cvs rdiff -u -r1.12 -r1.13 pkgsrc/pkgtools/pkglint/files/path_test.go
cvs rdiff -u -r1.81 -r1.82 pkgsrc/pkgtools/pkglint/files/pkglint.go
cvs rdiff -u -r1.55 -r1.56 pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.58 -r1.59 pkgsrc/pkgtools/pkglint/files/plist.go
cvs rdiff -u -r1.23 -r1.24 pkgsrc/pkgtools/pkglint/files/tools.go
cvs rdiff -u -r1.77 -r1.78 pkgsrc/pkgtools/pkglint/files/util.go
cvs rdiff -u -r1.96 -r1.97 pkgsrc/pkgtools/pkglint/files/vardefs.go
cvs rdiff -u -r1.49 -r1.50 pkgsrc/pkgtools/pkglint/files/vartype.go
cvs rdiff -u -r1.89 -r1.90 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.80 -r1.81 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.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.650 pkgsrc/pkgtools/pkglint/Makefile:1.651
--- pkgsrc/pkgtools/pkglint/Makefile:1.650      Fri May 29 20:13:17 2020
+++ pkgsrc/pkgtools/pkglint/Makefile    Mon Jun  1 20:49:54 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.650 2020/05/29 20:13:17 rillig Exp $
+# $NetBSD: Makefile,v 1.651 2020/06/01 20:49:54 rillig Exp $
 
-PKGNAME=       pkglint-20.1.11
+PKGNAME=       pkglint-20.1.12
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}

Index: pkgsrc/pkgtools/pkglint/files/buildlink3.go
diff -u pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.35 pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.36
--- pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.35    Fri May  8 19:50:04 2020
+++ pkgsrc/pkgtools/pkglint/files/buildlink3.go Mon Jun  1 20:49:54 2020
@@ -72,6 +72,9 @@ func (ck *Buildlink3Checker) Check() {
 
 func (ck *Buildlink3Checker) checkFirstParagraph(mlex *MkLinesLexer) bool {
 
+       for mlex.SkipPrefix("#") {
+       }
+
        // First paragraph: Introduction of the package identifier
        m := mlex.NextRegexp(`^BUILDLINK_TREE\+=[\t ]*([^\t ]+)$`)
        if m == nil {
@@ -104,7 +107,7 @@ func (ck *Buildlink3Checker) checkUnique
        }
 
        dirname := G.Pkgsrc.Rel(mkline.Filename().Dir()).Base()
-       base, name := trimCommon(pkgbase, dirname)
+       base, name := trimCommon(pkgbase, dirname.String())
        if base == "" && matches(name, `^(\d*|-cvs|-fossil|-git|-hg|-svn|-devel|-snapshot)$`) {
                return
        }
@@ -315,6 +318,7 @@ func (ck *Buildlink3Checker) checkVaruse
 
 type Buildlink3Data struct {
        id             Buildlink3ID
+       prefix         Path
        pkgsrcdir      PackagePath
        apiDepends     *DependencyPattern
        apiDependsLine *MkLine
@@ -331,43 +335,50 @@ type Buildlink3ID string
 
 func LoadBuildlink3Data(mklines *MkLines) *Buildlink3Data {
        var data Buildlink3Data
+
        mklines.ForEach(func(mkline *MkLine) {
-               if mkline.IsVarassign() {
-                       varname := mkline.Varname()
-                       varbase := varnameBase(varname)
-                       varid := Buildlink3ID(varnameParam(varname))
-
-                       if varname == "BUILDLINK_TREE" {
-                               value := mkline.Value()
-                               if !hasPrefix(value, "-") {
-                                       data.id = Buildlink3ID(mkline.Value())
-                               }
-                       }
+               if !mkline.IsVarassign() {
+                       return
+               }
 
-                       if varbase == "BUILDLINK_API_DEPENDS" && varid == data.id {
-                               p := NewMkParser(nil, mkline.Value())
-                               dep := p.DependencyPattern()
-                               if dep != nil && p.EOF() {
-                                       data.apiDepends = dep
-                                       data.apiDependsLine = mkline
-                               }
+               varname := mkline.Varname()
+               varbase := varnameBase(varname)
+               varid := Buildlink3ID(varnameParam(varname))
+
+               if varname == "BUILDLINK_TREE" {
+                       value := mkline.Value()
+                       if !hasPrefix(value, "-") {
+                               data.id = Buildlink3ID(mkline.Value())
                        }
+               }
 
-                       if varbase == "BUILDLINK_ABI_DEPENDS" && varid == data.id {
-                               p := NewMkParser(nil, mkline.Value())
-                               dep := p.DependencyPattern()
-                               if dep != nil && p.EOF() {
-                                       data.abiDepends = dep
-                                       data.abiDependsLine = mkline
-                               }
+               if varbase == "BUILDLINK_API_DEPENDS" && varid == data.id {
+                       p := NewMkParser(nil, mkline.Value())
+                       dep := p.DependencyPattern()
+                       if dep != nil && p.EOF() {
+                               data.apiDepends = dep
+                               data.apiDependsLine = mkline
                        }
+               }
 
-                       if varbase == "BUILDLINK_PKGSRCDIR" && varid == data.id {
-                               data.pkgsrcdir = NewPackagePathString(mkline.Value())
+               if varbase == "BUILDLINK_ABI_DEPENDS" && varid == data.id {
+                       p := NewMkParser(nil, mkline.Value())
+                       dep := p.DependencyPattern()
+                       if dep != nil && p.EOF() {
+                               data.abiDepends = dep
+                               data.abiDependsLine = mkline
                        }
                }
+
+               if varbase == "BUILDLINK_PREFIX" && varid == data.id {
+                       data.prefix = NewPath(mkline.Value())
+               }
+               if varbase == "BUILDLINK_PKGSRCDIR" && varid == data.id {
+                       data.pkgsrcdir = NewPackagePathString(mkline.Value())
+               }
        })
-       if data.id != "" && !data.pkgsrcdir.IsEmpty() && data.apiDepends != nil && data.abiDepends != nil {
+
+       if data.id != "" {
                return &data
        }
        return nil

Index: pkgsrc/pkgtools/pkglint/files/buildlink3_test.go
diff -u pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.43 pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.44
--- pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.43       Wed Mar 18 08:24:49 2020
+++ pkgsrc/pkgtools/pkglint/files/buildlink3_test.go    Mon Jun  1 20:49:54 2020
@@ -506,6 +506,35 @@ func (s *Suite) Test_Buildlink3Checker_C
        t.CheckOutputEmpty()
 }
 
+func (s *Suite) Test_Buildlink3Checker_checkFirstParagraph__comment_before_tree(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPkgsrc()
+       t.SetUpPackage("category/package")
+       t.CreateFileLines("category/package/buildlink3.mk",
+               MkCvsID,
+               "",
+               "# comment",
+               "BUILDLINK_TREE+=\tpackage",
+               "",
+               ".if !defined(PACKAGE_BUILDLINK3_MK)",
+               "PACKAGE_BUILDLINK3_MK:=",
+               "",
+               "BUILDLINK_API_DEPENDS.package+=\tpackage>=0",
+               "BUILDLINK_PKGSRCDIR.package?=\t../../category/package",
+               "BUILDLINK_DEPMETHOD.package?=\tbuild",
+               "",
+               ".endif # PACKAGE_BUILDLINK3_MK",
+               "",
+               "BUILDLINK_TREE+=\t-package")
+       t.FinishSetUp()
+
+       G.Check(t.File("category/package/buildlink3.mk"))
+
+       // No warning in line 3. Comments are ok there.
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_Buildlink3Checker_checkUniquePkgbase(c *check.C) {
        t := s.Init(c)
 

Index: pkgsrc/pkgtools/pkglint/files/check_test.go
diff -u pkgsrc/pkgtools/pkglint/files/check_test.go:1.70 pkgsrc/pkgtools/pkglint/files/check_test.go:1.71
--- pkgsrc/pkgtools/pkglint/files/check_test.go:1.70    Sat May 23 08:51:07 2020
+++ pkgsrc/pkgtools/pkglint/files/check_test.go Mon Jun  1 20:49:54 2020
@@ -498,7 +498,7 @@ func (t *Tester) SetUpPackage(pkgpath Re
        mlines := []string{
                MkCvsID,
                "",
-               "DISTNAME=\t" + distname + "-1.0",
+               "DISTNAME=\t" + distname.String() + "-1.0",
                "#PKGNAME=\tpackage-1.0",
                "CATEGORIES=\t" + category.String(),
                "MASTER_SITES=\t# none",
@@ -589,7 +589,7 @@ func (t *Tester) CreateFileDummyPatch(fi
 
 func (t *Tester) CreateFileBuildlink3(filename RelPath, customLines ...string) {
        lower := filename.Dir().Base()
-       t.CreateFileBuildlink3Id(filename, lower, customLines...)
+       t.CreateFileBuildlink3Id(filename, lower.String(), customLines...)
 }
 
 func (t *Tester) CreateFileBuildlink3Id(filename RelPath, id string, customLines ...string) {
@@ -739,7 +739,7 @@ func (t *Tester) SetUpHierarchy() (
                fromDir := including.Dir().Clean()
                to := basedir.Rel(included.AsPath())
                if fromDir == to.Dir() {
-                       return NewRelPathString(to.Base())
+                       return to.Base()
                } else {
                        return fromDir.Rel(basedir).JoinNoClean(to).CleanDot()
                }
@@ -1001,9 +1001,9 @@ func (t *Tester) NewLine(filename CurrPa
 func (t *Tester) NewMkLine(filename CurrPath, lineno int, text string) *MkLine {
        basename := filename.Base()
        assertf(
-               hasSuffix(basename, ".mk") ||
+               basename.HasSuffixText(".mk") ||
                        basename == "Makefile" ||
-                       hasPrefix(basename, "Makefile.") ||
+                       basename.HasPrefixText("Makefile.") ||
                        basename == "mk.conf",
                "filename %q must be realistic, otherwise the variable permissions are wrong", filename)
 
@@ -1053,7 +1053,7 @@ func (t *Tester) NewMkLines(filename Cur
 func (t *Tester) NewMkLinesPkg(filename CurrPath, pkg *Package, lines ...string) *MkLines {
        basename := filename.Base()
        assertf(
-               hasSuffix(basename, ".mk") || basename == "Makefile" || hasPrefix(basename, "Makefile."),
+               basename.HasSuffixText(".mk") || basename == "Makefile" || basename.HasPrefixText("Makefile."),
                "filename %q must be realistic, otherwise the variable permissions are wrong", filename)
 
        var rawText strings.Builder

Index: pkgsrc/pkgtools/pkglint/files/distinfo.go
diff -u pkgsrc/pkgtools/pkglint/files/distinfo.go:1.44 pkgsrc/pkgtools/pkglint/files/distinfo.go:1.45
--- pkgsrc/pkgtools/pkglint/files/distinfo.go:1.44      Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/distinfo.go   Mon Jun  1 20:49:54 2020
@@ -35,7 +35,7 @@ func CheckLinesDistinfo(pkg *Package, li
        ck.checkUnrecordedPatches()
 
        if pkg != nil {
-               pkg.distinfoDistfiles = make(map[string]bool)
+               pkg.distinfoDistfiles = make(map[RelPath]bool)
                for path := range ck.infos {
                        pkg.distinfoDistfiles[path.Base()] = true
                }

Index: pkgsrc/pkgtools/pkglint/files/line.go
diff -u pkgsrc/pkgtools/pkglint/files/line.go:1.46 pkgsrc/pkgtools/pkglint/files/line.go:1.47
--- pkgsrc/pkgtools/pkglint/files/line.go:1.46  Sat Feb 15 13:48:40 2020
+++ pkgsrc/pkgtools/pkglint/files/line.go       Mon Jun  1 20:49:54 2020
@@ -56,7 +56,7 @@ type Line struct {
        // TODO: Consider storing pointers to the Filename and Basename instead of strings to save memory.
        //  But first find out where and why pkglint needs so much memory (200 MB for a full recursive run over pkgsrc + wip).
        Location Location
-       Basename string // the last component of the Filename
+       Basename RelPath // the last component of the Filename
 
        // the text of the line, without the trailing newline character;
        // in Makefiles, also contains the text from the continuation lines,

Index: pkgsrc/pkgtools/pkglint/files/lines.go
diff -u pkgsrc/pkgtools/pkglint/files/lines.go:1.13 pkgsrc/pkgtools/pkglint/files/lines.go:1.14
--- pkgsrc/pkgtools/pkglint/files/lines.go:1.13 Sat Feb 15 13:48:40 2020
+++ pkgsrc/pkgtools/pkglint/files/lines.go      Mon Jun  1 20:49:54 2020
@@ -6,7 +6,7 @@ import (
 
 type Lines struct {
        Filename CurrPath
-       BaseName string // TODO: consider converting to Path
+       BaseName RelPath
        Lines    []*Line
 }
 

Index: pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.7 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.8
--- pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.7        Sat Feb 15 13:48:40 2020
+++ pkgsrc/pkgtools/pkglint/files/mkassignchecker.go    Mon Jun  1 20:49:54 2020
@@ -387,7 +387,7 @@ func (ck *MkAssignChecker) checkVarassig
        primary := categories[0]
        dir := G.Pkgsrc.Rel(mkline.Filename()).Dir().Dir().Base()
 
-       if primary == dir || dir == "wip" || dir == "regress" {
+       if primary == dir.String() || dir == "wip" || dir == "regress" {
                return
        }
 
@@ -397,7 +397,7 @@ func (ck *MkAssignChecker) checkVarassig
                "The primary category of a package should be its location in the",
                "pkgsrc directory tree, to make it easy to find the package.",
                "All other categories may be added after this primary category.")
-       if len(categories) > 1 && categories[1] == dir {
+       if len(categories) > 1 && categories[1] == dir.String() {
                fix.Replace(primary+" "+categories[1], categories[1]+" "+primary)
        }
        fix.Apply()

Index: pkgsrc/pkgtools/pkglint/files/mkline.go
diff -u pkgsrc/pkgtools/pkglint/files/mkline.go:1.79 pkgsrc/pkgtools/pkglint/files/mkline.go:1.80
--- pkgsrc/pkgtools/pkglint/files/mkline.go:1.79        Fri May 29 20:13:17 2020
+++ pkgsrc/pkgtools/pkglint/files/mkline.go     Mon Jun  1 20:49:54 2020
@@ -270,6 +270,10 @@ func (mkline *MkLine) FirstLineContainsV
 
 func (mkline *MkLine) ShellCommand() string { return mkline.data.(mkLineShell).command }
 
+// Indent returns the whitespace between the dot and the directive.
+//
+// For the following example line it returns two spaces:
+//  .  include "other.mk"
 func (mkline *MkLine) Indent() string {
        if mkline.IsDirective() {
                return mkline.data.(*mkLineDirective).indent

Index: pkgsrc/pkgtools/pkglint/files/mklinechecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.67 pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.68
--- pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.67 Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/mklinechecker.go      Mon Jun  1 20:49:54 2020
@@ -245,7 +245,6 @@ func (ck MkLineChecker) checkInclude() {
        if trace.Tracing {
                trace.Stepf("includingFile=%s includedFile=%s", mkline.Filename(), includedFile)
        }
-       // TODO: Not every path is relative to the package directory.
        ck.CheckRelativePath(NewPackagePath(includedFile), includedFile, mustExist)
 
        switch {
@@ -257,7 +256,10 @@ func (ck MkLineChecker) checkInclude() {
                        "module.mk or similar.",
                        "After that, both this one and the other package should include the newly created file.")
 
-       case mkline.Basename == "buildlink3.mk" && includedFile.Base() == "bsd.prefs.mk":
+       case mkline.Basename != "Makefile" && includedFile.HasBase("bsd.pkg.mk"):
+               mkline.Errorf("The file bsd.pkg.mk must only be included by package Makefiles, not by other Makefile fragments.")
+
+       case mkline.Basename == "buildlink3.mk" && includedFile.HasBase("bsd.prefs.mk"):
                fix := mkline.Autofix()
                fix.Notef("For efficiency reasons, please include bsd.fast.prefs.mk instead of bsd.prefs.mk.")
                fix.Replace("bsd.prefs.mk", "bsd.fast.prefs.mk")

Index: pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.61 pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.62
--- pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.61    Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go Mon Jun  1 20:49:54 2020
@@ -369,17 +369,22 @@ func (s *Suite) Test_MkLineChecker_check
        t.CreateFileLines("graphics/jpeg/buildlink3.mk")
        t.CreateFileLines("devel/intltool/buildlink3.mk")
        t.CreateFileLines("devel/intltool/builtin.mk")
+       t.CreateFileLines("mk/bsd.pkg.mk")
        mklines := t.SetUpFileMkLines("category/package/filename.mk",
                MkCvsID,
                "",
                ".include \"../../pkgtools/x11-links/buildlink3.mk\"",
                ".include \"../../graphics/jpeg/buildlink3.mk\"",
                ".include \"../../devel/intltool/buildlink3.mk\"",
-               ".include \"../../devel/intltool/builtin.mk\"")
+               ".include \"../../devel/intltool/builtin.mk\"",
+               ".include \"/absolute\"",
+               ".include \"../../mk/bsd.pkg.mk\"")
 
        mklines.Check()
 
        t.CheckOutputLines(
+               "ERROR: ~/category/package/filename.mk:7: "+
+                       "Unknown Makefile line format: \".include \\\"/absolute\\\"\".",
                "ERROR: ~/category/package/filename.mk:3: "+
                        "\"../../pkgtools/x11-links/buildlink3.mk\" must not be included directly. "+
                        "Include \"../../mk/x11.buildlink3.mk\" instead.",
@@ -390,7 +395,10 @@ func (s *Suite) Test_MkLineChecker_check
                        "Please write \"USE_TOOLS+= intltool\" instead of this line.",
                "ERROR: ~/category/package/filename.mk:6: "+
                        "\"../../devel/intltool/builtin.mk\" must not be included directly. "+
-                       "Include \"../../devel/intltool/buildlink3.mk\" instead.")
+                       "Include \"../../devel/intltool/buildlink3.mk\" instead.",
+               "ERROR: ~/category/package/filename.mk:8: "+
+                       "The file bsd.pkg.mk must only be included by package Makefiles, "+
+                       "not by other Makefile fragments.")
 }
 
 func (s *Suite) Test_MkLineChecker_checkInclude__Makefile(c *check.C) {

Index: pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go:1.8 pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go:1.9
--- pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go:1.8        Sun Mar 15 11:31:24 2020
+++ pkgsrc/pkgtools/pkglint/files/mkvarusechecker.go    Mon Jun  1 20:49:54 2020
@@ -148,6 +148,48 @@ func (ck *MkVarUseChecker) checkVarname(
                fix.ReplaceAfter("${", "LOCALBASE", "PREFIX")
                fix.Apply()
        }
+
+       ck.checkVarnameBuildlink(varname)
+}
+
+func (ck *MkVarUseChecker) checkVarnameBuildlink(varname string) {
+       pkg := ck.MkLines.pkg
+       if pkg == nil {
+               return
+       }
+
+       if !hasPrefix(varname, "BUILDLINK_PREFIX.") {
+               return
+       }
+
+       basename := ck.MkLine.Basename
+       if basename == "buildlink3.mk" || basename == "builtin.mk" {
+               return
+       }
+
+       varparam := varnameParam(varname)
+       id := Buildlink3ID(varparam)
+       if pkg.bl3Data[id] != nil || containsVarUse(varparam) {
+               return
+       }
+
+       // Several packages contain Makefile fragments that are more related
+       // to the buildlink3.mk file than to the package Makefile.
+       // These may use the buildlink identifier from the package itself.
+       bl3 := LoadMk(pkg.File("buildlink3.mk"), pkg, 0)
+       if bl3 != nil {
+               bl3Data := LoadBuildlink3Data(bl3)
+               if bl3Data != nil && bl3Data.id == id {
+                       return
+               }
+       }
+
+       if id == "mysql-client" && pkg.Includes("../../mk/mysql.buildlink3.mk") != nil {
+               return
+       }
+
+       ck.MkLine.Warnf("Buildlink identifier %q is not known in this package.",
+               varparam)
 }
 
 // checkPermissions checks the permissions when a variable is used,

Index: pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go:1.10 pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go:1.11
--- pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go:1.10  Thu Apr 30 21:15:03 2020
+++ pkgsrc/pkgtools/pkglint/files/mkvarusechecker_test.go       Mon Jun  1 20:49:54 2020
@@ -379,6 +379,25 @@ func (s *Suite) Test_MkVarUseChecker_che
                "AUTOFIX: filename.mk:3: Replacing \"LOCALBASE\" with \"PREFIX\".")
 }
 
+func (s *Suite) Test_MkVarUseChecker_checkVarnameBuildlink(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/library")
+       t.CreateFileBuildlink3Id("category/library/buildlink3.mk", "lib")
+       t.SetUpPackage("category/package",
+               "CONFIGURE_ARGS+=\t--with-library=${BUILDLINK_PREFIX.library}",
+               "CONFIGURE_ARGS+=\t--with-lib=${BUILDLINK_PREFIX.lib}",
+               "",
+               ".include \"../../category/library/buildlink3.mk\"")
+       t.Chdir("category/package")
+       t.FinishSetUp()
+
+       G.Check(".")
+
+       t.CheckOutputLines(
+               "WARN: Makefile:20: Buildlink identifier \"library\" is not known in this package.")
+}
+
 func (s *Suite) Test_MkVarUseChecker_checkPermissions(c *check.C) {
        t := s.Init(c)
 
Index: pkgsrc/pkgtools/pkglint/files/path.go
diff -u pkgsrc/pkgtools/pkglint/files/path.go:1.10 pkgsrc/pkgtools/pkglint/files/path.go:1.11
--- pkgsrc/pkgtools/pkglint/files/path.go:1.10  Sun Mar 22 17:43:15 2020
+++ pkgsrc/pkgtools/pkglint/files/path.go       Mon Jun  1 20:49:54 2020
@@ -42,7 +42,7 @@ func (p Path) Dir() Path {
        return NewPath(s[:end])
 }
 
-func (p Path) Base() string { return path.Base(string(p)) }
+func (p Path) Base() RelPath { return NewRelPathString(path.Base(string(p))) }
 
 func (p Path) Split() (dir Path, base string) {
        strDir, strBase := path.Split(string(p))
@@ -157,7 +157,7 @@ func (p Path) HasSuffixPath(suffix Path)
                (len(p) == len(suffix) || p[len(p)-len(suffix)-1] == '/')
 }
 
-func (p Path) HasBase(base string) bool { return p.Base() == base }
+func (p Path) HasBase(base string) bool { return p.Base().String() == base }
 
 func (p Path) TrimSuffix(suffix string) Path {
        return Path(strings.TrimSuffix(string(p), suffix))
@@ -253,7 +253,7 @@ func (p CurrPath) Dir() CurrPath {
        return CurrPath(p.AsPath().Dir())
 }
 
-func (p CurrPath) Base() string { return p.AsPath().Base() }
+func (p CurrPath) Base() RelPath { return p.AsPath().Base() }
 
 func (p CurrPath) Split() (dir CurrPath, base string) {
        pathDir, pathBase := p.AsPath().Split()
@@ -395,7 +395,7 @@ func (p PkgsrcPath) Dir() PkgsrcPath {
        return NewPkgsrcPath(p.AsPath().Dir())
 }
 
-func (p PkgsrcPath) Base() string { return p.AsPath().Base() }
+func (p PkgsrcPath) Base() RelPath { return p.AsPath().Base() }
 
 func (p PkgsrcPath) Count() int { return p.AsPath().Count() }
 
@@ -484,7 +484,7 @@ func (p RelPath) Dir() RelPath {
        return RelPath(p.AsPath().Dir())
 }
 
-func (p RelPath) Base() string { return p.AsPath().Base() }
+func (p RelPath) Base() RelPath { return p.AsPath().Base() }
 
 func (p RelPath) HasBase(base string) bool { return p.AsPath().HasBase(base) }
 

Index: pkgsrc/pkgtools/pkglint/files/package.go
diff -u pkgsrc/pkgtools/pkglint/files/package.go:1.90 pkgsrc/pkgtools/pkglint/files/package.go:1.91
--- pkgsrc/pkgtools/pkglint/files/package.go:1.90       Sat May 23 08:51:07 2020
+++ pkgsrc/pkgtools/pkglint/files/package.go    Mon Jun  1 20:49:54 2020
@@ -90,7 +90,7 @@ type Package struct {
 
        // Contains the basenames of the distfiles that are mentioned in distinfo,
        // for example "package-1.0.tar.gz", even if that file is in a DIST_SUBDIR.
-       distinfoDistfiles map[string]bool
+       distinfoDistfiles map[RelPath]bool
 }
 
 func NewPackage(dir CurrPath) *Package {
@@ -161,11 +161,11 @@ func (pkg *Package) load() ([]CurrPath, 
                files = append(files, pkg.File(pkg.DistinfoFile))
        }
 
-       isRelevantMk := func(filename CurrPath, basename string) bool {
-               if !hasPrefix(basename, "Makefile.") && !filename.HasSuffixText(".mk") {
+       isRelevantMk := func(filename CurrPath, basename RelPath) bool {
+               if !hasPrefix(basename.String(), "Makefile.") && !filename.HasSuffixText(".mk") {
                        return false
                }
-               if filename.Dir().Base() == "patches" {
+               if filename.Dir().HasBase("patches") {
                        return false
                }
                if pkg.Pkgdir == "." {
@@ -184,7 +184,7 @@ func (pkg *Package) load() ([]CurrPath, 
                        pkg.collectConditionalIncludes(fragmentMklines)
                        pkg.loadBuildlink3Pkgbase(filename, fragmentMklines)
                }
-               if hasPrefix(basename, "PLIST") {
+               if basename.HasPrefixText("PLIST") {
                        pkg.loadPlistDirs(filename)
                }
        }
@@ -1351,7 +1351,7 @@ func (pkg *Package) checkDirent(dirent C
        case mode.IsRegular():
                G.checkReg(dirent, basename, G.Pkgsrc.Rel(dirent).Count(), pkg)
 
-       case hasPrefix(basename, "work"):
+       case basename.HasPrefixText("work"):
                if G.Import {
                        NewLineWhole(dirent).Errorf("Must be cleaned up before committing the package.")
                }
@@ -1361,7 +1361,7 @@ func (pkg *Package) checkDirent(dirent C
                switch {
                case basename == "files",
                        basename == "patches",
-                       dirent.Dir().Base() == "files",
+                       dirent.Dir().HasBase("files"),
                        isEmptyDir(dirent):
                        break
 
@@ -1445,10 +1445,10 @@ func (pkg *Package) checkFreeze(filename
 // TODO: Move to MkLinesChecker.
 func (*Package) checkFileMakefileExt(filename CurrPath) {
        base := filename.Base()
-       if !hasPrefix(base, "Makefile.") || base == "Makefile.common" {
+       if !base.HasPrefixText("Makefile.") || base == "Makefile.common" {
                return
        }
-       ext := strings.TrimPrefix(base, "Makefile.")
+       ext := strings.TrimPrefix(base.String(), "Makefile.")
 
        line := NewLineWhole(filename)
        line.Notef("Consider renaming %q to %q.", base, ext+".mk")
@@ -1566,7 +1566,7 @@ func (pkg *Package) checkIncludeConditio
        //  already done with *_MK variables.
 }
 
-func (pkg *Package) matchesLicenseFile(basename string) bool {
+func (pkg *Package) matchesLicenseFile(basename RelPath) bool {
        licenseFile := NewPath(pkg.vars.LastValue("LICENSE_FILE"))
        return basename == licenseFile.Base()
 }

Index: pkgsrc/pkgtools/pkglint/files/patches.go
diff -u pkgsrc/pkgtools/pkglint/files/patches.go:1.41 pkgsrc/pkgtools/pkglint/files/patches.go:1.42
--- pkgsrc/pkgtools/pkglint/files/patches.go:1.41       Fri May 29 20:13:17 2020
+++ pkgsrc/pkgtools/pkglint/files/patches.go    Mon Jun  1 20:49:54 2020
@@ -365,7 +365,7 @@ func (ck *PatchChecker) checktextCvsID(t
 }
 
 func (ck *PatchChecker) checkCanonicalPatchName(patched Path) {
-       patch := ck.lines.BaseName
+       patch := ck.lines.BaseName.String()
        if matches(patch, `^patch-[a-z][a-z]$`) {
                // This naming scheme is only accepted for historic reasons.
                // It has has absolutely no benefit.
@@ -386,7 +386,7 @@ func (ck *PatchChecker) checkCanonicalPa
        if patchNorm == patchedNorm {
                return
        }
-       if hasSuffix(patchedNorm, patchNorm) && patchNorm == normalize(patched.Base()) {
+       if hasSuffix(patchedNorm, patchNorm) && patchNorm == normalize(patched.Base().String()) {
                return
        }
 

Index: pkgsrc/pkgtools/pkglint/files/path_test.go
diff -u pkgsrc/pkgtools/pkglint/files/path_test.go:1.12 pkgsrc/pkgtools/pkglint/files/path_test.go:1.13
--- pkgsrc/pkgtools/pkglint/files/path_test.go:1.12     Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/path_test.go  Mon Jun  1 20:49:54 2020
@@ -77,7 +77,7 @@ func (s *Suite) Test_Path_Dir(c *check.C
 func (s *Suite) Test_Path_Base(c *check.C) {
        t := s.Init(c)
 
-       test := func(p Path, base string) {
+       test := func(p Path, base RelPath) {
                t.CheckEquals(p.Base(), base)
        }
 
@@ -615,7 +615,7 @@ func (s *Suite) Test_CurrPath_Dir(c *che
 func (s *Suite) Test_CurrPath_Base(c *check.C) {
        t := s.Init(c)
 
-       test := func(curr CurrPath, base string) {
+       test := func(curr CurrPath, base RelPath) {
                t.CheckEquals(curr.Base(), base)
        }
 
@@ -1104,7 +1104,7 @@ func (s *Suite) Test_PkgsrcPath_Dir(c *c
 func (s *Suite) Test_PkgsrcPath_Base(c *check.C) {
        t := s.Init(c)
 
-       test := func(pp PkgsrcPath, base string) {
+       test := func(pp PkgsrcPath, base RelPath) {
                t.CheckEquals(pp.Base(), base)
        }
 
@@ -1347,7 +1347,7 @@ func (s *Suite) Test_RelPath_Dir(c *chec
 func (s *Suite) Test_RelPath_Base(c *check.C) {
        t := s.Init(c)
 
-       test := func(rel RelPath, base string) {
+       test := func(rel RelPath, base RelPath) {
                t.CheckEquals(rel.Base(), base)
        }
 

Index: pkgsrc/pkgtools/pkglint/files/pkglint.go
diff -u pkgsrc/pkgtools/pkglint/files/pkglint.go:1.81 pkgsrc/pkgtools/pkglint/files/pkglint.go:1.82
--- pkgsrc/pkgtools/pkglint/files/pkglint.go:1.81       Sun May 17 07:07:19 2020
+++ pkgsrc/pkgtools/pkglint/files/pkglint.go    Mon Jun  1 20:49:54 2020
@@ -43,7 +43,7 @@ type Pkglint struct {
        Username       string // For checking against OWNER and MAINTAINER
 
        cvsEntriesDir CurrPath // Cached to avoid I/O
-       cvsEntries    map[string]CvsEntry
+       cvsEntries    map[RelPath]CvsEntry
 
        Logger Logger
 
@@ -308,7 +308,6 @@ func (p *Pkglint) checkMode(dirent CurrP
                dir = dirent.Dir()
        }
 
-       basename := dirent.Base()
        pkgsrcRel := p.Pkgsrc.Rel(dirent)
 
        p.Wip = pkgsrcRel.HasPrefixPath("wip")
@@ -323,7 +322,7 @@ func (p *Pkglint) checkMode(dirent CurrP
 
        if isReg {
                p.checkExecutable(dirent, mode)
-               p.checkReg(dirent, basename, pkgsrcRel.Count(), nil)
+               p.checkReg(dirent, dirent.Base(), pkgsrcRel.Count(), nil)
                return
        }
 
@@ -549,10 +548,10 @@ func CheckFileMk(filename CurrPath, pkg 
 // checkReg checks the given regular file.
 // depth is 3 for files in the package directory, and 4 or more for files
 // deeper in the directory hierarchy, such as in files/ or patches/.
-func (p *Pkglint) checkReg(filename CurrPath, basename string, depth int, pkg *Package) {
+func (p *Pkglint) checkReg(filename CurrPath, basename RelPath, depth int, pkg *Package) {
 
        if depth == 3 && !p.Wip {
-               if contains(basename, "TODO") {
+               if basename.ContainsText("TODO") {
                        NewLineWhole(filename).Errorf("Packages in main pkgsrc must not have a %s file.", basename)
                        // TODO: Add a convincing explanation.
                        return
@@ -560,10 +559,10 @@ func (p *Pkglint) checkReg(filename Curr
        }
 
        switch {
-       case hasSuffix(basename, "~"),
-               hasSuffix(basename, ".orig"),
-               hasSuffix(basename, ".rej"),
-               contains(basename, "TODO") && depth == 3:
+       case basename.HasSuffixText("~"),
+               basename.HasSuffixText(".orig"),
+               basename.HasSuffixText(".rej"),
+               basename.ContainsText("TODO") && depth == 3:
                if p.Import {
                        NewLineWhole(filename).Errorf("Must be cleaned up before committing the package.")
                }
@@ -584,7 +583,7 @@ func (p *Pkglint) checkReg(filename Curr
        case p.Wip && basename == "COMMIT_MSG":
                // https://mail-index.netbsd.org/pkgsrc-users/2020/05/10/msg031174.html
 
-       case hasPrefix(basename, "DESCR"):
+       case basename.HasPrefixText("DESCR"):
                if lines := Load(filename, NotEmpty|LogErrors); lines != nil {
                        CheckLinesDescr(lines)
                }
@@ -597,7 +596,7 @@ func (p *Pkglint) checkReg(filename Curr
        case basename == "DEINSTALL" || basename == "INSTALL":
                CheckFileOther(filename)
 
-       case hasPrefix(basename, "MESSAGE"):
+       case basename.HasPrefixText("MESSAGE"):
                if lines := Load(filename, NotEmpty|LogErrors); lines != nil {
                        CheckLinesMessage(lines, pkg)
                }
@@ -611,36 +610,36 @@ func (p *Pkglint) checkReg(filename Curr
                        CheckLinesOptionsMk(mklines, buildlinkID)
                }
 
-       case matches(basename, `^patch-[-\w.~+]*\w$`):
+       case matches(basename.String(), `^patch-[-\w.~+]*\w$`):
                if lines := Load(filename, NotEmpty|LogErrors); lines != nil {
                        CheckLinesPatch(lines, pkg)
                }
 
-       case filename.Dir().Base() == "patches" && matches(filename.Base(), `^manual[^/]*$`):
+       case filename.Dir().HasBase("patches") && filename.Base().HasPrefixText("manual"):
                if trace.Tracing {
                        trace.Stepf("Unchecked file %q.", filename)
                }
 
-       case filename.Dir().Base() == "patches":
+       case filename.Dir().HasBase("patches"):
                NewLineWhole(filename).Warnf("Patch files should be named \"patch-\", followed by letters, '-', '_', '.', and digits only.")
 
-       case (hasPrefix(basename, "Makefile") || hasSuffix(basename, ".mk")) &&
+       case (basename.HasPrefixText("Makefile") || basename.HasSuffixText(".mk")) &&
                !G.Pkgsrc.Rel(filename).AsPath().ContainsPath("files"):
                CheckFileMk(filename, pkg)
 
-       case hasPrefix(basename, "PLIST"):
+       case basename.HasPrefixText("PLIST"):
                if lines := Load(filename, NotEmpty|LogErrors); lines != nil {
                        CheckLinesPlist(pkg, lines)
                }
 
-       case contains(basename, "README"):
+       case basename.ContainsText("README"):
                break
 
-       case hasPrefix(basename, "CHANGES-"):
+       case basename.HasPrefixText("CHANGES-"):
                // This only checks the file but doesn't register the changes globally.
                _ = p.Pkgsrc.loadDocChangesFromFile(filename)
 
-       case filename.Dir().Base() == "files":
+       case filename.Dir().HasBase("files"):
                // Skip files directly in the files/ directory, but not those further down.
 
        case basename == "spec":
@@ -674,7 +673,7 @@ func (p *Pkglint) checkRegCvsSubst(filen
                "For more information, see",
                "https://www.gnu.org/software/trans-coord/manual/cvs/html_node/Substitution-modes.html.";,
                "",
-               sprintf("To fix this, run \"cvs admin -kkv %s\"", shquote(filename.Base())))
+               sprintf("To fix this, run \"cvs admin -kkv %s\"", shquote(filename.Base().String())))
 }
 
 func (p *Pkglint) checkExecutable(filename CurrPath, mode os.FileMode) {
@@ -757,13 +756,13 @@ func (p *Pkglint) tools(mklines *MkLines
        }
 }
 
-func (p *Pkglint) loadCvsEntries(filename CurrPath) map[string]CvsEntry {
+func (p *Pkglint) loadCvsEntries(filename CurrPath) map[RelPath]CvsEntry {
        dir := filename.Dir().Clean()
        if dir == p.cvsEntriesDir {
                return p.cvsEntries
        }
 
-       var entries map[string]CvsEntry
+       var entries map[RelPath]CvsEntry
 
        handle := func(line *Line, add bool, text string) {
                if !hasPrefix(text, "/") {
@@ -776,16 +775,17 @@ func (p *Pkglint) loadCvsEntries(filenam
                        return
                }
 
+               key := NewRelPathString(fields[1])
                if add {
-                       entries[fields[1]] = CvsEntry{fields[1], fields[2], fields[3], fields[4], fields[5]}
+                       entries[key] = CvsEntry{key, fields[2], fields[3], fields[4], fields[5]}
                } else {
-                       delete(entries, fields[1])
+                       delete(entries, key)
                }
        }
 
        lines := Load(dir.JoinNoClean("CVS/Entries"), 0)
        if lines != nil {
-               entries = make(map[string]CvsEntry)
+               entries = make(map[RelPath]CvsEntry)
                for _, line := range lines.Lines {
                        handle(line, true, line.Text)
                }

Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.55 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.56
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.55        Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go     Mon Jun  1 20:49:54 2020
@@ -186,7 +186,7 @@ func (src *Pkgsrc) loadDocChangesFromFil
        // This check has been added in 2018.
        // For years earlier than 2018 pkglint doesn't care because it's not a big issue anyway.
        year := ""
-       if _, yyyy := match1(filename.Base(), `-(\d\d\d\d)$`); yyyy >= "2018" {
+       if _, yyyy := match1(filename.Base().String(), `-(\d\d\d\d)$`); yyyy >= "2018" {
                year = yyyy
        }
 
@@ -532,7 +532,7 @@ func (src *Pkgsrc) loadToolsPlatform() {
        var systems []string
        scopes := make(map[string]*RedundantScope)
        for _, mkFile := range src.File("mk/tools").ReadPaths() {
-               m, opsys := match1(mkFile.Base(), `^tools\.(.+)\.mk$`)
+               m, opsys := match1(mkFile.Base().String(), `^tools\.(.+)\.mk$`)
                if !m {
                        continue
                }

Index: pkgsrc/pkgtools/pkglint/files/plist.go
diff -u pkgsrc/pkgtools/pkglint/files/plist.go:1.58 pkgsrc/pkgtools/pkglint/files/plist.go:1.59
--- pkgsrc/pkgtools/pkglint/files/plist.go:1.58 Sat May 23 08:51:08 2020
+++ pkgsrc/pkgtools/pkglint/files/plist.go      Mon Jun  1 20:49:54 2020
@@ -170,7 +170,7 @@ func (ck *PlistChecker) checkPath(pline 
        ck.checkSorted(pline)
        ck.checkDuplicate(pline)
 
-       if contains(rel.Base(), "${IMAKE_MANNEWSUFFIX}") {
+       if rel.Base().ContainsText("${IMAKE_MANNEWSUFFIX}") {
                pline.warnImakeMannewsuffix()
        }
 
@@ -342,7 +342,7 @@ func (ck *PlistChecker) checkPathLib(pli
        }
 
        basename := rel.Base()
-       if contains(basename, ".a") || contains(basename, ".so") {
+       if basename.ContainsText(".a") || basename.ContainsText(".so") {
                la := replaceAll(pline.text, `(\.a|\.so[0-9.]*)$`, ".la")
                if la != pline.text {
                        laLine := ck.allFiles[NewRelPathString(la)]
@@ -362,7 +362,7 @@ func (ck *PlistChecker) checkPathLib(pli
                pline.Errorf("Only the libiconv package may install lib/charset.alias.")
        }
 
-       if hasSuffix(basename, ".la") && !pkg.vars.IsDefined("USE_LIBTOOL") {
+       if basename.HasSuffixText(".la") && !pkg.vars.IsDefined("USE_LIBTOOL") {
                if ck.once.FirstTime("USE_LIBTOOL") {
                        pline.Warnf("Packages that install libtool libraries should define USE_LIBTOOL.")
                }
@@ -710,7 +710,7 @@ type PlistRank struct {
 
 var defaultPlistRank = &PlistRank{0, "", "", ""}
 
-func NewPlistRank(basename string) *PlistRank {
+func NewPlistRank(basename RelPath) *PlistRank {
        isOpsys := func(s string) bool {
                return G.Pkgsrc.VariableType(nil, "OPSYS").basicType.HasEnum(s)
        }
@@ -733,7 +733,7 @@ func NewPlistRank(basename string) *Plis
                return &PlistRank{2, "", "", ""}
        }
 
-       parts := strings.Split(basename[6:], "-")
+       parts := strings.Split(basename.String()[6:], "-")
        rank := PlistRank{3, "", "", ""}
        if isOpsys(parts[0]) {
                rank.Opsys = parts[0]

Index: pkgsrc/pkgtools/pkglint/files/tools.go
diff -u pkgsrc/pkgtools/pkglint/files/tools.go:1.23 pkgsrc/pkgtools/pkglint/files/tools.go:1.24
--- pkgsrc/pkgtools/pkglint/files/tools.go:1.23 Sat Mar  7 23:35:35 2020
+++ pkgsrc/pkgtools/pkglint/files/tools.go      Mon Jun  1 20:49:54 2020
@@ -154,7 +154,7 @@ func (tr *Tools) Define(name, varname st
                return nil
        }
 
-       validity := tr.validity(mkline.Basename, false)
+       validity := tr.validity(mkline.Basename.String(), false)
        return tr.def(name, varname, false, validity, nil)
 }
 
@@ -318,7 +318,7 @@ func (tr *Tools) parseUseTools(mkline *M
                return
        }
 
-       validity := tr.validity(mkline.Basename, addToUseTools)
+       validity := tr.validity(mkline.Basename.String(), addToUseTools)
        for _, dep := range mkline.ValueFields(value) {
                name := strings.Split(dep, ":")[0]
                if createIfAbsent || tr.ByName(name) != nil {

Index: pkgsrc/pkgtools/pkglint/files/util.go
diff -u pkgsrc/pkgtools/pkglint/files/util.go:1.77 pkgsrc/pkgtools/pkglint/files/util.go:1.78
--- pkgsrc/pkgtools/pkglint/files/util.go:1.77  Thu Apr 30 21:15:03 2020
+++ pkgsrc/pkgtools/pkglint/files/util.go       Mon Jun  1 20:49:54 2020
@@ -382,7 +382,7 @@ func isLocallyModified(filename CurrPath
 //
 // See http://cvsman.com/cvs-1.12.12/cvs_19.php.
 type CvsEntry struct {
-       Name      string
+       Name      RelPath
        Revision  string
        Timestamp string
        Options   string

Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.96 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.97
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.96       Sun May 24 19:12:29 2020
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go    Mon Jun  1 20:49:54 2020
@@ -402,8 +402,8 @@ func (reg *VarTypeRegistry) enumFromFile
        var relevant []string
        for _, filename := range src.File(basedir).ReadPaths() {
                basename := filename.Base()
-               if matches(basename, re) {
-                       relevant = append(relevant, replaceAll(basename, re, repl))
+               if matches(basename.String(), re) {
+                       relevant = append(relevant, replaceAll(basename.String(), re, repl))
                }
        }
        if len(relevant) == 0 {

Index: pkgsrc/pkgtools/pkglint/files/vartype.go
diff -u pkgsrc/pkgtools/pkglint/files/vartype.go:1.49 pkgsrc/pkgtools/pkglint/files/vartype.go:1.50
--- pkgsrc/pkgtools/pkglint/files/vartype.go:1.49       Mon Apr 13 19:46:44 2020
+++ pkgsrc/pkgtools/pkglint/files/vartype.go    Mon Jun  1 20:49:54 2020
@@ -209,9 +209,9 @@ func (vt *Vartype) IsDefinedIfInScope() 
 func (vt *Vartype) IsNonemptyIfDefined() bool   { return vt.options&NonemptyIfDefined != 0 }
 func (vt *Vartype) IsUnique() bool              { return vt.options&Unique != 0 }
 
-func (vt *Vartype) EffectivePermissions(basename string) ACLPermissions {
+func (vt *Vartype) EffectivePermissions(basename RelPath) ACLPermissions {
        for _, aclEntry := range vt.aclEntries {
-               if aclEntry.matcher.matches(basename) {
+               if aclEntry.matcher.matches(basename.String()) {
                        return aclEntry.permissions
                }
        }

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.89 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.90
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.89  Fri May 29 20:13:17 2020
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go       Mon Jun  1 20:49:54 2020
@@ -394,7 +394,7 @@ func (cv *VartypeCheck) DependencyPatter
                        return
                }
                defpat := depends(data)
-               if defpat.LowerOp != deppat.LowerOp {
+               if defpat == nil || defpat.LowerOp != deppat.LowerOp {
                        return
                }
                if pkgver.Compare(deppat.Lower, defpat.Lower) < 0 {

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.80 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.81
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.80     Fri May 29 20:13:17 2020
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go  Mon Jun  1 20:49:54 2020
@@ -507,6 +507,40 @@ func (s *Suite) Test_VartypeCheck_Depend
                        "version 1.4abi from ../../category/lib/buildlink3.mk:13.")
 }
 
+func (s *Suite) Test_VartypeCheck_DependencyPattern__API_ABI(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package",
+               ".include \"../../category/lib/buildlink3.mk\"",
+               "BUILDLINK_API_DEPENDS.lib+=\tlib>=1.0pkg")
+       t.SetUpPackage("category/lib")
+       t.CreateFileBuildlink3("category/lib/buildlink3.mk",
+               "BUILDLINK_ABI_DEPENDS.lib+=\tlib>=1.4abi")
+       t.Chdir("category/package")
+       t.FinishSetUp()
+
+       G.checkdirPackage(".")
+
+       t.CheckOutputEmpty()
+}
+
+func (s *Suite) Test_VartypeCheck_DependencyPattern__ABI_API(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package",
+               ".include \"../../category/lib/buildlink3.mk\"",
+               "BUILDLINK_ABI_DEPENDS.lib+=\tlib>=1.1pkg")
+       t.SetUpPackage("category/lib")
+       t.CreateFileBuildlink3("category/lib/buildlink3.mk",
+               "BUILDLINK_API_DEPENDS.lib+=\tlib>=1.3api")
+       t.Chdir("category/package")
+       t.FinishSetUp()
+
+       G.checkdirPackage(".")
+
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_VartypeCheck_DependencyWithPath(c *check.C) {
        t := s.Init(c)
 



Home | Main Index | Thread Index | Old Index