diff options
author | rillig <rillig@pkgsrc.org> | 2018-01-07 01:13:21 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2018-01-07 01:13:21 +0000 |
commit | ee64646636a9c97491f57e81323ebcfed92dfbe1 (patch) | |
tree | de9059f30ec1ffecf3aefb9381c143b2c4b46989 /pkgtools/pkglint/files/util.go | |
parent | 6960bb4220afd6ec895cab6553afe7b9d026b2e0 (diff) | |
download | pkgsrc-ee64646636a9c97491f57e81323ebcfed92dfbe1.tar.gz |
Updated pkglint to 5.4.25.
Changes since 5.4.24:
* More specific warning for "exitcode with pipe shell commands"
* Don't warn that the echo in "echo | sed" could fail
* Allow packages to define custom make targets
* Don't warn about a misplaced LICENSE when a package doesn't define it
* Skip .git directories
* Reduce number of hicolor-icon-theme error messages in PLIST files
* Remove MKCRYPTO, USE_CRYPTO, CRYPTO variable definitions
Diffstat (limited to 'pkgtools/pkglint/files/util.go')
-rw-r--r-- | pkgtools/pkglint/files/util.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/util.go b/pkgtools/pkglint/files/util.go index 7961efd69dd..aaf8f19bfae 100644 --- a/pkgtools/pkglint/files/util.go +++ b/pkgtools/pkglint/files/util.go @@ -68,7 +68,7 @@ func isEmptyDir(fname string) bool { } for _, dirent := range dirents { name := dirent.Name() - if name == "." || name == ".." || name == "CVS" { + if isIgnoredFilename(name) { continue } if dirent.IsDir() && isEmptyDir(fname+"/"+name) { @@ -88,13 +88,21 @@ func getSubdirs(fname string) []string { var subdirs []string for _, dirent := range dirents { name := dirent.Name() - if name != "." && name != ".." && name != "CVS" && dirent.IsDir() && !isEmptyDir(fname+"/"+name) { + if dirent.IsDir() && !isIgnoredFilename(name) && !isEmptyDir(fname+"/"+name) { subdirs = append(subdirs, name) } } return subdirs } +func isIgnoredFilename(fileName string) bool { + switch fileName { + case ".", "..", "CVS", ".svn", ".git", ".hg": + return true + } + return false +} + // Checks whether a file is already committed to the CVS repository. func isCommitted(fname string) bool { lines := loadCvsEntries(fname) @@ -333,3 +341,20 @@ func hasAlnumPrefix(s string) bool { b := s[0] return '0' <= b && b <= '9' || 'A' <= b && b <= 'Z' || b == '_' || 'a' <= b && b <= 'z' } + +// Once remembers with which arguments its FirstTime method has been called +// and only returns true on each first call. +type Once struct { + seen map[string]bool +} + +func (o *Once) FirstTime(what string) bool { + if o.seen == nil { + o.seen = make(map[string]bool) + } + if _, ok := o.seen[what]; ok { + return false + } + o.seen[what] = true + return true +} |