Skip to content

Commit

Permalink
Rename MkLineChecker.CheckPackagePath to align with CheckPackageDir
Browse files Browse the repository at this point in the history
  • Loading branch information
rillig committed Nov 13, 2023
1 parent 2dfaee7 commit 36294e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions v23/mklinechecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,15 @@ func (ck MkLineChecker) CheckRelativePath(rel RelPath, mustExist bool) {
}
}

// CheckPackagePath checks a reference from one pkgsrc package to another.
// CheckPackageDir checks a reference from one pkgsrc package to another.
// These references should always have the form ../../category/package.
//
// When used in DEPENDS or similar variables, these directories could theoretically
// also be relative to the pkgsrc root, which would save a few keystrokes.
// This, however, is not implemented in pkgsrc and suggestions regarding this topic
// have not been made in the last two decades on the public mailing lists.
// While being a bit redundant, the current scheme works well.
func (ck MkLineChecker) CheckPackagePath(pkgdir PackagePath) {
func (ck MkLineChecker) CheckPackageDir(pkgdir PackagePath) {
// TODO: Not every path is relative to the package directory.
if trace.Tracing {
defer trace.Call(pkgdir)()
Expand Down
8 changes: 4 additions & 4 deletions v23/mklinechecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ func (s *Suite) Test_MkLineChecker_CheckRelativePath__wip_mk(c *check.C) {
"should look like \"../../category/package\", not \"../package\".")
}

func (s *Suite) Test_MkLineChecker_CheckPackagePath(c *check.C) {
func (s *Suite) Test_MkLineChecker_CheckPackageDir(c *check.C) {
t := s.Init(c)

t.CreateFileLines("other/package/Makefile")
Expand All @@ -767,12 +767,12 @@ func (s *Suite) Test_MkLineChecker_CheckPackagePath(c *check.C) {
mklines := t.SetUpFileMkLines("category/package/Makefile",
"# dummy")

checkPackagePath := func(mkline *MkLine) {
checkPackageDir := func(mkline *MkLine) {
ck := MkLineChecker{mklines, mkline}
ck.CheckPackagePath(packagePath)
ck.CheckPackageDir(packagePath)
}

mklines.ForEach(checkPackagePath)
mklines.ForEach(checkPackageDir)

t.CheckOutput(diagnostics)
}
Expand Down
6 changes: 3 additions & 3 deletions v23/vartypecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ func (cv *VartypeCheck) DependencyWithPath() {

if !containsExpr(parts[1]) {
ck := MkLineChecker{cv.MkLines, cv.MkLine}
rel := NewRelPath(dependencyDir)
ck.CheckPackagePath(NewPackagePath(rel))
rel := NewPackagePath(NewRelPath(dependencyDir))
ck.CheckPackageDir(rel)
}

pkg := pathParts[len(pathParts)-1]
Expand Down Expand Up @@ -1288,7 +1288,7 @@ func (cv *VartypeCheck) PackageDir() {
}

ck := MkLineChecker{cv.MkLines, cv.MkLine}
ck.CheckPackagePath(NewPackagePathString(cv.Value))
ck.CheckPackageDir(NewPackagePathString(cv.Value))
}

// PackagePath refers from one package directory to another file
Expand Down

0 comments on commit 36294e8

Please sign in to comment.