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:           Tue May 25 21:48:46 UTC 2021

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: buildlink3.go buildlink3_test.go

Log Message:
pkglint: update to 21.1.2

Changes since 21.1.1:

Fixed the check for BUILDLINK3_PKGSRCDIR.  Previously, pkglint had
complained about ${_EMACS_PKGDIR} in buildlink3.mk.


To generate a diff of this commit:
cvs rdiff -u -r1.685 -r1.686 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.39 -r1.40 pkgsrc/pkgtools/pkglint/files/buildlink3.go
cvs rdiff -u -r1.47 -r1.48 pkgsrc/pkgtools/pkglint/files/buildlink3_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.685 pkgsrc/pkgtools/pkglint/Makefile:1.686
--- pkgsrc/pkgtools/pkglint/Makefile:1.685      Mon May 24 19:53:43 2021
+++ pkgsrc/pkgtools/pkglint/Makefile    Tue May 25 21:48:46 2021
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.685 2021/05/24 19:53:43 wiz Exp $
+# $NetBSD: Makefile,v 1.686 2021/05/25 21:48:46 rillig Exp $
 
-PKGNAME=       pkglint-21.1.1
-PKGREVISION=   2
+PKGNAME=       pkglint-21.1.2
 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.39 pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.40
--- pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.39    Thu Jul 23 19:09:10 2020
+++ pkgsrc/pkgtools/pkglint/files/buildlink3.go Tue May 25 21:48:46 2021
@@ -282,14 +282,27 @@ func (ck *Buildlink3Checker) checkVarass
                        ck.pkgbase, value)
        }
 
-       if varname == "BUILDLINK_PKGSRCDIR."+pkgbase {
-               pkgdir := mkline.Filename().Dir()
-               expected := "../../" + G.Pkgsrc.Rel(pkgdir).String()
-               if value != expected {
-                       mkline.Errorf("%s must be set to the package's own path (%s), not %s.",
-                               varname, expected, value)
-               }
+       ck.checkVarassignPkgsrcdir(mkline, pkgbase, varname, value)
+}
+
+func (ck *Buildlink3Checker) checkVarassignPkgsrcdir(mkline *MkLine,
+       pkgbase string, varname string, value string) {
+
+       if varname != "BUILDLINK_PKGSRCDIR."+pkgbase {
+               return
        }
+       if containsVarUse(value) {
+               return
+       }
+
+       pkgdir := mkline.Filename().Dir()
+       expected := "../../" + G.Pkgsrc.Rel(pkgdir).String()
+       if value == expected {
+               return
+       }
+
+       mkline.Errorf("%s must be set to the package's own path (%s), not %s.",
+               varname, expected, value)
 }
 
 func (ck *Buildlink3Checker) checkVaruseInPkgbase(pkgbaseLine *MkLine) {

Index: pkgsrc/pkgtools/pkglint/files/buildlink3_test.go
diff -u pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.47 pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.48
--- pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.47       Fri Jun 12 19:14:45 2020
+++ pkgsrc/pkgtools/pkglint/files/buildlink3_test.go    Tue May 25 21:48:46 2021
@@ -928,6 +928,42 @@ func (s *Suite) Test_Buildlink3Checker_c
                        "not \"other\" may be set in this file.")
 }
 
+func (s *Suite) Test_Buildlink3Checker_checkVarassignPkgsrcdir(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package")
+       t.SetUpPackage("category/other-package")
+       t.CreateFileBuildlink3("category/package/buildlink3.mk",
+               "BUILDLINK_PKGSRCDIR.package?=\t../../category/other-package",
+               "BUILDLINK_API_DEPENDS.package+=\tpackage>=3")
+       t.FinishSetUp()
+
+       G.Check(t.File("category/package"))
+
+       t.CheckOutputLines(
+               "ERROR: ~/category/package/buildlink3.mk:12: " +
+                       "BUILDLINK_PKGSRCDIR.package must be set " +
+                       "to the package's own path (../../category/package), " +
+                       "not ../../category/other-package.")
+}
+
+// An indirect BUILDLINK_PKGSRCDIR is used in editors/emacs, among others.
+func (s *Suite) Test_Buildlink3Checker_checkVarassignPkgsrcdir__var(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package")
+       t.SetUpPackage("category/other-package")
+       t.CreateFileBuildlink3("category/package/buildlink3.mk",
+               "PACKAGE_SRCDIR=\t\t\t../../category/package",
+               "BUILDLINK_PKGSRCDIR.package?=\t${PACKAGE_SRCDIR}",
+               "BUILDLINK_API_DEPENDS.package+=\tpackage>=3")
+       t.FinishSetUp()
+
+       G.Check(t.File("category/package"))
+
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_Buildlink3Checker_checkVaruseInPkgbase__PKGBASE_with_variable_PHP_PKG_PREFIX(c *check.C) {
        t := s.Init(c)
 



Home | Main Index | Thread Index | Old Index