summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint/files/package.go
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2019-05-06 20:27:17 +0000
committerrillig <rillig@pkgsrc.org>2019-05-06 20:27:17 +0000
commit916339bb022f0f3e4e1da5f753114ce4b8d69709 (patch)
treee2358c7c52324fbad66bfd953ea252d6197ffed5 /pkgtools/pkglint/files/package.go
parent3e83a6c4d69c38a42d8a7a8b46cba5f3e4ea734d (diff)
downloadpkgsrc-916339bb022f0f3e4e1da5f753114ce4b8d69709.tar.gz
pkgtools/pkglint: update to 5.7.9
Changes since 5.7.8: * Buildlink3.mk files are checked for typos in the identifier that is used for BUILDLINK_TREE, to detect copy-and-paste mistakes. * Having a rationale is recommended for some variables, especially those that make a package fail to build or crash at runtime. This check is only active when -Wextra is given, since it is still actively debated whether such a check is actually useful. * Files called Makefile.php can easily be mistaken to be PHP files. Therefore the recommended naming convention is to have auxiliary files called *.mk. There are already many more files called *.mk than those being called Makefile.*. * The check for unquoted sed substitution commands has been made more detailed, but since it is completely disabled, there's nothing to see for now. * The definitions for MASTER_SITE_* are loaded directly from the pkgsrc infrastructure instead of hard-coding them in pkglint.
Diffstat (limited to 'pkgtools/pkglint/files/package.go')
-rw-r--r--pkgtools/pkglint/files/package.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/package.go b/pkgtools/pkglint/files/package.go
index f2812a76a7f..82b98fbec4b 100644
--- a/pkgtools/pkglint/files/package.go
+++ b/pkgtools/pkglint/files/package.go
@@ -218,11 +218,11 @@ func (pkg *Package) load() ([]string, MkLines, MkLines) {
return files, mklines, allLines
}
-func (pkg *Package) check(files []string, mklines, allLines MkLines) {
+func (pkg *Package) check(filenames []string, mklines, allLines MkLines) {
haveDistinfo := false
havePatches := false
- for _, filename := range files {
+ for _, filename := range filenames {
if containsVarRef(filename) {
if trace.Tracing {
trace.Stepf("Skipping file %q because the name contains an unresolved variable.", filename)
@@ -1013,6 +1013,28 @@ func (pkg *Package) CheckVarorder(mklines MkLines) {
seeGuide("Package components, Makefile", "components.Makefile"))
}
+func (pkg *Package) checkFileMakefileExt(filename string) {
+ base := path.Base(filename)
+ if !hasPrefix(base, "Makefile.") || base == "Makefile.common" {
+ return
+ }
+ ext := strings.TrimPrefix(base, "Makefile.")
+
+ line := NewLineWhole(filename)
+ line.Notef("Consider renaming %q to %q.", base, ext+".mk")
+ line.Explain(
+ "The main definition of a pkgsrc package should be in the Makefile.",
+ "Common definitions for a few very closely related packages can be",
+ "placed in a Makefile.common, these may cover various topics.",
+ "",
+ "All other definitions should be grouped by topics and implemented",
+ "in separate files named *.mk after their topics. Typical examples",
+ "are extension.mk, module.mk, version.mk.",
+ "",
+ "These topic files should be documented properly so that their",
+ sprintf("content can be queried using %q.", makeHelp("help")))
+}
+
// checkLocallyModified checks files that are about to be committed.
// Depending on whether the package has a MAINTAINER or an OWNER,
// the wording differs.