Received: by mail.netbsd.org (Postfix, from userid 605) id E3B0684D60; Tue, 25 May 2021 21:48:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 2A54484D5B for ; Tue, 25 May 2021 21:48:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id aiV9P5fumEYi for ; Tue, 25 May 2021 21:48:46 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 86D6C84D0F for ; Tue, 25 May 2021 21:48:46 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 7B017FA95; Tue, 25 May 2021 21:48:46 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1621979326120990" MIME-Version: 1.0 Date: Tue, 25 May 2021 21:48:46 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/pkglint To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20210525214846.7B017FA95@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1621979326120990 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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. --_----------=_1621979326120990 Content-Disposition: inline Content-Length: 3637 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii 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) --_----------=_1621979326120990--