pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Some files are moved. Fix build



details:   https://anonhg.NetBSD.org/pkgsrc/rev/98d297fb731a
branches:  trunk
changeset: 370411:98d297fb731a
user:      ryoon <ryoon%pkgsrc.org@localhost>
date:      Tue Oct 17 03:32:28 2017 +0000

description:
Some files are moved. Fix build

diffstat:

 pkgtools/pkglint/files/linechecker.go      |  82 ------------------------------
 pkgtools/pkglint/files/linechecker_test.go |  43 ---------------
 2 files changed, 0 insertions(+), 125 deletions(-)

diffs (133 lines):

diff -r fce035b9a9a8 -r 98d297fb731a pkgtools/pkglint/files/linechecker.go
--- a/pkgtools/pkglint/files/linechecker.go     Mon Oct 16 18:55:59 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-package main
-
-import (
-       "fmt"
-       "netbsd.org/pkglint/line"
-       "netbsd.org/pkglint/regex"
-       "netbsd.org/pkglint/trace"
-)
-
-type LineChecker struct {
-       Line line.Line
-}
-
-func (ck LineChecker) CheckAbsolutePathname(text string) {
-       if trace.Tracing {
-               defer trace.Call1(text)()
-       }
-
-       // In the GNU coding standards, DESTDIR is defined as a (usually
-       // empty) prefix that can be used to install files to a different
-       // location from what they have been built for. Therefore
-       // everything following it is considered an absolute pathname.
-       //
-       // Another context where absolute pathnames usually appear is in
-       // assignments like "bindir=/bin".
-       if m, path := match1(text, `(?:^|\$[{(]DESTDIR[)}]|[\w_]+\s*=\s*)(/(?:[^"'\s]|"[^"*]"|'[^']*')*)`); m {
-               if matches(path, `^/\w`) {
-                       checkwordAbsolutePathname(ck.Line, path)
-               }
-       }
-}
-
-func (ck LineChecker) CheckLength(maxlength int) {
-       if len(ck.Line.Text()) > maxlength {
-               ck.Line.Warnf("Line too long (should be no more than %d characters).", maxlength)
-               Explain(
-                       "Back in the old time, terminals with 80x25 characters were common.",
-                       "And this is still the default size of many terminal emulators.",
-                       "Moderately short lines also make reading easier.")
-       }
-}
-
-func (ck LineChecker) CheckValidCharacters(reChar regex.RegexPattern) {
-       rest := regex.Compile(reChar).ReplaceAllString(ck.Line.Text(), "")
-       if rest != "" {
-               uni := ""
-               for _, c := range rest {
-                       uni += fmt.Sprintf(" %U", c)
-               }
-               ck.Line.Warnf("Line contains invalid characters (%s).", uni[1:])
-       }
-}
-
-func (ck LineChecker) CheckTrailingWhitespace() {
-       if hasSuffix(ck.Line.Text(), " ") || hasSuffix(ck.Line.Text(), "\t") {
-               if !ck.Line.AutofixReplaceRegexp(`\s+\n$`, "\n") {
-                       ck.Line.Notef("Trailing white-space.")
-                       Explain(
-                               "When a line ends with some white-space, that space is in most cases",
-                               "irrelevant and can be removed.")
-               }
-       }
-}
-
-func (ck LineChecker) CheckRcsid(prefixRe regex.RegexPattern, suggestedPrefix string) bool {
-       if trace.Tracing {
-               defer trace.Call(prefixRe, suggestedPrefix)()
-       }
-
-       if matches(ck.Line.Text(), `^`+prefixRe+`\$`+`NetBSD(?::[^\$]+)?\$$`) {
-               return true
-       }
-
-       if !ck.Line.AutofixInsertBefore(suggestedPrefix + "$" + "NetBSD$") {
-               ck.Line.Errorf("Expected %q.", suggestedPrefix+"$"+"NetBSD$")
-               Explain(
-                       "Several files in pkgsrc must contain the CVS Id, so that their",
-                       "current version can be traced back later from a binary package.",
-                       "This is to ensure reproducible builds, for example for finding bugs.")
-       }
-       return false
-}
diff -r fce035b9a9a8 -r 98d297fb731a pkgtools/pkglint/files/linechecker_test.go
--- a/pkgtools/pkglint/files/linechecker_test.go        Mon Oct 16 18:55:59 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-package main
-
-import "gopkg.in/check.v1"
-
-func (s *Suite) Test_LineChecker_CheckAbsolutePathname(c *check.C) {
-       s.Init(c)
-       ck := LineChecker{NewLine("Makefile", 1, "# dummy", nil)}
-
-       ck.CheckAbsolutePathname("bindir=/bin")
-       ck.CheckAbsolutePathname("bindir=/../lib")
-
-       s.CheckOutputLines(
-               "WARN: Makefile:1: Found absolute pathname: /bin")
-}
-
-func (s *Suite) Test_LineChecker_CheckTrailingWhitespace(c *check.C) {
-       s.Init(c)
-       ck := LineChecker{NewLine("Makefile", 32, "The line must go on   ", nil)}
-
-       ck.CheckTrailingWhitespace()
-
-       s.CheckOutputLines(
-               "NOTE: Makefile:32: Trailing white-space.")
-}
-
-func (s *Suite) Test_LineChecker_CheckRcsid(c *check.C) {
-       s.Init(c)
-       lines := s.NewLines("fname",
-               "$"+"NetBSD: dummy $",
-               "$"+"NetBSD$",
-               "$"+"Id: dummy $",
-               "$"+"Id$",
-               "$"+"FreeBSD$")
-
-       for _, line := range lines {
-               LineChecker{line}.CheckRcsid(``, "")
-       }
-
-       s.CheckOutputLines(
-               "ERROR: fname:3: Expected \"$"+"NetBSD$\".",
-               "ERROR: fname:4: Expected \"$"+"NetBSD$\".",
-               "ERROR: fname:5: Expected \"$"+"NetBSD$\".")
-}



Home | Main Index | Thread Index | Old Index