pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkglint: update to 21.1.2



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5940bb171e24
branches:  trunk
changeset: 453252:5940bb171e24
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue May 25 21:48:46 2021 +0000

description:
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.

diffstat:

 pkgtools/pkglint/Makefile                 |   5 +--
 pkgtools/pkglint/files/buildlink3.go      |  27 +++++++++++++++++------
 pkgtools/pkglint/files/buildlink3_test.go |  36 +++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 10 deletions(-)

diffs (97 lines):

diff -r b06096bf9db5 -r 5940bb171e24 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Tue May 25 18:15:11 2021 +0000
+++ b/pkgtools/pkglint/Makefile Tue May 25 21:48:46 2021 +0000
@@ -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/}
diff -r b06096bf9db5 -r 5940bb171e24 pkgtools/pkglint/files/buildlink3.go
--- a/pkgtools/pkglint/files/buildlink3.go      Tue May 25 18:15:11 2021 +0000
+++ b/pkgtools/pkglint/files/buildlink3.go      Tue May 25 21:48:46 2021 +0000
@@ -282,14 +282,27 @@
                        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) {
diff -r b06096bf9db5 -r 5940bb171e24 pkgtools/pkglint/files/buildlink3_test.go
--- a/pkgtools/pkglint/files/buildlink3_test.go Tue May 25 18:15:11 2021 +0000
+++ b/pkgtools/pkglint/files/buildlink3_test.go Tue May 25 21:48:46 2021 +0000
@@ -928,6 +928,42 @@
                        "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