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:           Wed Aug 17 20:41:51 UTC 2022

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: mkassignchecker_test.go pkglint.go
        pkgsrc/pkgtools/pkglint/files/pkgver: vercmp.go vercmp_test.go

Log Message:
pkgtools/pkglint: update to 22.2.5

Changes since 22.2.4:

Makefiles in wip/mk may use internal variables (starting with '_'), just
like their counterparts in main mk/.

Package versions containing letters are now parsed like in pkg_install.


To generate a diff of this commit:
cvs rdiff -u -r1.725 -r1.726 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go
cvs rdiff -u -r1.85 -r1.86 pkgsrc/pkgtools/pkglint/files/pkglint.go
cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go
cvs rdiff -u -r1.10 -r1.11 \
    pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_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.725 pkgsrc/pkgtools/pkglint/Makefile:1.726
--- pkgsrc/pkgtools/pkglint/Makefile:1.725      Fri Aug 12 20:38:07 2022
+++ pkgsrc/pkgtools/pkglint/Makefile    Wed Aug 17 20:41:51 2022
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.725 2022/08/12 20:38:07 bsiegert Exp $
+# $NetBSD: Makefile,v 1.726 2022/08/17 20:41:51 rillig Exp $
 
-PKGNAME=       pkglint-22.2.4
-PKGREVISION=   1
+PKGNAME=       pkglint-22.2.5
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}

Index: pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go:1.11 pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go:1.12
--- pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go:1.11  Fri Jun 24 07:16:23 2022
+++ pkgsrc/pkgtools/pkglint/files/mkassignchecker_test.go       Wed Aug 17 20:41:51 2022
@@ -108,12 +108,17 @@ func (s *Suite) Test_MkAssignChecker_che
                MkCvsID,
                "_VARNAME=\t\tvalue",
                "_SORTED_VARS.group=\tVARNAME")
+       t.CreateFileLines("wip/mk/infra.mk",
+               MkCvsID,
+               "_CVS_ENV+=\t\tCVS_RSH=ssh")
        t.FinishSetUp()
 
        G.Check(t.File("mk/infra.mk"))
+       G.Check(t.File("wip/mk/infra.mk"))
 
        t.CheckOutputLines(
-               "WARN: ~/mk/infra.mk:2: _VARNAME is defined but not used.")
+               "WARN: ~/mk/infra.mk:2: _VARNAME is defined but not used.",
+               "WARN: ~/wip/mk/infra.mk:2: _CVS_ENV is defined but not used.")
 }
 
 func (s *Suite) Test_MkAssignChecker_checkLeft__documented_underscore(c *check.C) {

Index: pkgsrc/pkgtools/pkglint/files/pkglint.go
diff -u pkgsrc/pkgtools/pkglint/files/pkglint.go:1.85 pkgsrc/pkgtools/pkglint/files/pkglint.go:1.86
--- pkgsrc/pkgtools/pkglint/files/pkglint.go:1.85       Sun Jan 16 19:14:52 2022
+++ pkgsrc/pkgtools/pkglint/files/pkglint.go    Wed Aug 17 20:41:51 2022
@@ -311,7 +311,8 @@ func (p *Pkglint) checkMode(dirent CurrP
        pkgsrcRel := p.Pkgsrc.Rel(dirent)
 
        p.Wip = pkgsrcRel.HasPrefixPath("wip")
-       p.Infrastructure = pkgsrcRel.HasPrefixPath("mk")
+       p.Infrastructure = pkgsrcRel.HasPrefixPath("mk") ||
+               pkgsrcRel.HasPrefixPath("wip/mk")
        pkgsrcdir := p.findPkgsrcTopdir(dir)
        if pkgsrcdir.IsEmpty() {
                G.Logger.TechErrorf("",

Index: pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go:1.6 pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go:1.7
--- pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go:1.6  Thu Apr 30 21:15:03 2020
+++ pkgsrc/pkgtools/pkglint/files/pkgver/vercmp.go      Wed Aug 17 20:41:51 2022
@@ -69,6 +69,7 @@ func newVersion(vstr string) *version {
                        num := lex.NextBytesSet(textproc.Digit)
                        v.nb, _ = strconv.Atoi(num)
                case lex.TestByteSet(textproc.Lower):
+                       v.add(0)
                        v.add(int(lex.Rest()[0] - 'a' + 1))
                        lex.Skip(1)
                default:

Index: pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_test.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_test.go:1.10 pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_test.go:1.11
--- pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_test.go:1.10    Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/pkgver/vercmp_test.go Wed Aug 17 20:41:51 2022
@@ -3,6 +3,7 @@ package pkgver
 import (
        "gopkg.in/check.v1"
        "netbsd.org/pkglint/intqa"
+       "reflect"
        "testing"
 )
 
@@ -24,9 +25,12 @@ func (s *Suite) Test_Compare(c *check.C)
                {"1", "1.0", "1.0.0"},
                {"1.0nb1"},
                {"1.0nb2", "1_0nb2"},
-               {"1.0.1a", "1.0.a1", "1.0.aa"},
+               {"1.0.aa"},
+               {"1.0.a1"},
+               {"1.0.k"},
+               {"1.0.1a"},
                {"1.0.1z"},
-               {"1.0.11", "1.0.k"},
+               {"1.0.11", "1.0k"},
                {"2.0pre", "2.0rc"},
                {"2.0", "2.0pl"},
                {"2.0.1nb4"},
@@ -66,49 +70,51 @@ func (s *Suite) Test_Compare(c *check.C)
        }
 }
 
+func Test_newVersion(t *testing.T) {
+       tests := []struct {
+               name string
+               v    version
+       }{
+               {"5.0", version{[]int{5, 0, 0}, 0}},
+               {"5.0nb5", version{[]int{5, 0, 0}, 5}},
+               {"0.0.1-SNAP", version{[]int{0, 0, 0, 0, 1, 0, 19, 0, 14, 0, 1, 0, 16}, 0}},
+               {"1.0alpha3", version{[]int{1, 0, 0, -3, 3}, 0}},
+               {"1_0alpha3", version{[]int{1, 0, 0, -3, 3}, 0}},
+               {"2.5beta", version{[]int{2, 0, 5, -2}, 0}},
+               {"20151110", version{[]int{20151110}, 0}},
+               {"0", version{[]int{0}, 0}},
+               {"nb1", version{nil, 1}},
+               {"1.0.1a", version{[]int{1, 0, 0, 0, 1, 0, 1}, 0}},
+               {"1.1.1dnb2", version{[]int{1, 0, 1, 0, 1, 0, 4}, 2}},
+               {"1.0.1z", version{[]int{1, 0, 0, 0, 1, 0, 26}, 0}},
+               {"0pre20160620", version{[]int{0, -1, 20160620}, 0}},
+               {"3.5.DEV1710", version{[]int{3, 0, 5, 0, 0, 4, 0, 5, 0, 22, 1710}, 0}},
+
+               // In the following edge case, the "nb" and "beta" overlap.
+               // All the digits after the "nb" (which in this case are none at all)
+               // end up in the nb version part, and parsing continues with the next
+               // letter.
+               //
+               // Luckily this will not happen in practice since most version numbers
+               // are completely numeric, and those that aren't might have suffixes
+               // like "alpha", "beta", "public beta", "GA" (general availability),
+               // "final", "snapshot". The word "nonbeta" is purely hypothetical, and
+               // I didn't find any other word that would contain "nbeta". Commit
+               // hashes are also safe since their hex encoding cannot contain "n".
+               {"1.0nonbeta", version{[]int{1, 0, 0, 0, 14, 0, 15, 0, 5, 0, 20, 0, 1}, 0}},
+       }
+       for _, test := range tests {
+               t.Run(test.name, func(t *testing.T) {
+                       actual := *newVersion(test.name)
+                       if !reflect.DeepEqual(actual, test.v) {
+                               t.Errorf("expected %#v for %q, got %#v", test.v, test.name, actual)
+                       }
+               })
+       }
+}
+
 func (s *Suite) Test_newVersion(c *check.C) {
-       c.Check(newVersion("5.0"), check.DeepEquals,
-               &version{[]int{5, 0, 0}, 0})
-       c.Check(newVersion("5.0nb5"), check.DeepEquals,
-               &version{[]int{5, 0, 0}, 5})
-       c.Check(newVersion("0.0.1-SNAPSHOT"), check.DeepEquals,
-               &version{[]int{0, 0, 0, 0, 1, 19, 14, 1, 16, 19, 8, 15, 20}, 0})
-       c.Check(newVersion("1.0alpha3"), check.DeepEquals,
-               &version{[]int{1, 0, 0, -3, 3}, 0})
-       c.Check(newVersion("1_0alpha3"), check.DeepEquals,
-               &version{[]int{1, 0, 0, -3, 3}, 0})
-       c.Check(newVersion("2.5beta"), check.DeepEquals,
-               &version{[]int{2, 0, 5, -2}, 0})
-       c.Check(newVersion("20151110"), check.DeepEquals,
-               &version{[]int{20151110}, 0})
-       c.Check(newVersion("0"), check.DeepEquals,
-               &version{[]int{0}, 0})
-       c.Check(newVersion("nb1"), check.DeepEquals,
-               &version{nil, 1})
-       c.Check(newVersion("1.0.1a"), check.DeepEquals,
-               &version{[]int{1, 0, 0, 0, 1, 1}, 0})
-       c.Check(newVersion("1.1.1dnb2"), check.DeepEquals,
-               &version{[]int{1, 0, 1, 0, 1, 4}, 2})
-       c.Check(newVersion("1.0.1z"), check.DeepEquals,
-               &version{[]int{1, 0, 0, 0, 1, 26}, 0})
-       c.Check(newVersion("0pre20160620"), check.DeepEquals,
-               &version{[]int{0, -1, 20160620}, 0})
-       c.Check(newVersion("3.5.DEV1710"), check.DeepEquals,
-               &version{[]int{3, 0, 5, 0, 4, 5, 22, 1710}, 0})
-
-       // In the following edge case, the "nb" and "beta" overlap.
-       // All the digits after the "nb" (which in this case are none at all)
-       // end up in the nb version part, and parsing continues with the next
-       // letter.
-       //
-       // Luckily this will not happen in practice since most version numbers
-       // are completely numeric, and those that aren't might have suffixes
-       // like "alpha", "beta", "public beta", "GA" (general availability),
-       // "final", "snapshot". The word "nonbeta" is purely hypothetical, and
-       // I didn't find any other word that would contain "nbeta". Commit
-       // hashes are also safe since their hex encoding cannot contain "n".
-       c.Check(newVersion("1.0nonbeta"), check.DeepEquals,
-               &version{[]int{1, 0, 0, 14, 15, 5, 20, 1}, 0})
+       // See Test_newVersion.
 }
 
 func (s *Suite) Test__qa(c *check.C) {



Home | Main Index | Thread Index | Old Index