pkgtools/pkglint: updated to 5.5.14 Changes since 5.5.13: * Suppress duplicate warnings for unknown options in the same file * Grab acceptable package versions directly from the infrastructure files * Note about too deeply indented shell programsdiff -r1.541 -r1.542 pkgsrc/pkgtools/pkglint/Makefile
(rillig)
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | # $NetBSD: Makefile,v 1.541 2018/07/12 16:23:36 rillig Exp $ | 1 | # $NetBSD: Makefile,v 1.542 2018/07/19 06:38:15 rillig Exp $ | |
2 | 2 | |||
3 | PKGNAME= pkglint-5.5.13 | 3 | PKGNAME= pkglint-5.5.14 | |
4 | DISTFILES= # none | 4 | DISTFILES= # none | |
5 | CATEGORIES= pkgtools | 5 | CATEGORIES= pkgtools | |
6 | 6 | |||
7 | MAINTAINER= rillig@NetBSD.org | 7 | MAINTAINER= rillig@NetBSD.org | |
8 | HOMEPAGE= https://github.com/rillig/pkglint | 8 | HOMEPAGE= https://github.com/rillig/pkglint | |
9 | COMMENT= Verifier for NetBSD packages | 9 | COMMENT= Verifier for NetBSD packages | |
10 | LICENSE= 2-clause-bsd | 10 | LICENSE= 2-clause-bsd | |
11 | CONFLICTS+= pkglint4-[0-9]* | 11 | CONFLICTS+= pkglint4-[0-9]* | |
12 | 12 | |||
13 | NO_CHECKSUM= yes | 13 | NO_CHECKSUM= yes | |
14 | USE_TOOLS+= pax | 14 | USE_TOOLS+= pax | |
15 | AUTO_MKDIRS= yes | 15 | AUTO_MKDIRS= yes | |
16 | GO_SRCPATH= netbsd.org/pkglint | 16 | GO_SRCPATH= netbsd.org/pkglint |
@@ -114,26 +114,31 @@ func (t *Tester) SetupVartypes() { | @@ -114,26 +114,31 @@ func (t *Tester) SetupVartypes() { | |||
114 | func (t *Tester) SetupMasterSite(varname string, urls ...string) { | 114 | func (t *Tester) SetupMasterSite(varname string, urls ...string) { | |
115 | name2url := &G.Pkgsrc.MasterSiteVarToURL | 115 | name2url := &G.Pkgsrc.MasterSiteVarToURL | |
116 | url2name := &G.Pkgsrc.MasterSiteURLToVar | 116 | url2name := &G.Pkgsrc.MasterSiteURLToVar | |
117 | if *name2url == nil { | 117 | if *name2url == nil { | |
118 | *name2url = make(map[string]string) | 118 | *name2url = make(map[string]string) | |
119 | *url2name = make(map[string]string) | 119 | *url2name = make(map[string]string) | |
120 | } | 120 | } | |
121 | (*name2url)[varname] = urls[0] | 121 | (*name2url)[varname] = urls[0] | |
122 | for _, url := range urls { | 122 | for _, url := range urls { | |
123 | (*url2name)[url] = varname | 123 | (*url2name)[url] = varname | |
124 | } | 124 | } | |
125 | } | 125 | } | |
126 | 126 | |||
127 | // SetupOption pretends that the package option is defined in mk/defaults/options.description. | |||
128 | func (t *Tester) SetupOption(name, description string) { | |||
129 | G.Pkgsrc.PkgOptions[name] = description | |||
130 | } | |||
131 | ||||
127 | func (t *Tester) SetupTool(tool *Tool) { | 132 | func (t *Tester) SetupTool(tool *Tool) { | |
128 | reg := G.Pkgsrc.Tools | 133 | reg := G.Pkgsrc.Tools | |
129 | 134 | |||
130 | if len(reg.byName) == 0 && len(reg.byVarname) == 0 { | 135 | if len(reg.byName) == 0 && len(reg.byVarname) == 0 { | |
131 | reg = NewToolRegistry() | 136 | reg = NewToolRegistry() | |
132 | G.Pkgsrc.Tools = reg | 137 | G.Pkgsrc.Tools = reg | |
133 | } | 138 | } | |
134 | if tool.Name != "" { | 139 | if tool.Name != "" { | |
135 | reg.byName[tool.Name] = tool | 140 | reg.byName[tool.Name] = tool | |
136 | } | 141 | } | |
137 | if tool.Varname != "" { | 142 | if tool.Varname != "" { | |
138 | reg.byVarname[tool.Varname] = tool | 143 | reg.byVarname[tool.Varname] = tool | |
139 | } | 144 | } | |
@@ -244,27 +249,31 @@ func (t *Tester) NewLines(fileName strin | @@ -244,27 +249,31 @@ func (t *Tester) NewLines(fileName strin | |||
244 | // i.e. each logical line has exactly one physical line. | 249 | // i.e. each logical line has exactly one physical line. | |
245 | // To work with line continuations like in Makefiles, | 250 | // To work with line continuations like in Makefiles, | |
246 | // use Suite.CreateFileLines together with Suite.LoadExistingLines. | 251 | // use Suite.CreateFileLines together with Suite.LoadExistingLines. | |
247 | func (t *Tester) NewLinesAt(fileName string, firstLine int, texts ...string) []Line { | 252 | func (t *Tester) NewLinesAt(fileName string, firstLine int, texts ...string) []Line { | |
248 | result := make([]Line, len(texts)) | 253 | result := make([]Line, len(texts)) | |
249 | for i, text := range texts { | 254 | for i, text := range texts { | |
250 | textnl := text + "\n" | 255 | textnl := text + "\n" | |
251 | result[i] = NewLine(fileName, i+firstLine, text, t.NewRawLines(i+firstLine, textnl)) | 256 | result[i] = NewLine(fileName, i+firstLine, text, t.NewRawLines(i+firstLine, textnl)) | |
252 | } | 257 | } | |
253 | return result | 258 | return result | |
254 | } | 259 | } | |
255 | 260 | |||
256 | func (t *Tester) NewMkLines(fileName string, lines ...string) *MkLines { | 261 | func (t *Tester) NewMkLines(fileName string, lines ...string) *MkLines { | |
257 | return NewMkLines(t.NewLines(fileName, lines...)) | 262 | rawText := "" | |
263 | for _, line := range lines { | |||
264 | rawText += line + "\n" | |||
265 | } | |||
266 | return NewMkLines(convertToLogicalLines(fileName, rawText, true)) | |||
258 | } | 267 | } | |
259 | 268 | |||
260 | // Returns and consumes the output from both stdout and stderr. | 269 | // Returns and consumes the output from both stdout and stderr. | |
261 | // The temporary directory is replaced with a tilde (~). | 270 | // The temporary directory is replaced with a tilde (~). | |
262 | func (t *Tester) Output() string { | 271 | func (t *Tester) Output() string { | |
263 | stdout := t.stdout.String() | 272 | stdout := t.stdout.String() | |
264 | stderr := t.stderr.String() | 273 | stderr := t.stderr.String() | |
265 | 274 | |||
266 | t.stdout.Reset() | 275 | t.stdout.Reset() | |
267 | t.stderr.Reset() | 276 | t.stderr.Reset() | |
268 | 277 | |||
269 | output := stdout + stderr | 278 | output := stdout + stderr | |
270 | if t.tmpdir != "" { | 279 | if t.tmpdir != "" { |
@@ -16,26 +16,39 @@ type MkLineChecker struct { | @@ -16,26 +16,39 @@ type MkLineChecker struct { | |||
16 | 16 | |||
17 | func (ck MkLineChecker) Check() { | 17 | func (ck MkLineChecker) Check() { | |
18 | mkline := ck.MkLine | 18 | mkline := ck.MkLine | |
19 | 19 | |||
20 | CheckLineTrailingWhitespace(mkline.Line) | 20 | CheckLineTrailingWhitespace(mkline.Line) | |
21 | CheckLineValidCharacters(mkline.Line, `[\t -~]`) | 21 | CheckLineValidCharacters(mkline.Line, `[\t -~]`) | |
22 | 22 | |||
23 | switch { | 23 | switch { | |
24 | case mkline.IsVarassign(): | 24 | case mkline.IsVarassign(): | |
25 | ck.checkVarassign() | 25 | ck.checkVarassign() | |
26 | 26 | |||
27 | case mkline.IsShellCommand(): | 27 | case mkline.IsShellCommand(): | |
28 | shellCommand := mkline.ShellCommand() | 28 | shellCommand := mkline.ShellCommand() | |
29 | ||||
30 | if G.opts.WarnSpace && hasPrefix(mkline.Text, "\t\t") { | |||
31 | fix := mkline.Autofix() | |||
32 | fix.Notef("Shell programs should be indented with a single tab.") | |||
33 | fix.Explain( | |||
34 | "The first tab in the line marks the line as a shell command. Since", | |||
35 | "every line of shell commands starts with a completely new shell", | |||
36 | "environment, there is no need to indent some of the commands, or to", | |||
37 | "use more horizontal space than necessary.") | |||
38 | fix.ReplaceRegex(`^\t\t+`, "\t", 1) | |||
39 | fix.Apply() | |||
40 | } | |||
41 | ||||
29 | ck.checkText(shellCommand) | 42 | ck.checkText(shellCommand) | |
30 | NewShellLine(mkline).CheckShellCommandLine(shellCommand) | 43 | NewShellLine(mkline).CheckShellCommandLine(shellCommand) | |
31 | 44 | |||
32 | case mkline.IsComment(): | 45 | case mkline.IsComment(): | |
33 | if hasPrefix(mkline.Text, "# url2pkg-marker") { | 46 | if hasPrefix(mkline.Text, "# url2pkg-marker") { | |
34 | mkline.Errorf("This comment indicates unfinished work (url2pkg).") | 47 | mkline.Errorf("This comment indicates unfinished work (url2pkg).") | |
35 | } | 48 | } | |
36 | 49 | |||
37 | case mkline.IsInclude(): | 50 | case mkline.IsInclude(): | |
38 | ck.checkInclude() | 51 | ck.checkInclude() | |
39 | } | 52 | } | |
40 | } | 53 | } | |
41 | 54 |
@@ -9,53 +9,55 @@ import ( | @@ -9,53 +9,55 @@ import ( | |||
9 | // MkLines contains data for the Makefile (or *.mk) that is currently checked. | 9 | // MkLines contains data for the Makefile (or *.mk) that is currently checked. | |
10 | type MkLines struct { | 10 | type MkLines struct { | |
11 | mklines []MkLine | 11 | mklines []MkLine | |
12 | lines []Line | 12 | lines []Line | |
13 | forVars map[string]bool // The variables currently used in .for loops | 13 | forVars map[string]bool // The variables currently used in .for loops | |
14 | target string // Current make(1) target | 14 | target string // Current make(1) target | |
15 | vars Scope | 15 | vars Scope | |
16 | buildDefs map[string]bool // Variables that are registered in BUILD_DEFS, to ensure that all user-defined variables are added to it. | 16 | buildDefs map[string]bool // Variables that are registered in BUILD_DEFS, to ensure that all user-defined variables are added to it. | |
17 | plistVars map[string]bool // Variables that are registered in PLIST_VARS, to ensure that all user-defined variables are added to it. | 17 | plistVars map[string]bool // Variables that are registered in PLIST_VARS, to ensure that all user-defined variables are added to it. | |
18 | tools map[string]bool // Set of tools that are declared to be used. | 18 | tools map[string]bool // Set of tools that are declared to be used. | |
19 | toolRegistry ToolRegistry // Tools defined in file scope. | 19 | toolRegistry ToolRegistry // Tools defined in file scope. | |
20 | SeenBsdPrefsMk bool | 20 | SeenBsdPrefsMk bool | |
21 | indentation Indentation // Indentation depth of preprocessing directives | 21 | indentation Indentation // Indentation depth of preprocessing directives | |
22 | Once | |||
22 | // XXX: Why both tools and toolRegistry? | 23 | // XXX: Why both tools and toolRegistry? | |
23 | } | 24 | } | |
24 | 25 | |||
25 | func NewMkLines(lines []Line) *MkLines { | 26 | func NewMkLines(lines []Line) *MkLines { | |
26 | mklines := make([]MkLine, len(lines)) | 27 | mklines := make([]MkLine, len(lines)) | |
27 | for i, line := range lines { | 28 | for i, line := range lines { | |
28 | mklines[i] = NewMkLine(line) | 29 | mklines[i] = NewMkLine(line) | |
29 | } | 30 | } | |
30 | tools := make(map[string]bool) | 31 | tools := make(map[string]bool) | |
31 | G.Pkgsrc.Tools.ForEach(func(tool *Tool) { | 32 | G.Pkgsrc.Tools.ForEach(func(tool *Tool) { | |
32 | if tool.Predefined { | 33 | if tool.Predefined { | |
33 | tools[tool.Name] = true | 34 | tools[tool.Name] = true | |
34 | } | 35 | } | |
35 | }) | 36 | }) | |
36 | 37 | |||
37 | return &MkLines{ | 38 | return &MkLines{ | |
38 | mklines, | 39 | mklines, | |
39 | lines, | 40 | lines, | |
40 | make(map[string]bool), | 41 | make(map[string]bool), | |
41 | "", | 42 | "", | |
42 | NewScope(), | 43 | NewScope(), | |
43 | make(map[string]bool), | 44 | make(map[string]bool), | |
44 | make(map[string]bool), | 45 | make(map[string]bool), | |
45 | tools, | 46 | tools, | |
46 | NewToolRegistry(), | 47 | NewToolRegistry(), | |
47 | false, | 48 | false, | |
48 | Indentation{}} | 49 | Indentation{}, | |
50 | Once{}} | |||
49 | } | 51 | } | |
50 | 52 | |||
51 | func (mklines *MkLines) UseVar(mkline MkLine, varname string) { | 53 | func (mklines *MkLines) UseVar(mkline MkLine, varname string) { | |
52 | mklines.vars.Use(varname, mkline) | 54 | mklines.vars.Use(varname, mkline) | |
53 | if G.Pkg != nil { | 55 | if G.Pkg != nil { | |
54 | G.Pkg.vars.Use(varname, mkline) | 56 | G.Pkg.vars.Use(varname, mkline) | |
55 | } | 57 | } | |
56 | } | 58 | } | |
57 | 59 | |||
58 | func (mklines *MkLines) VarValue(varname string) (value string, found bool) { | 60 | func (mklines *MkLines) VarValue(varname string) (value string, found bool) { | |
59 | if mkline := mklines.vars.FirstDefinition(varname); mkline != nil { | 61 | if mkline := mklines.vars.FirstDefinition(varname); mkline != nil { | |
60 | return mkline.Value(), true | 62 | return mkline.Value(), true | |
61 | } | 63 | } |
@@ -483,13 +483,52 @@ func (s *Suite) Test_MkLines_ExtractDocu | @@ -483,13 +483,52 @@ func (s *Suite) Test_MkLines_ExtractDocu | |||
483 | varnames = append(varnames, fmt.Sprintf("%s (line %s)", varname, mkline.Linenos())) | 483 | varnames = append(varnames, fmt.Sprintf("%s (line %s)", varname, mkline.Linenos())) | |
484 | } | 484 | } | |
485 | sort.Strings(varnames) | 485 | sort.Strings(varnames) | |
486 | 486 | |||
487 | expected := []string{ | 487 | expected := []string{ | |
488 | "PKG_DEBUG_LEVEL (line 5)", | 488 | "PKG_DEBUG_LEVEL (line 5)", | |
489 | "PKG_VERBOSE (line 10)", | 489 | "PKG_VERBOSE (line 10)", | |
490 | "VARBASE1.* (line 17)", | 490 | "VARBASE1.* (line 17)", | |
491 | "VARBASE2.* (line 18)", | 491 | "VARBASE2.* (line 18)", | |
492 | "VARBASE3.${id} (line 19)", | 492 | "VARBASE3.${id} (line 19)", | |
493 | "VARBASE3.* (line 19)"} | 493 | "VARBASE3.* (line 19)"} | |
494 | c.Check(varnames, deepEquals, expected) | 494 | c.Check(varnames, deepEquals, expected) | |
495 | } | 495 | } | |
496 | ||||
497 | func (s *Suite) Test_MkLines__shell_command_indentation(c *check.C) { | |||
498 | t := s.Init(c) | |||
499 | ||||
500 | t.SetupCommandLine("-Wall") | |||
501 | t.SetupVartypes() | |||
502 | mklines := t.NewMkLines("Makefile", | |||
503 | MkRcsID, | |||
504 | "#", | |||
505 | "pre-configure:", | |||
506 | "\tcd 'indented correctly'", | |||
507 | "\t\tcd 'indented needlessly'", | |||
508 | "\tcd 'indented correctly' \\", | |||
509 | "\t\t&& cd 'with indented continuation'") | |||
510 | ||||
511 | mklines.Check() | |||
512 | ||||
513 | t.CheckOutputLines( | |||
514 | "NOTE: Makefile:5: Shell programs should be indented with a single tab.") | |||
515 | } | |||
516 | ||||
517 | func (s *Suite) Test_MkLines__unknown_options(c *check.C) { | |||
518 | t := s.Init(c) | |||
519 | ||||
520 | t.SetupCommandLine("-Wall") | |||
521 | t.SetupVartypes() | |||
522 | t.SetupOption("known", "") | |||
523 | mklines := t.NewMkLines("options.mk", | |||
524 | MkRcsID, | |||
525 | "#", | |||
526 | "PKG_OPTIONS_VAR=\tPKG_OPTIONS.pkgbase", | |||
527 | "PKG_SUPPORTED_OPTIONS=\tknown unknown", | |||
528 | "PKG_SUGGESTED_OPTIONS=\tknown unknown") | |||
529 | ||||
530 | mklines.Check() | |||
531 | ||||
532 | t.CheckOutputLines( | |||
533 | "WARN: options.mk:4: Unknown option \"unknown\".") | |||
534 | } |
@@ -111,26 +111,37 @@ func (src *Pkgsrc) InitVartypes() { | @@ -111,26 +111,37 @@ func (src *Pkgsrc) InitVartypes() { | |||
111 | } | 111 | } | |
112 | } | 112 | } | |
113 | for _, language := range splitOnSpace("ada c c99 c++ c++11 fortran fortran77 java objc obj-c++") { | 113 | for _, language := range splitOnSpace("ada c c99 c++ c++11 fortran fortran77 java objc obj-c++") { | |
114 | languages[language] = true | 114 | languages[language] = true | |
115 | } | 115 | } | |
116 | 116 | |||
117 | joined := keysJoined(languages) | 117 | joined := keysJoined(languages) | |
118 | if trace.Tracing { | 118 | if trace.Tracing { | |
119 | trace.Stepf("Languages from mk/compiler.mk: %s", joined) | 119 | trace.Stepf("Languages from mk/compiler.mk: %s", joined) | |
120 | } | 120 | } | |
121 | return joined | 121 | return joined | |
122 | }()) | 122 | }()) | |
123 | 123 | |||
124 | enumFrom := func(fileName, varname, defval string) *BasicType { | |||
125 | lines, _ := readLines(src.File(fileName), true) | |||
126 | mklines := NewMkLines(lines) | |||
127 | for _, mkline := range mklines.mklines { | |||
128 | if mkline.IsVarassign() && mkline.Varname() == varname { | |||
129 | return enum(mkline.Value()) | |||
130 | } | |||
131 | } | |||
132 | return enum(defval) | |||
133 | } | |||
134 | ||||
124 | // Last synced with mk/defaults/mk.conf revision 1.269 | 135 | // Last synced with mk/defaults/mk.conf revision 1.269 | |
125 | usr("USE_CWRAPPERS", lkNone, enum("yes no auto")) | 136 | usr("USE_CWRAPPERS", lkNone, enum("yes no auto")) | |
126 | usr("ALLOW_VULNERABLE_PACKAGES", lkNone, BtYes) | 137 | usr("ALLOW_VULNERABLE_PACKAGES", lkNone, BtYes) | |
127 | usr("AUDIT_PACKAGES_FLAGS", lkShell, BtShellWord) | 138 | usr("AUDIT_PACKAGES_FLAGS", lkShell, BtShellWord) | |
128 | usr("MANINSTALL", lkShell, enum("maninstall catinstall")) | 139 | usr("MANINSTALL", lkShell, enum("maninstall catinstall")) | |
129 | usr("MANZ", lkNone, BtYes) | 140 | usr("MANZ", lkNone, BtYes) | |
130 | usr("GZIP", lkShell, BtShellWord) | 141 | usr("GZIP", lkShell, BtShellWord) | |
131 | usr("MAKE_JOBS", lkNone, BtInteger) | 142 | usr("MAKE_JOBS", lkNone, BtInteger) | |
132 | usr("OBJHOSTNAME", lkNone, BtYes) | 143 | usr("OBJHOSTNAME", lkNone, BtYes) | |
133 | usr("OBJMACHINE", lkNone, BtYes) | 144 | usr("OBJMACHINE", lkNone, BtYes) | |
134 | usr("SIGN_PACKAGES", lkNone, enum("gpg x509")) | 145 | usr("SIGN_PACKAGES", lkNone, enum("gpg x509")) | |
135 | usr("X509_KEY", lkNone, BtPathname) | 146 | usr("X509_KEY", lkNone, BtPathname) | |
136 | usr("X509_CERTIFICATE", lkNone, BtPathname) | 147 | usr("X509_CERTIFICATE", lkNone, BtPathname) | |
@@ -578,27 +589,27 @@ func (src *Pkgsrc) InitVartypes() { | @@ -578,27 +589,27 @@ func (src *Pkgsrc) InitVartypes() { | |||
578 | acl("ECHO", lkNone, BtShellCommand, "*: use") | 589 | acl("ECHO", lkNone, BtShellCommand, "*: use") | |
579 | sys("ECHO_MSG", lkNone, BtShellCommand) | 590 | sys("ECHO_MSG", lkNone, BtShellCommand) | |
580 | sys("ECHO_N", lkNone, BtShellCommand) | 591 | sys("ECHO_N", lkNone, BtShellCommand) | |
581 | pkg("EGDIR", lkNone, BtPathname) // Not defined anywhere, but used in many places like this. | 592 | pkg("EGDIR", lkNone, BtPathname) // Not defined anywhere, but used in many places like this. | |
582 | sys("EMACS_BIN", lkNone, BtPathname) | 593 | sys("EMACS_BIN", lkNone, BtPathname) | |
583 | sys("EMACS_ETCPREFIX", lkNone, BtPathname) | 594 | sys("EMACS_ETCPREFIX", lkNone, BtPathname) | |
584 | sys("EMACS_FLAVOR", lkNone, enum("emacs xemacs")) | 595 | sys("EMACS_FLAVOR", lkNone, enum("emacs xemacs")) | |
585 | sys("EMACS_INFOPREFIX", lkNone, BtPathname) | 596 | sys("EMACS_INFOPREFIX", lkNone, BtPathname) | |
586 | sys("EMACS_LISPPREFIX", lkNone, BtPathname) | 597 | sys("EMACS_LISPPREFIX", lkNone, BtPathname) | |
587 | acl("EMACS_MODULES", lkShell, BtIdentifier, "Makefile, Makefile.common: set, append") | 598 | acl("EMACS_MODULES", lkShell, BtIdentifier, "Makefile, Makefile.common: set, append") | |
588 | sys("EMACS_PKGNAME_PREFIX", lkNone, BtIdentifier) // Or the empty string. | 599 | sys("EMACS_PKGNAME_PREFIX", lkNone, BtIdentifier) // Or the empty string. | |
589 | sys("EMACS_TYPE", lkNone, enum("emacs xemacs")) | 600 | sys("EMACS_TYPE", lkNone, enum("emacs xemacs")) | |
590 | acl("EMACS_USE_LEIM", lkNone, BtYes, "") | 601 | acl("EMACS_USE_LEIM", lkNone, BtYes, "") | |
591 | acl("EMACS_VERSIONS_ACCEPTED", lkShell, enum("emacs25 emacs21 emacs21nox emacs20 xemacs215 xemacs215nox xemacs214 xemacs214nox"), "Makefile: set") | 602 | acl("EMACS_VERSIONS_ACCEPTED", lkShell, enumFrom("editors/emacs/modules.mk", "_EMACS_VERSIONS_ALL", "emacs25 emacs21 emacs21nox emacs20 xemacs215 xemacs215nox xemacs214 xemacs214nox"), "Makefile: set") | |
592 | sys("EMACS_VERSION_MAJOR", lkNone, BtInteger) | 603 | sys("EMACS_VERSION_MAJOR", lkNone, BtInteger) | |
593 | sys("EMACS_VERSION_MINOR", lkNone, BtInteger) | 604 | sys("EMACS_VERSION_MINOR", lkNone, BtInteger) | |
594 | acl("EMACS_VERSION_REQD", lkShell, enum("emacs25 emacs25nox emacs21 emacs21nox emacs20 xemacs215 xemacs214"), "Makefile: set, append") | 605 | acl("EMACS_VERSION_REQD", lkShell, enum("emacs25 emacs25nox emacs21 emacs21nox emacs20 xemacs215 xemacs214"), "Makefile: set, append") | |
595 | sys("EMULDIR", lkNone, BtPathname) | 606 | sys("EMULDIR", lkNone, BtPathname) | |
596 | sys("EMULSUBDIR", lkNone, BtPathname) | 607 | sys("EMULSUBDIR", lkNone, BtPathname) | |
597 | sys("OPSYS_EMULDIR", lkNone, BtPathname) | 608 | sys("OPSYS_EMULDIR", lkNone, BtPathname) | |
598 | sys("EMULSUBDIRSLASH", lkNone, BtPathname) | 609 | sys("EMULSUBDIRSLASH", lkNone, BtPathname) | |
599 | sys("EMUL_ARCH", lkNone, enum("arm i386 m68k none ns32k sparc vax x86_64")) | 610 | sys("EMUL_ARCH", lkNone, enum("arm i386 m68k none ns32k sparc vax x86_64")) | |
600 | sys("EMUL_DISTRO", lkNone, BtIdentifier) | 611 | sys("EMUL_DISTRO", lkNone, BtIdentifier) | |
601 | sys("EMUL_IS_NATIVE", lkNone, BtYes) | 612 | sys("EMUL_IS_NATIVE", lkNone, BtYes) | |
602 | pkg("EMUL_MODULES.*", lkShell, BtIdentifier) | 613 | pkg("EMUL_MODULES.*", lkShell, BtIdentifier) | |
603 | sys("EMUL_OPSYS", lkNone, enum("darwin freebsd hpux irix linux osf1 solaris sunos none")) | 614 | sys("EMUL_OPSYS", lkNone, enum("darwin freebsd hpux irix linux osf1 solaris sunos none")) | |
604 | pkg("EMUL_PKG_FMT", lkNone, enum("plain rpm")) | 615 | pkg("EMUL_PKG_FMT", lkNone, enum("plain rpm")) | |
@@ -775,27 +786,27 @@ func (src *Pkgsrc) InitVartypes() { | @@ -775,27 +786,27 @@ func (src *Pkgsrc) InitVartypes() { | |||
775 | sys("MASTER_SITE_PERL_CPAN", lkShell, BtFetchURL) | 786 | sys("MASTER_SITE_PERL_CPAN", lkShell, BtFetchURL) | |
776 | sys("MASTER_SITE_R_CRAN", lkShell, BtFetchURL) | 787 | sys("MASTER_SITE_R_CRAN", lkShell, BtFetchURL) | |
777 | sys("MASTER_SITE_RUBYGEMS", lkShell, BtFetchURL) | 788 | sys("MASTER_SITE_RUBYGEMS", lkShell, BtFetchURL) | |
778 | sys("MASTER_SITE_SOURCEFORGE", lkShell, BtFetchURL) | 789 | sys("MASTER_SITE_SOURCEFORGE", lkShell, BtFetchURL) | |
779 | sys("MASTER_SITE_SUNSITE", lkShell, BtFetchURL) | 790 | sys("MASTER_SITE_SUNSITE", lkShell, BtFetchURL) | |
780 | sys("MASTER_SITE_SUSE", lkShell, BtFetchURL) | 791 | sys("MASTER_SITE_SUSE", lkShell, BtFetchURL) | |
781 | sys("MASTER_SITE_TEX_CTAN", lkShell, BtFetchURL) | 792 | sys("MASTER_SITE_TEX_CTAN", lkShell, BtFetchURL) | |
782 | sys("MASTER_SITE_XCONTRIB", lkShell, BtFetchURL) | 793 | sys("MASTER_SITE_XCONTRIB", lkShell, BtFetchURL) | |
783 | sys("MASTER_SITE_XEMACS", lkShell, BtFetchURL) | 794 | sys("MASTER_SITE_XEMACS", lkShell, BtFetchURL) | |
784 | pkglist("MESSAGE_SRC", lkShell, BtPathname) | 795 | pkglist("MESSAGE_SRC", lkShell, BtPathname) | |
785 | acl("MESSAGE_SUBST", lkShell, BtShellWord, "Makefile, Makefile.common, options.mk: append") | 796 | acl("MESSAGE_SUBST", lkShell, BtShellWord, "Makefile, Makefile.common, options.mk: append") | |
786 | pkg("META_PACKAGE", lkNone, BtYes) | 797 | pkg("META_PACKAGE", lkNone, BtYes) | |
787 | sys("MISSING_FEATURES", lkShell, BtIdentifier) | 798 | sys("MISSING_FEATURES", lkShell, BtIdentifier) | |
788 | acl("MYSQL_VERSIONS_ACCEPTED", lkShell, enum("51 55 56"), "Makefile: set") | 799 | acl("MYSQL_VERSIONS_ACCEPTED", lkShell, enumFrom("mk/mysql.buildlink3.mk", "MYSQL_VERSIONS_ACCEPTED", "57 56 55 51 MARIADB55"), "Makefile: set") | |
789 | usr("MYSQL_VERSION_DEFAULT", lkNone, BtVersion) | 800 | usr("MYSQL_VERSION_DEFAULT", lkNone, BtVersion) | |
790 | sys("NM", lkNone, BtShellCommand) | 801 | sys("NM", lkNone, BtShellCommand) | |
791 | sys("NONBINMODE", lkNone, BtFileMode) | 802 | sys("NONBINMODE", lkNone, BtFileMode) | |
792 | pkg("NOT_FOR_COMPILER", lkShell, enum("ccache ccc clang distcc f2c gcc hp icc ido mipspro mipspro-ucode pcc sunpro xlc")) | 803 | pkg("NOT_FOR_COMPILER", lkShell, enum("ccache ccc clang distcc f2c gcc hp icc ido mipspro mipspro-ucode pcc sunpro xlc")) | |
793 | pkglist("NOT_FOR_BULK_PLATFORM", lkSpace, BtMachinePlatformPattern) | 804 | pkglist("NOT_FOR_BULK_PLATFORM", lkSpace, BtMachinePlatformPattern) | |
794 | pkglist("NOT_FOR_PLATFORM", lkSpace, BtMachinePlatformPattern) | 805 | pkglist("NOT_FOR_PLATFORM", lkSpace, BtMachinePlatformPattern) | |
795 | pkg("NOT_FOR_UNPRIVILEGED", lkNone, BtYesNo) | 806 | pkg("NOT_FOR_UNPRIVILEGED", lkNone, BtYesNo) | |
796 | pkglist("NOT_PAX_ASLR_SAFE", lkShell, BtPathmask) | 807 | pkglist("NOT_PAX_ASLR_SAFE", lkShell, BtPathmask) | |
797 | pkglist("NOT_PAX_MPROTECT_SAFE", lkShell, BtPathmask) | 808 | pkglist("NOT_PAX_MPROTECT_SAFE", lkShell, BtPathmask) | |
798 | acl("NO_BIN_ON_CDROM", lkNone, BtRestricted, "Makefile, Makefile.common: set") | 809 | acl("NO_BIN_ON_CDROM", lkNone, BtRestricted, "Makefile, Makefile.common: set") | |
799 | acl("NO_BIN_ON_FTP", lkNone, BtRestricted, "Makefile, Makefile.common: set") | 810 | acl("NO_BIN_ON_FTP", lkNone, BtRestricted, "Makefile, Makefile.common: set") | |
800 | acl("NO_BUILD", lkNone, BtYes, "Makefile, Makefile.common: set; Makefile.*: default, set") | 811 | acl("NO_BUILD", lkNone, BtYes, "Makefile, Makefile.common: set; Makefile.*: default, set") | |
801 | pkg("NO_CHECKSUM", lkNone, BtYes) | 812 | pkg("NO_CHECKSUM", lkNone, BtYes) | |
@@ -823,27 +834,27 @@ func (src *Pkgsrc) InitVartypes() { | @@ -823,27 +834,27 @@ func (src *Pkgsrc) InitVartypes() { | |||
823 | acl("PATCHDIR", lkNone, BtRelativePkgPath, "Makefile: set; Makefile.common: default, set") | 834 | acl("PATCHDIR", lkNone, BtRelativePkgPath, "Makefile: set; Makefile.common: default, set") | |
824 | pkglist("PATCHFILES", lkShell, BtFilename) | 835 | pkglist("PATCHFILES", lkShell, BtFilename) | |
825 | acl("PATCH_ARGS", lkShell, BtShellWord, "") | 836 | acl("PATCH_ARGS", lkShell, BtShellWord, "") | |
826 | acl("PATCH_DIST_ARGS", lkShell, BtShellWord, "Makefile: set, append") | 837 | acl("PATCH_DIST_ARGS", lkShell, BtShellWord, "Makefile: set, append") | |
827 | acl("PATCH_DIST_CAT", lkNone, BtShellCommand, "") | 838 | acl("PATCH_DIST_CAT", lkNone, BtShellCommand, "") | |
828 | acl("PATCH_DIST_STRIP*", lkNone, BtShellWord, "buildlink3.mk, builtin.mk:; Makefile, Makefile.common, *.mk: set") | 839 | acl("PATCH_DIST_STRIP*", lkNone, BtShellWord, "buildlink3.mk, builtin.mk:; Makefile, Makefile.common, *.mk: set") | |
829 | acl("PATCH_SITES", lkShell, BtFetchURL, "Makefile, Makefile.common, options.mk: set") | 840 | acl("PATCH_SITES", lkShell, BtFetchURL, "Makefile, Makefile.common, options.mk: set") | |
830 | acl("PATCH_STRIP", lkNone, BtShellWord, "") | 841 | acl("PATCH_STRIP", lkNone, BtShellWord, "") | |
831 | acl("PERL5_PACKLIST", lkShell, BtPerl5Packlist, "Makefile: set; options.mk: set, append") | 842 | acl("PERL5_PACKLIST", lkShell, BtPerl5Packlist, "Makefile: set; options.mk: set, append") | |
832 | acl("PERL5_PACKLIST_DIR", lkNone, BtPathname, "") | 843 | acl("PERL5_PACKLIST_DIR", lkNone, BtPathname, "") | |
833 | pkg("PERL5_REQD", lkShell, BtVersion) | 844 | pkg("PERL5_REQD", lkShell, BtVersion) | |
834 | pkg("PERL5_USE_PACKLIST", lkNone, BtYesNo) | 845 | pkg("PERL5_USE_PACKLIST", lkNone, BtYesNo) | |
835 | sys("PGSQL_PREFIX", lkNone, BtPathname) | 846 | sys("PGSQL_PREFIX", lkNone, BtPathname) | |
836 | acl("PGSQL_VERSIONS_ACCEPTED", lkShell, enum("10 93 94 95 96"), "") | 847 | acl("PGSQL_VERSIONS_ACCEPTED", lkShell, enumFrom("mk/pgsql.buildlink3.mk", "PGSQL_VERSIONS_ACCEPTED", "10 96 95 94 93"), "") | |
837 | usr("PGSQL_VERSION_DEFAULT", lkNone, BtVersion) | 848 | usr("PGSQL_VERSION_DEFAULT", lkNone, BtVersion) | |
838 | sys("PG_LIB_EXT", lkNone, enum("dylib so")) | 849 | sys("PG_LIB_EXT", lkNone, enum("dylib so")) | |
839 | sys("PGSQL_TYPE", lkNone, enum("postgresql81-client postgresql80-client")) | 850 | sys("PGSQL_TYPE", lkNone, enum("postgresql81-client postgresql80-client")) | |
840 | sys("PGPKGSRCDIR", lkNone, BtPathname) | 851 | sys("PGPKGSRCDIR", lkNone, BtPathname) | |
841 | sys("PHASE_MSG", lkNone, BtShellCommand) | 852 | sys("PHASE_MSG", lkNone, BtShellCommand) | |
842 | usr("PHP_VERSION_REQD", lkNone, BtVersion) | 853 | usr("PHP_VERSION_REQD", lkNone, BtVersion) | |
843 | sys("PKGBASE", lkNone, BtIdentifier) | 854 | sys("PKGBASE", lkNone, BtIdentifier) | |
844 | acl("PKGCONFIG_FILE.*", lkShell, BtPathname, "builtin.mk: set, append; pkgconfig-builtin.mk: use-loadtime") | 855 | acl("PKGCONFIG_FILE.*", lkShell, BtPathname, "builtin.mk: set, append; pkgconfig-builtin.mk: use-loadtime") | |
845 | acl("PKGCONFIG_OVERRIDE", lkShell, BtPathmask, "Makefile: set, append; Makefile.common: append") | 856 | acl("PKGCONFIG_OVERRIDE", lkShell, BtPathmask, "Makefile: set, append; Makefile.common: append") | |
846 | pkg("PKGCONFIG_OVERRIDE_STAGE", lkNone, BtStage) | 857 | pkg("PKGCONFIG_OVERRIDE_STAGE", lkNone, BtStage) | |
847 | pkg("PKGDIR", lkNone, BtRelativePkgDir) | 858 | pkg("PKGDIR", lkNone, BtRelativePkgDir) | |
848 | sys("PKGDIRMODE", lkNone, BtFileMode) | 859 | sys("PKGDIRMODE", lkNone, BtFileMode) | |
849 | sys("PKGLOCALEDIR", lkNone, BtPathname) | 860 | sys("PKGLOCALEDIR", lkNone, BtPathname) |
@@ -616,40 +616,44 @@ func (cv *VartypeCheck) Message() { | @@ -616,40 +616,44 @@ func (cv *VartypeCheck) Message() { | |||
616 | if matches(value, `^[\"'].*[\"']$`) { | 616 | if matches(value, `^[\"'].*[\"']$`) { | |
617 | line.Warnf("%s should not be quoted.", varname) | 617 | line.Warnf("%s should not be quoted.", varname) | |
618 | Explain( | 618 | Explain( | |
619 | "The quoting is only needed for variables which are interpreted as", | 619 | "The quoting is only needed for variables which are interpreted as", | |
620 | "multiple words (or, generally speaking, a list of something). A", | 620 | "multiple words (or, generally speaking, a list of something). A", | |
621 | "single text message does not belong to this class, since it is only", | 621 | "single text message does not belong to this class, since it is only", | |
622 | "printed as a whole.", | 622 | "printed as a whole.", | |
623 | "", | 623 | "", | |
624 | "On the other hand, PKG_FAIL_REASON is a _list_ of text messages, so", | 624 | "On the other hand, PKG_FAIL_REASON is a _list_ of text messages, so", | |
625 | "in that case, the quoting has to be done.") | 625 | "in that case, the quoting has to be done.") | |
626 | } | 626 | } | |
627 | } | 627 | } | |
628 | 628 | |||
629 | // A package option from options.mk | 629 | // Option checks whether a single package option from options.mk conforms to the naming conventions. | |
630 | func (cv *VartypeCheck) Option() { | 630 | func (cv *VartypeCheck) Option() { | |
631 | line, value, valueNovar := cv.Line, cv.Value, cv.ValueNoVar | 631 | line, value, valueNovar := cv.Line, cv.Value, cv.ValueNoVar | |
632 | 632 | |||
633 | if value != valueNovar { | 633 | if value != valueNovar { | |
634 | if trace.Tracing { | 634 | if trace.Tracing { | |
635 | trace.Step1("Unchecked option name: %q", value) | 635 | trace.Step1("Unchecked option name: %q", value) | |
636 | } | 636 | } | |
637 | return | 637 | return | |
638 | } | 638 | } | |
639 | 639 | |||
640 | if m, optname := match1(value, `^-?([a-z][-0-9a-z+]*)$`); m { | 640 | if m, optname := match1(value, `^-?([a-z][-0-9a-z+]*)$`); m { | |
641 | if G.Mk != nil && !G.Mk.FirstTime("option:"+optname) { | |||
642 | return | |||
643 | } | |||
644 | ||||
641 | if _, found := G.Pkgsrc.PkgOptions[optname]; !found { // There's a difference between empty and absent here. | 645 | if _, found := G.Pkgsrc.PkgOptions[optname]; !found { // There's a difference between empty and absent here. | |
642 | line.Warnf("Unknown option \"%s\".", optname) | 646 | line.Warnf("Unknown option %q.", optname) | |
643 | Explain( | 647 | Explain( | |
644 | "This option is not documented in the mk/defaults/options.description", | 648 | "This option is not documented in the mk/defaults/options.description", | |
645 | "file. Please think of a brief but precise description and either", | 649 | "file. Please think of a brief but precise description and either", | |
646 | "update that file yourself or suggest a description for this option", | 650 | "update that file yourself or suggest a description for this option", | |
647 | "on the tech-pkg@NetBSD.org mailing list.") | 651 | "on the tech-pkg@NetBSD.org mailing list.") | |
648 | } | 652 | } | |
649 | return | 653 | return | |
650 | } | 654 | } | |
651 | 655 | |||
652 | if matches(value, `^-?([a-z][-0-9a-z_\+]*)$`) { | 656 | if matches(value, `^-?([a-z][-0-9a-z_\+]*)$`) { | |
653 | line.Warnf("Use of the underscore character in option names is deprecated.") | 657 | line.Warnf("Use of the underscore character in option names is deprecated.") | |
654 | return | 658 | return | |
655 | } | 659 | } |