Updated pkglint to 5.4.26. Changes since 5.4.25: * When autofixing a patch, fix the corresponding distinfo file as well. * Properly parse ${VARNAME:[\#]}; the # was interpreted as a comment before. * Don't add unnecessary :Q to PKG_OPTIONS and related variables. * Don't warn about missing manual pages. While Debian and other distributions do this work, pkgsrc keeps the packages as original as possible. * Autofix redundant ".gz" for manual pages in PLISTs.diff -r1.522 -r1.523 pkgsrc/pkgtools/pkglint/Makefile
(rillig)
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | # $NetBSD: Makefile,v 1.522 2018/01/07 01:13:21 rillig Exp $ | 1 | # $NetBSD: Makefile,v 1.523 2018/01/07 17:08:15 rillig Exp $ | |
2 | 2 | |||
3 | PKGNAME= pkglint-5.4.25 | 3 | PKGNAME= pkglint-5.4.26 | |
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= http://www.NetBSD.org/docs/pkgsrc/ | 8 | HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/ | |
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_LANGUAGES= c | 14 | USE_LANGUAGES= c | |
15 | USE_TOOLS+= pax | 15 | USE_TOOLS+= pax | |
16 | AUTO_MKDIRS= yes | 16 | AUTO_MKDIRS= yes |
@@ -285,13 +285,52 @@ func (s *Suite) Test_ChecklinesBuildlink | @@ -285,13 +285,52 @@ func (s *Suite) Test_ChecklinesBuildlink | |||
285 | "BUILDLINK_API_DEPENDS.${LICENSE}-wxWidgets+=\t${PYPKGPREFIX}-wxWidgets>=2.6.1.0", | 285 | "BUILDLINK_API_DEPENDS.${LICENSE}-wxWidgets+=\t${PYPKGPREFIX}-wxWidgets>=2.6.1.0", | |
286 | "BUILDLINK_ABI_DEPENDS.${LICENSE}-wxWidgets+=\t${PYPKGPREFIX}-wxWidgets>=2.8.10.1nb26", | 286 | "BUILDLINK_ABI_DEPENDS.${LICENSE}-wxWidgets+=\t${PYPKGPREFIX}-wxWidgets>=2.8.10.1nb26", | |
287 | "", | 287 | "", | |
288 | ".endif", | 288 | ".endif", | |
289 | "", | 289 | "", | |
290 | "BUILDLINK_TREE+=\t-${PYPKGPREFIX}-wxWidgets") | 290 | "BUILDLINK_TREE+=\t-${PYPKGPREFIX}-wxWidgets") | |
291 | 291 | |||
292 | ChecklinesBuildlink3Mk(mklines) | 292 | ChecklinesBuildlink3Mk(mklines) | |
293 | 293 | |||
294 | s.CheckOutputLines( | 294 | s.CheckOutputLines( | |
295 | "WARN: buildlink3.mk:3: Please replace \"${LICENSE}\" with a simple string (also in other variables in this file).", | 295 | "WARN: buildlink3.mk:3: Please replace \"${LICENSE}\" with a simple string (also in other variables in this file).", | |
296 | "WARN: buildlink3.mk:13: This line should contain the following text: BUILDLINK_TREE+=\t-${LICENSE}-wxWidgets") | 296 | "WARN: buildlink3.mk:13: This line should contain the following text: BUILDLINK_TREE+=\t-${LICENSE}-wxWidgets") | |
297 | } | 297 | } | |
298 | ||||
299 | // Those .include lines that are not indented at all may stay as-is. | |||
300 | // This special exception might have been for backwards-compatibility, | |||
301 | // but ideally should be handled like everywhere else. | |||
302 | // See MkLineChecker.checkInclude. | |||
303 | func (s *Suite) Test_ChecklinesBuildlink3Mk_indentation(c *check.C) { | |||
304 | s.Init(c) | |||
305 | s.UseCommandLine("-Wall") | |||
306 | G.globalData.InitVartypes() | |||
307 | mklines := s.NewMkLines("buildlink3.mk", | |||
308 | mkrcsid, | |||
309 | "", | |||
310 | ".if ${VAAPI_AVAILABLE} == \"yes\"", | |||
311 | "", | |||
312 | "BUILDLINK_TREE+= libva", | |||
313 | "", | |||
314 | ". if !defined(LIBVA_BUILDLINK3_MK)", | |||
315 | "LIBVA_BUILDLINK3_MK:=", | |||
316 | "", | |||
317 | "BUILDLINK_API_DEPENDS.libva+= libva>=1.0.6", | |||
318 | "BUILDLINK_PKGSRCDIR.libva?= ../../multimedia/libva", | |||
319 | "", | |||
320 | ".include \"../../x11/libX11/buildlink3.mk\"", | |||
321 | "", | |||
322 | ". endif # LIBVA_BUILDLINK3_MK", | |||
323 | "", | |||
324 | "BUILDLINK_TREE+= -libva", | |||
325 | "", | |||
326 | ".endif # VAAPI_AVAILABLE") | |||
327 | ||||
328 | ChecklinesBuildlink3Mk(mklines) | |||
329 | ||||
330 | // No warning about the indentation of the .include lines. | |||
331 | s.CheckOutputLines( | |||
332 | "ERROR: buildlink3.mk:11: \"/multimedia/libva\" does not exist.", | |||
333 | "ERROR: buildlink3.mk:11: There is no package in \"multimedia/libva\".", | |||
334 | "ERROR: buildlink3.mk:13: \"/x11/libX11/buildlink3.mk\" does not exist.", | |||
335 | "WARN: buildlink3.mk:3: Expected a BUILDLINK_TREE line.") | |||
336 | } |
@@ -96,41 +96,48 @@ func (ck *distinfoLinesChecker) onFilena | @@ -96,41 +96,48 @@ func (ck *distinfoLinesChecker) onFilena | |||
96 | "", | 96 | "", | |
97 | "If the patches directory looks wrong, pkglint needs to be improved.") | 97 | "If the patches directory looks wrong, pkglint needs to be improved.") | |
98 | } else if algorithms != "SHA1, RMD160, Size" && algorithms != "SHA1, RMD160, SHA512, Size" { | 98 | } else if algorithms != "SHA1, RMD160, Size" && algorithms != "SHA1, RMD160, SHA512, Size" { | |
99 | line.Errorf("Expected SHA1, RMD160, SHA512, Size checksums for %q, got %s.", currentFname, algorithms) | 99 | line.Errorf("Expected SHA1, RMD160, SHA512, Size checksums for %q, got %s.", currentFname, algorithms) | |
100 | } | 100 | } | |
101 | } | 101 | } | |
102 | 102 | |||
103 | ck.isPatch = hasPrefix(nextFname, "patch-") && fileExists(G.CurrentDir+"/"+ck.patchdir+"/"+nextFname) | 103 | ck.isPatch = hasPrefix(nextFname, "patch-") && fileExists(G.CurrentDir+"/"+ck.patchdir+"/"+nextFname) | |
104 | ck.currentFilename = nextFname | 104 | ck.currentFilename = nextFname | |
105 | ck.currentFirstLine = line | 105 | ck.currentFirstLine = line | |
106 | ck.algorithms = nil | 106 | ck.algorithms = nil | |
107 | } | 107 | } | |
108 | 108 | |||
109 | func (ck *distinfoLinesChecker) checkPatchSha1(line Line, patchFname, distinfoSha1Hex string) { | 109 | func computePatchSha1Hex(patchFilename string) (string, error) { | |
110 | patchBytes, err := ioutil.ReadFile(G.CurrentDir + "/" + patchFname) | 110 | patchBytes, err := ioutil.ReadFile(patchFilename) | |
111 | if err != nil { | 111 | if err != nil { | |
112 | line.Errorf("%s does not exist.", patchFname) | 112 | return "", err | |
113 | return | |||
114 | } | 113 | } | |
115 | 114 | |||
116 | h := sha1.New() | 115 | h := sha1.New() | |
117 | netbsd := []byte("$" + "NetBSD") | 116 | netbsd := []byte("$" + "NetBSD") | |
118 | for _, patchLine := range bytes.SplitAfter(patchBytes, []byte("\n")) { | 117 | for _, patchLine := range bytes.SplitAfter(patchBytes, []byte("\n")) { | |
119 | if !bytes.Contains(patchLine, netbsd) { | 118 | if !bytes.Contains(patchLine, netbsd) { | |
120 | h.Write(patchLine) | 119 | h.Write(patchLine) | |
121 | } | 120 | } | |
122 | } | 121 | } | |
123 | fileSha1Hex := fmt.Sprintf("%x", h.Sum(nil)) | 122 | return fmt.Sprintf("%x", h.Sum(nil)), nil | |
123 | } | |||
124 | ||||
125 | func (ck *distinfoLinesChecker) checkPatchSha1(line Line, patchFname, distinfoSha1Hex string) { | |||
126 | fileSha1Hex, err := computePatchSha1Hex(G.CurrentDir + "/" + patchFname) | |||
127 | if err != nil { | |||
128 | line.Errorf("%s does not exist.", patchFname) | |||
129 | return | |||
130 | } | |||
124 | if distinfoSha1Hex != fileSha1Hex { | 131 | if distinfoSha1Hex != fileSha1Hex { | |
125 | if !line.AutofixReplace(distinfoSha1Hex, fileSha1Hex) { | 132 | if !line.AutofixReplace(distinfoSha1Hex, fileSha1Hex) { | |
126 | line.Errorf("%s hash of %s differs (distinfo has %s, patch file has %s). Run \"%s makepatchsum\".", "SHA1", patchFname, distinfoSha1Hex, fileSha1Hex, confMake) | 133 | line.Errorf("%s hash of %s differs (distinfo has %s, patch file has %s). Run \"%s makepatchsum\".", "SHA1", patchFname, distinfoSha1Hex, fileSha1Hex, confMake) | |
127 | } | 134 | } | |
128 | } | 135 | } | |
129 | } | 136 | } | |
130 | 137 | |||
131 | func (ck *distinfoLinesChecker) checkUnrecordedPatches() { | 138 | func (ck *distinfoLinesChecker) checkUnrecordedPatches() { | |
132 | files, err := ioutil.ReadDir(G.CurrentDir + "/" + ck.patchdir) | 139 | files, err := ioutil.ReadDir(G.CurrentDir + "/" + ck.patchdir) | |
133 | if err != nil { | 140 | if err != nil { | |
134 | if trace.Tracing { | 141 | if trace.Tracing { | |
135 | trace.Stepf("Cannot read patchesDir %q: %s", ck.patchdir, err) | 142 | trace.Stepf("Cannot read patchesDir %q: %s", ck.patchdir, err) | |
136 | } | 143 | } | |
@@ -161,13 +168,23 @@ func (ck *distinfoLinesChecker) checkGlo | @@ -161,13 +168,23 @@ func (ck *distinfoLinesChecker) checkGlo | |||
161 | } | 168 | } | |
162 | } | 169 | } | |
163 | 170 | |||
164 | func (ck *distinfoLinesChecker) checkUncommittedPatch(line Line, patchName, sha1Hash string) { | 171 | func (ck *distinfoLinesChecker) checkUncommittedPatch(line Line, patchName, sha1Hash string) { | |
165 | if ck.isPatch { | 172 | if ck.isPatch { | |
166 | patchFname := ck.patchdir + "/" + patchName | 173 | patchFname := ck.patchdir + "/" + patchName | |
167 | if ck.distinfoIsCommitted && !isCommitted(G.CurrentDir+"/"+patchFname) { | 174 | if ck.distinfoIsCommitted && !isCommitted(G.CurrentDir+"/"+patchFname) { | |
168 | line.Warnf("%s is registered in distinfo but not added to CVS.", patchFname) | 175 | line.Warnf("%s is registered in distinfo but not added to CVS.", patchFname) | |
169 | } | 176 | } | |
170 | ck.checkPatchSha1(line, patchFname, sha1Hash) | 177 | ck.checkPatchSha1(line, patchFname, sha1Hash) | |
171 | ck.patches[patchName] = true | 178 | ck.patches[patchName] = true | |
172 | } | 179 | } | |
173 | } | 180 | } | |
181 | ||||
182 | func AutofixDistinfo(oldSha1, newSha1 string) { | |||
183 | distinfoFilename := G.CurrentDir + "/" + G.Pkg.DistinfoFile | |||
184 | if lines, err := readLines(distinfoFilename, false); err == nil { | |||
185 | for _, line := range lines { | |||
186 | line.AutofixReplace(oldSha1, newSha1) | |||
187 | } | |||
188 | SaveAutofixChanges(lines) | |||
189 | } | |||
190 | } |
@@ -120,27 +120,27 @@ func (mklines *MkLines) Check() { | @@ -120,27 +120,27 @@ func (mklines *MkLines) Check() { | |||
120 | substcontext.Varassign(mkline) | 120 | substcontext.Varassign(mkline) | |
121 | 121 | |||
122 | case mkline.IsInclude(): | 122 | case mkline.IsInclude(): | |
123 | mklines.target = "" | 123 | mklines.target = "" | |
124 | switch path.Base(mkline.Includefile()) { | 124 | switch path.Base(mkline.Includefile()) { | |
125 | case "bsd.prefs.mk", "bsd.fast.prefs.mk", "bsd.builtin.mk": | 125 | case "bsd.prefs.mk", "bsd.fast.prefs.mk", "bsd.builtin.mk": | |
126 | mklines.setSeenBsdPrefsMk() | 126 | mklines.setSeenBsdPrefsMk() | |
127 | } | 127 | } | |
128 | if G.Pkg != nil { | 128 | if G.Pkg != nil { | |
129 | G.Pkg.CheckInclude(mkline, indentation) | 129 | G.Pkg.CheckInclude(mkline, indentation) | |
130 | } | 130 | } | |
131 | 131 | |||
132 | case mkline.IsCond(): | 132 | case mkline.IsCond(): | |
133 | ck.checkCond(mklines.forVars) | 133 | ck.checkCond(mklines.forVars, indentation) | |
134 | 134 | |||
135 | case mkline.IsDependency(): | 135 | case mkline.IsDependency(): | |
136 | ck.checkDependencyRule(allowedTargets) | 136 | ck.checkDependencyRule(allowedTargets) | |
137 | mklines.target = mkline.Targets() | 137 | mklines.target = mkline.Targets() | |
138 | } | 138 | } | |
139 | } | 139 | } | |
140 | lastMkline := mklines.mklines[len(mklines.mklines)-1] | 140 | lastMkline := mklines.mklines[len(mklines.mklines)-1] | |
141 | substcontext.Finish(lastMkline) | 141 | substcontext.Finish(lastMkline) | |
142 | varalign.Finish() | 142 | varalign.Finish() | |
143 | 143 | |||
144 | ChecklinesTrailingEmptyLines(mklines.lines) | 144 | ChecklinesTrailingEmptyLines(mklines.lines) | |
145 | 145 | |||
146 | if indentation.Len() != 1 && indentation.Depth() != 0 { | 146 | if indentation.Len() != 1 && indentation.Depth() != 0 { |
@@ -92,32 +92,33 @@ func NewMkLine(line Line) (mkline *MkLin | @@ -92,32 +92,33 @@ func NewMkLine(line Line) (mkline *MkLin | |||
92 | value, | 92 | value, | |
93 | comment} | 93 | comment} | |
94 | mkline.Tokenize(value) | 94 | mkline.Tokenize(value) | |
95 | return | 95 | return | |
96 | } | 96 | } | |
97 | 97 | |||
98 | if hasPrefix(text, "\t") { | 98 | if hasPrefix(text, "\t") { | |
99 | shellcmd := text[1:] | 99 | shellcmd := text[1:] | |
100 | mkline.data = mkLineShell{shellcmd} | 100 | mkline.data = mkLineShell{shellcmd} | |
101 | mkline.Tokenize(shellcmd) | 101 | mkline.Tokenize(shellcmd) | |
102 | return | 102 | return | |
103 | } | 103 | } | |
104 | 104 | |||
105 | if index := strings.IndexByte(text, '#'); index != -1 && strings.TrimSpace(text[:index]) == "" { | 105 | trimmedText := strings.TrimSpace(text) | |
106 | if strings.HasPrefix(trimmedText, "#") { | |||
106 | mkline.data = mkLineComment{} | 107 | mkline.data = mkLineComment{} | |
107 | return | 108 | return | |
108 | } | 109 | } | |
109 | 110 | |||
110 | if strings.TrimSpace(text) == "" { | 111 | if trimmedText == "" { | |
111 | mkline.data = mkLineEmpty{} | 112 | mkline.data = mkLineEmpty{} | |
112 | return | 113 | return | |
113 | } | 114 | } | |
114 | 115 | |||
115 | if m, indent, directive, args := matchMkCond(text); m { | 116 | if m, indent, directive, args := matchMkCond(text); m { | |
116 | mkline.data = mkLineConditional{indent, directive, args} | 117 | mkline.data = mkLineConditional{indent, directive, args} | |
117 | return | 118 | return | |
118 | } | 119 | } | |
119 | 120 | |||
120 | if m, indent, directive, includefile := MatchMkInclude(text); m { | 121 | if m, indent, directive, includefile := MatchMkInclude(text); m { | |
121 | mkline.data = mkLineInclude{directive == "include", false, indent, includefile, ""} | 122 | mkline.data = mkLineInclude{directive == "include", false, indent, includefile, ""} | |
122 | return | 123 | return | |
123 | } | 124 | } | |
@@ -302,37 +303,37 @@ func matchMkCond(text string) (m bool, i | @@ -302,37 +303,37 @@ func matchMkCond(text string) (m bool, i | |||
302 | directive = text[directiveStart:directiveEnd] | 303 | directive = text[directiveStart:directiveEnd] | |
303 | switch directive { | 304 | switch directive { | |
304 | case "if", "ifdef", "ifndef", "else", "elif", "endif", "for", "endfor", "undef": | 305 | case "if", "ifdef", "ifndef", "else", "elif", "endif", "for", "endfor", "undef": | |
305 | break | 306 | break | |
306 | default: | 307 | default: | |
307 | return | 308 | return | |
308 | } | 309 | } | |
309 | 310 | |||
310 | for i < n && (text[i] == ' ' || text[i] == '\t') { | 311 | for i < n && (text[i] == ' ' || text[i] == '\t') { | |
311 | i++ | 312 | i++ | |
312 | } | 313 | } | |
313 | 314 | |||
314 | argsStart := i | 315 | argsStart := i | |
315 | for i < n && text[i] != '#' { | 316 | for i < n && (text[i] != '#' || text[i-1] == '\\') { | |
316 | i++ | 317 | i++ | |
317 | } | 318 | } | |
318 | for i > argsStart && (text[i-1] == ' ' || text[i-1] == '\t') { | 319 | for i > argsStart && (text[i-1] == ' ' || text[i-1] == '\t') { | |
319 | i-- | 320 | i-- | |
320 | } | 321 | } | |
321 | argsEnd := i | 322 | argsEnd := i | |
322 | 323 | |||
323 | m = true | 324 | m = true | |
324 | indent = text[indentStart:indentEnd] | 325 | indent = text[indentStart:indentEnd] | |
325 | args = text[argsStart:argsEnd] | 326 | args = strings.Replace(text[argsStart:argsEnd], "\\#", "#", -1) | |
326 | return | 327 | return | |
327 | } | 328 | } | |
328 | 329 | |||
329 | type NeedsQuoting uint8 | 330 | type NeedsQuoting uint8 | |
330 | 331 | |||
331 | const ( | 332 | const ( | |
332 | nqNo NeedsQuoting = iota | 333 | nqNo NeedsQuoting = iota | |
333 | nqYes | 334 | nqYes | |
334 | nqDoesntMatter | 335 | nqDoesntMatter | |
335 | nqDontKnow | 336 | nqDontKnow | |
336 | ) | 337 | ) | |
337 | 338 | |||
338 | func (nq NeedsQuoting) String() string { | 339 | func (nq NeedsQuoting) String() string { |
@@ -123,53 +123,53 @@ func (s *Suite) Test_VaralignBlock_Check | @@ -123,53 +123,53 @@ func (s *Suite) Test_VaralignBlock_Check | |||
123 | "NOTE: file.mk:2: This variable value should be aligned with tabs, not spaces, to column 33.", | 123 | "NOTE: file.mk:2: This variable value should be aligned with tabs, not spaces, to column 33.", | |
124 | "NOTE: file.mk:3: This variable value should be aligned with tabs, not spaces, to column 33.", | 124 | "NOTE: file.mk:3: This variable value should be aligned with tabs, not spaces, to column 33.", | |
125 | "NOTE: file.mk:4: This variable value should be aligned with tabs, not spaces, to column 33.") | 125 | "NOTE: file.mk:4: This variable value should be aligned with tabs, not spaces, to column 33.") | |
126 | } | 126 | } | |
127 | 127 | |||
128 | func (s *Suite) Test_NewMkLine(c *check.C) { | 128 | func (s *Suite) Test_NewMkLine(c *check.C) { | |
129 | s.Init(c) | 129 | s.Init(c) | |
130 | s.UseCommandLine("-Wspace") | 130 | s.UseCommandLine("-Wspace") | |
131 | mklines := NewMkLines(s.NewLines("test.mk", | 131 | mklines := NewMkLines(s.NewLines("test.mk", | |
132 | "VARNAME.param?=value # varassign comment", | 132 | "VARNAME.param?=value # varassign comment", | |
133 | "\tshell command # shell comment", | 133 | "\tshell command # shell comment", | |
134 | "# whole line comment", | 134 | "# whole line comment", | |
135 | "", | 135 | "", | |
136 | ". if !empty(PKGNAME:M*-*) # cond comment", | 136 | ". if !empty(PKGNAME:M*-*) && ${RUBY_RAILS_SUPPORTED:[\\#]} == 1 # cond comment", | |
137 | ". include \"../../mk/bsd.prefs.mk\" # include comment", | 137 | ". include \"../../mk/bsd.prefs.mk\" # include comment", | |
138 | ". include <subdir.mk> # sysinclude comment", | 138 | ". include <subdir.mk> # sysinclude comment", | |
139 | "target1 target2: source1 source2", | 139 | "target1 target2: source1 source2", | |
140 | "target : source", | 140 | "target : source", | |
141 | "VARNAME+=value")) | 141 | "VARNAME+=value")) | |
142 | ln := mklines.mklines | 142 | ln := mklines.mklines | |
143 | 143 | |||
144 | c.Check(ln[0].IsVarassign(), equals, true) | 144 | c.Check(ln[0].IsVarassign(), equals, true) | |
145 | c.Check(ln[0].Varname(), equals, "VARNAME.param") | 145 | c.Check(ln[0].Varname(), equals, "VARNAME.param") | |
146 | c.Check(ln[0].Varcanon(), equals, "VARNAME.*") | 146 | c.Check(ln[0].Varcanon(), equals, "VARNAME.*") | |
147 | c.Check(ln[0].Varparam(), equals, "param") | 147 | c.Check(ln[0].Varparam(), equals, "param") | |
148 | c.Check(ln[0].Op(), equals, opAssignDefault) | 148 | c.Check(ln[0].Op(), equals, opAssignDefault) | |
149 | c.Check(ln[0].Value(), equals, "value") | 149 | c.Check(ln[0].Value(), equals, "value") | |
150 | c.Check(ln[0].VarassignComment(), equals, "# varassign comment") | 150 | c.Check(ln[0].VarassignComment(), equals, "# varassign comment") | |
151 | 151 | |||
152 | c.Check(ln[1].IsShellcmd(), equals, true) | 152 | c.Check(ln[1].IsShellcmd(), equals, true) | |
153 | c.Check(ln[1].Shellcmd(), equals, "shell command # shell comment") | 153 | c.Check(ln[1].Shellcmd(), equals, "shell command # shell comment") | |
154 | 154 | |||
155 | c.Check(ln[2].IsComment(), equals, true) | 155 | c.Check(ln[2].IsComment(), equals, true) | |
156 | 156 | |||
157 | c.Check(ln[3].IsEmpty(), equals, true) | 157 | c.Check(ln[3].IsEmpty(), equals, true) | |
158 | 158 | |||
159 | c.Check(ln[4].IsCond(), equals, true) | 159 | c.Check(ln[4].IsCond(), equals, true) | |
160 | c.Check(ln[4].Indent(), equals, " ") | 160 | c.Check(ln[4].Indent(), equals, " ") | |
161 | c.Check(ln[4].Directive(), equals, "if") | 161 | c.Check(ln[4].Directive(), equals, "if") | |
162 | c.Check(ln[4].Args(), equals, "!empty(PKGNAME:M*-*)") | 162 | c.Check(ln[4].Args(), equals, "!empty(PKGNAME:M*-*) && ${RUBY_RAILS_SUPPORTED:[#]} == 1") | |
163 | 163 | |||
164 | c.Check(ln[5].IsInclude(), equals, true) | 164 | c.Check(ln[5].IsInclude(), equals, true) | |
165 | c.Check(ln[5].Indent(), equals, " ") | 165 | c.Check(ln[5].Indent(), equals, " ") | |
166 | c.Check(ln[5].MustExist(), equals, true) | 166 | c.Check(ln[5].MustExist(), equals, true) | |
167 | c.Check(ln[5].Includefile(), equals, "../../mk/bsd.prefs.mk") | 167 | c.Check(ln[5].Includefile(), equals, "../../mk/bsd.prefs.mk") | |
168 | 168 | |||
169 | c.Check(ln[6].IsSysinclude(), equals, true) | 169 | c.Check(ln[6].IsSysinclude(), equals, true) | |
170 | c.Check(ln[6].Indent(), equals, " ") | 170 | c.Check(ln[6].Indent(), equals, " ") | |
171 | c.Check(ln[6].MustExist(), equals, true) | 171 | c.Check(ln[6].MustExist(), equals, true) | |
172 | c.Check(ln[6].Includefile(), equals, "subdir.mk") | 172 | c.Check(ln[6].Includefile(), equals, "subdir.mk") | |
173 | 173 | |||
174 | c.Check(ln[7].IsDependency(), equals, true) | 174 | c.Check(ln[7].IsDependency(), equals, true) | |
175 | c.Check(ln[7].Targets(), equals, "target1 target2") | 175 | c.Check(ln[7].Targets(), equals, "target1 target2") | |
@@ -470,26 +470,45 @@ func (s *Suite) Test_MkLine_variableNeed | @@ -470,26 +470,45 @@ func (s *Suite) Test_MkLine_variableNeed | |||
470 | G.globalData.InitVartypes() | 470 | G.globalData.InitVartypes() | |
471 | G.Mk = s.NewMkLines("x11/mlterm/Makefile", | 471 | G.Mk = s.NewMkLines("x11/mlterm/Makefile", | |
472 | mkrcsid, | 472 | mkrcsid, | |
473 | "SUBST_SED.link=-e 's|(LIBTOOL_LINK).*(LIBS)|& ${LDFLAGS:M*:Q}|g'", | 473 | "SUBST_SED.link=-e 's|(LIBTOOL_LINK).*(LIBS)|& ${LDFLAGS:M*:Q}|g'", | |
474 | "SUBST_SED.link=-e 's|(LIBTOOL_LINK).*(LIBS)|& '${LDFLAGS:M*:Q}'|g'") | 474 | "SUBST_SED.link=-e 's|(LIBTOOL_LINK).*(LIBS)|& '${LDFLAGS:M*:Q}'|g'") | |
475 | 475 | |||
476 | MkLineChecker{G.Mk.mklines[1]}.Check() | 476 | MkLineChecker{G.Mk.mklines[1]}.Check() | |
477 | MkLineChecker{G.Mk.mklines[2]}.Check() | 477 | MkLineChecker{G.Mk.mklines[2]}.Check() | |
478 | 478 | |||
479 | s.CheckOutputLines( | 479 | s.CheckOutputLines( | |
480 | "WARN: x11/mlterm/Makefile:2: Please move ${LDFLAGS:M*:Q} outside of any quoting characters.") | 480 | "WARN: x11/mlterm/Makefile:2: Please move ${LDFLAGS:M*:Q} outside of any quoting characters.") | |
481 | } | 481 | } | |
482 | 482 | |||
483 | // No quoting is necessary here. | |||
484 | // PKG_OPTIONS are declared as "lkShell" although they are processed | |||
485 | // using make's .for loop, which splits them at whitespace and usually | |||
486 | // requires the variable to be declared as "lkSpace". | |||
487 | // In this case it doesn't matter though since each option is an identifier, | |||
488 | // and these do not pose any quoting problems. | |||
489 | func (s *Suite) Test_MkLine_variableNeedsQuoting__package_options(c *check.C) { | |||
490 | s.Init(c) | |||
491 | s.UseCommandLine("-Wall") | |||
492 | G.globalData.InitVartypes() | |||
493 | G.Mk = s.NewMkLines("Makefile", | |||
494 | mkrcsid, | |||
495 | "PKG_SUGGESTED_OPTIONS+=\t${PKG_DEFAULT_OPTIONS:Mcdecimal} ${PKG_OPTIONS.py-trytond:Mcdecimal}") | |||
496 | ||||
497 | MkLineChecker{G.Mk.mklines[1]}.Check() | |||
498 | ||||
499 | s.CheckOutputEmpty() | |||
500 | } | |||
501 | ||||
483 | func (s *Suite) Test_MkLines_Check__MASTER_SITE_in_HOMEPAGE(c *check.C) { | 502 | func (s *Suite) Test_MkLines_Check__MASTER_SITE_in_HOMEPAGE(c *check.C) { | |
484 | s.Init(c) | 503 | s.Init(c) | |
485 | s.UseCommandLine("-Wall") | 504 | s.UseCommandLine("-Wall") | |
486 | s.RegisterMasterSite("MASTER_SITE_GITHUB", "https://github.com/") | 505 | s.RegisterMasterSite("MASTER_SITE_GITHUB", "https://github.com/") | |
487 | G.globalData.InitVartypes() | 506 | G.globalData.InitVartypes() | |
488 | G.Mk = s.NewMkLines("devel/catch/Makefile", | 507 | G.Mk = s.NewMkLines("devel/catch/Makefile", | |
489 | mkrcsid, | 508 | mkrcsid, | |
490 | "HOMEPAGE=\t${MASTER_SITE_GITHUB:=philsquared/Catch/}", | 509 | "HOMEPAGE=\t${MASTER_SITE_GITHUB:=philsquared/Catch/}", | |
491 | "HOMEPAGE=\t${MASTER_SITE_GITHUB}", | 510 | "HOMEPAGE=\t${MASTER_SITE_GITHUB}", | |
492 | "HOMEPAGE=\t${MASTER_SITES}", | 511 | "HOMEPAGE=\t${MASTER_SITES}", | |
493 | "HOMEPAGE=\t${MASTER_SITES}${GITHUB_PROJECT}") | 512 | "HOMEPAGE=\t${MASTER_SITES}${GITHUB_PROJECT}") | |
494 | 513 | |||
495 | G.Mk.Check() | 514 | G.Mk.Check() |
@@ -82,32 +82,31 @@ func (ck MkLineChecker) checkInclude() { | @@ -82,32 +82,31 @@ func (ck MkLineChecker) checkInclude() { | |||
82 | mkline.Errorf("%s must not be included directly. Include \"../../mk/x11.buildlink3.mk\" instead.", includefile) | 82 | mkline.Errorf("%s must not be included directly. Include \"../../mk/x11.buildlink3.mk\" instead.", includefile) | |
83 | 83 | |||
84 | case hasSuffix(includefile, "/jpeg/buildlink3.mk"): | 84 | case hasSuffix(includefile, "/jpeg/buildlink3.mk"): | |
85 | mkline.Errorf("%s must not be included directly. Include \"../../mk/jpeg.buildlink3.mk\" instead.", includefile) | 85 | mkline.Errorf("%s must not be included directly. Include \"../../mk/jpeg.buildlink3.mk\" instead.", includefile) | |
86 | 86 | |||
87 | case hasSuffix(includefile, "/intltool/buildlink3.mk"): | 87 | case hasSuffix(includefile, "/intltool/buildlink3.mk"): | |
88 | mkline.Warnf("Please write \"USE_TOOLS+= intltool\" instead of this line.") | 88 | mkline.Warnf("Please write \"USE_TOOLS+= intltool\" instead of this line.") | |
89 | 89 | |||
90 | case hasSuffix(includefile, "/builtin.mk"): | 90 | case hasSuffix(includefile, "/builtin.mk"): | |
91 | mkline.Errorf("%s must not be included directly. Include \"%s/buildlink3.mk\" instead.", includefile, path.Dir(includefile)) | 91 | mkline.Errorf("%s must not be included directly. Include \"%s/buildlink3.mk\" instead.", includefile, path.Dir(includefile)) | |
92 | } | 92 | } | |
93 | } | 93 | } | |
94 | 94 | |||
95 | func (ck MkLineChecker) checkCond(forVars map[string]bool) { | 95 | func (ck MkLineChecker) checkCond(forVars map[string]bool, indentation *Indentation) { | |
96 | mkline := ck.MkLine | 96 | mkline := ck.MkLine | |
97 | 97 | |||
98 | directive := mkline.Directive() | 98 | directive := mkline.Directive() | |
99 | args := mkline.Args() | 99 | args := mkline.Args() | |
100 | indentation := &G.Mk.indentation | |||
101 | 100 | |||
102 | switch directive { | 101 | switch directive { | |
103 | case "endif", "endfor": | 102 | case "endif", "endfor": | |
104 | if indentation.Len() > 1 { | 103 | if indentation.Len() > 1 { | |
105 | indentation.Pop() | 104 | indentation.Pop() | |
106 | } else { | 105 | } else { | |
107 | mkline.Errorf("Unmatched .%s.", directive) | 106 | mkline.Errorf("Unmatched .%s.", directive) | |
108 | } | 107 | } | |
109 | } | 108 | } | |
110 | 109 | |||
111 | expectedDepth := indentation.Depth() | 110 | expectedDepth := indentation.Depth() | |
112 | if directive == "elif" || directive == "else" { | 111 | if directive == "elif" || directive == "else" { | |
113 | expectedDepth = indentation.depth[len(indentation.depth)-2] | 112 | expectedDepth = indentation.depth[len(indentation.depth)-2] |
@@ -3,26 +3,27 @@ package main | @@ -3,26 +3,27 @@ package main | |||
3 | import ( | 3 | import ( | |
4 | check "gopkg.in/check.v1" | 4 | check "gopkg.in/check.v1" | |
5 | ) | 5 | ) | |
6 | 6 | |||
7 | func (s *Suite) Test_MkParser_MkTokens(c *check.C) { | 7 | func (s *Suite) Test_MkParser_MkTokens(c *check.C) { | |
8 | s.Init(c) | 8 | s.Init(c) | |
9 | checkRest := func(input string, expectedTokens []*MkToken, expectedRest string) { | 9 | checkRest := func(input string, expectedTokens []*MkToken, expectedRest string) { | |
10 | p := NewMkParser(dummyLine, input, true) | 10 | p := NewMkParser(dummyLine, input, true) | |
11 | actualTokens := p.MkTokens() | 11 | actualTokens := p.MkTokens() | |
12 | c.Check(actualTokens, deepEquals, expectedTokens) | 12 | c.Check(actualTokens, deepEquals, expectedTokens) | |
13 | for i, expectedToken := range expectedTokens { | 13 | for i, expectedToken := range expectedTokens { | |
14 | if i < len(actualTokens) { | 14 | if i < len(actualTokens) { | |
15 | c.Check(*actualTokens[i], deepEquals, *expectedToken) | 15 | c.Check(*actualTokens[i], deepEquals, *expectedToken) | |
16 | c.Check(actualTokens[i].Varuse, deepEquals, expectedToken.Varuse) | |||
16 | } | 17 | } | |
17 | } | 18 | } | |
18 | c.Check(p.Rest(), equals, expectedRest) | 19 | c.Check(p.Rest(), equals, expectedRest) | |
19 | } | 20 | } | |
20 | check := func(input string, expectedToken *MkToken) { | 21 | check := func(input string, expectedToken *MkToken) { | |
21 | checkRest(input, []*MkToken{expectedToken}, "") | 22 | checkRest(input, []*MkToken{expectedToken}, "") | |
22 | } | 23 | } | |
23 | literal := func(text string) *MkToken { | 24 | literal := func(text string) *MkToken { | |
24 | return &MkToken{Text: text} | 25 | return &MkToken{Text: text} | |
25 | } | 26 | } | |
26 | varuse := func(varname string, modifiers ...string) *MkToken { | 27 | varuse := func(varname string, modifiers ...string) *MkToken { | |
27 | text := "${" + varname | 28 | text := "${" + varname | |
28 | for _, modifier := range modifiers { | 29 | for _, modifier := range modifiers { | |
@@ -70,26 +71,27 @@ func (s *Suite) Test_MkParser_MkTokens(c | @@ -70,26 +71,27 @@ func (s *Suite) Test_MkParser_MkTokens(c | |||
70 | check("${_PERL5_VARS:tl:S/^/-V:/}", varuse("_PERL5_VARS", "tl", "S/^/-V:/")) | 71 | check("${_PERL5_VARS:tl:S/^/-V:/}", varuse("_PERL5_VARS", "tl", "S/^/-V:/")) | |
71 | check("${_PERL5_VARS_OUT:M${_var_:tl}=*:S/^${_var_:tl}=${_PERL5_PREFIX:=/}//}", varuse("_PERL5_VARS_OUT", "M${_var_:tl}=*", "S/^${_var_:tl}=${_PERL5_PREFIX:=/}//")) | 72 | check("${_PERL5_VARS_OUT:M${_var_:tl}=*:S/^${_var_:tl}=${_PERL5_PREFIX:=/}//}", varuse("_PERL5_VARS_OUT", "M${_var_:tl}=*", "S/^${_var_:tl}=${_PERL5_PREFIX:=/}//")) | |
72 | check("${RUBY${RUBY_VER}_PATCHLEVEL}", varuse("RUBY${RUBY_VER}_PATCHLEVEL")) | 73 | check("${RUBY${RUBY_VER}_PATCHLEVEL}", varuse("RUBY${RUBY_VER}_PATCHLEVEL")) | |
73 | check("${DISTFILES:M*.gem}", varuse("DISTFILES", "M*.gem")) | 74 | check("${DISTFILES:M*.gem}", varuse("DISTFILES", "M*.gem")) | |
74 | check("${LOCALBASE:S^/^_^}", varuse("LOCALBASE", "S^/^_^")) | 75 | check("${LOCALBASE:S^/^_^}", varuse("LOCALBASE", "S^/^_^")) | |
75 | check("${SOURCES:%.c=%.o}", varuse("SOURCES", "%.c=%.o")) | 76 | check("${SOURCES:%.c=%.o}", varuse("SOURCES", "%.c=%.o")) | |
76 | check("${GIT_TEMPLATES:@.t.@ ${EGDIR}/${GIT_TEMPLATEDIR}/${.t.} ${PREFIX}/${GIT_CORE_TEMPLATEDIR}/${.t.} @:M*}", | 77 | check("${GIT_TEMPLATES:@.t.@ ${EGDIR}/${GIT_TEMPLATEDIR}/${.t.} ${PREFIX}/${GIT_CORE_TEMPLATEDIR}/${.t.} @:M*}", | |
77 | varuse("GIT_TEMPLATES", "@.t.@ ${EGDIR}/${GIT_TEMPLATEDIR}/${.t.} ${PREFIX}/${GIT_CORE_TEMPLATEDIR}/${.t.} @", "M*")) | 78 | varuse("GIT_TEMPLATES", "@.t.@ ${EGDIR}/${GIT_TEMPLATEDIR}/${.t.} ${PREFIX}/${GIT_CORE_TEMPLATEDIR}/${.t.} @", "M*")) | |
78 | check("${DISTNAME:C:_:-:}", varuse("DISTNAME", "C:_:-:")) | 79 | check("${DISTNAME:C:_:-:}", varuse("DISTNAME", "C:_:-:")) | |
79 | check("${CF_FILES:H:O:u:S@^@${PKG_SYSCONFDIR}/@}", varuse("CF_FILES", "H", "O", "u", "S@^@${PKG_SYSCONFDIR}/@")) | 80 | check("${CF_FILES:H:O:u:S@^@${PKG_SYSCONFDIR}/@}", varuse("CF_FILES", "H", "O", "u", "S@^@${PKG_SYSCONFDIR}/@")) | |
80 | check("${ALT_GCC_RTS:S%${LOCALBASE}%%:S%/%%}", varuse("ALT_GCC_RTS", "S%${LOCALBASE}%%", "S%/%%")) | 81 | check("${ALT_GCC_RTS:S%${LOCALBASE}%%:S%/%%}", varuse("ALT_GCC_RTS", "S%${LOCALBASE}%%", "S%/%%")) | |
81 | check("${PREFIX:C;///*;/;g:C;/$;;}", varuse("PREFIX", "C;///*;/;g", "C;/$;;")) | 82 | check("${PREFIX:C;///*;/;g:C;/$;;}", varuse("PREFIX", "C;///*;/;g", "C;/$;;")) | |
82 | check("${GZIP_CMD:[1]:Q}", varuse("GZIP_CMD", "[1]", "Q")) | 83 | check("${GZIP_CMD:[1]:Q}", varuse("GZIP_CMD", "[1]", "Q")) | |
84 | check("${RUBY_RAILS_SUPPORTED:[#]}", varuse("RUBY_RAILS_SUPPORTED", "[#]")) | |||
83 | check("${DISTNAME:C/-[0-9]+$$//:C/_/-/}", varuse("DISTNAME", "C/-[0-9]+$$//", "C/_/-/")) | 85 | check("${DISTNAME:C/-[0-9]+$$//:C/_/-/}", varuse("DISTNAME", "C/-[0-9]+$$//", "C/_/-/")) | |
84 | check("${DISTNAME:slang%=slang2%}", varuse("DISTNAME", "slang%=slang2%")) | 86 | check("${DISTNAME:slang%=slang2%}", varuse("DISTNAME", "slang%=slang2%")) | |
85 | check("${OSMAP_SUBSTVARS:@v@-e 's,\\@${v}\\@,${${v}},g' @}", varuse("OSMAP_SUBSTVARS", "@v@-e 's,\\@${v}\\@,${${v}},g' @")) | 87 | check("${OSMAP_SUBSTVARS:@v@-e 's,\\@${v}\\@,${${v}},g' @}", varuse("OSMAP_SUBSTVARS", "@v@-e 's,\\@${v}\\@,${${v}},g' @")) | |
86 | check("${BRANDELF:D${BRANDELF} -t Linux ${LINUX_LDCONFIG}:U${TRUE}}", varuse("BRANDELF", "D${BRANDELF} -t Linux ${LINUX_LDCONFIG}", "U${TRUE}")) | 88 | check("${BRANDELF:D${BRANDELF} -t Linux ${LINUX_LDCONFIG}:U${TRUE}}", varuse("BRANDELF", "D${BRANDELF} -t Linux ${LINUX_LDCONFIG}", "U${TRUE}")) | |
87 | check("${${_var_}.*}", varuse("${_var_}.*")) | 89 | check("${${_var_}.*}", varuse("${_var_}.*")) | |
88 | 90 | |||
89 | check("${GCONF_SCHEMAS:@.s.@${INSTALL_DATA} ${WRKSRC}/src/common/dbus/${.s.} ${DESTDIR}${GCONF_SCHEMAS_DIR}/@}", | 91 | check("${GCONF_SCHEMAS:@.s.@${INSTALL_DATA} ${WRKSRC}/src/common/dbus/${.s.} ${DESTDIR}${GCONF_SCHEMAS_DIR}/@}", | |
90 | varuse("GCONF_SCHEMAS", "@.s.@${INSTALL_DATA} ${WRKSRC}/src/common/dbus/${.s.} ${DESTDIR}${GCONF_SCHEMAS_DIR}/@")) | 92 | varuse("GCONF_SCHEMAS", "@.s.@${INSTALL_DATA} ${WRKSRC}/src/common/dbus/${.s.} ${DESTDIR}${GCONF_SCHEMAS_DIR}/@")) | |
91 | 93 | |||
92 | /* weird features */ | 94 | /* weird features */ | |
93 | check("${${EMACS_VERSION_MAJOR}>22:?@comment :}", varuse("${EMACS_VERSION_MAJOR}>22", "?@comment :")) | 95 | check("${${EMACS_VERSION_MAJOR}>22:?@comment :}", varuse("${EMACS_VERSION_MAJOR}>22", "?@comment :")) | |
94 | check("${empty(CFLAGS):?:-cflags ${CFLAGS:Q}}", varuse("empty(CFLAGS)", "?:-cflags ${CFLAGS:Q}")) | 96 | check("${empty(CFLAGS):?:-cflags ${CFLAGS:Q}}", varuse("empty(CFLAGS)", "?:-cflags ${CFLAGS:Q}")) | |
95 | check("${${PKGSRC_COMPILER}==gcc:?gcc:cc}", varuse("${PKGSRC_COMPILER}==gcc", "?gcc:cc")) | 97 | check("${${PKGSRC_COMPILER}==gcc:?gcc:cc}", varuse("${PKGSRC_COMPILER}==gcc", "?gcc:cc")) |
@@ -161,27 +161,27 @@ func (p *MkParser) VarUseModifiers(varna | @@ -161,27 +161,27 @@ func (p *MkParser) VarUseModifiers(varna | |||
161 | case '@': | 161 | case '@': | |
162 | if repl.AdvanceRegexp(`^@([\w.]+)@`) { | 162 | if repl.AdvanceRegexp(`^@([\w.]+)@`) { | |
163 | loopvar := repl.Group(1) | 163 | loopvar := repl.Group(1) | |
164 | for p.VarUse() != nil || repl.AdvanceRegexp(regex.Pattern(`^([^$:@`+closing+`\\]|\$\$|\\.)+`)) { | 164 | for p.VarUse() != nil || repl.AdvanceRegexp(regex.Pattern(`^([^$:@`+closing+`\\]|\$\$|\\.)+`)) { | |
165 | } | 165 | } | |
166 | if !repl.AdvanceStr("@") && p.EmitWarnings { | 166 | if !repl.AdvanceStr("@") && p.EmitWarnings { | |
167 | p.Line.Warnf("Modifier ${%s:@%s@...@} is missing the final \"@\".", varname, loopvar) | 167 | p.Line.Warnf("Modifier ${%s:@%s@...@} is missing the final \"@\".", varname, loopvar) | |
168 | } | 168 | } | |
169 | modifiers = append(modifiers, repl.Since(modifierMark)) | 169 | modifiers = append(modifiers, repl.Since(modifierMark)) | |
170 | continue | 170 | continue | |
171 | } | 171 | } | |
172 | 172 | |||
173 | case '[': | 173 | case '[': | |
174 | if repl.AdvanceRegexp(`^\[[-.\d]+\]`) { | 174 | if repl.AdvanceRegexp(`^\[(?:[-.\d]+|#)\]`) { | |
175 | modifiers = append(modifiers, repl.Since(modifierMark)) | 175 | modifiers = append(modifiers, repl.Since(modifierMark)) | |
176 | continue | 176 | continue | |
177 | } | 177 | } | |
178 | 178 | |||
179 | case '?': | 179 | case '?': | |
180 | repl.AdvanceStr("?") | 180 | repl.AdvanceStr("?") | |
181 | re := regex.Pattern(`^([^$:` + closing + `]|\$\$)+`) | 181 | re := regex.Pattern(`^([^$:` + closing + `]|\$\$)+`) | |
182 | for p.VarUse() != nil || repl.AdvanceRegexp(re) { | 182 | for p.VarUse() != nil || repl.AdvanceRegexp(re) { | |
183 | } | 183 | } | |
184 | if repl.AdvanceStr(":") { | 184 | if repl.AdvanceStr(":") { | |
185 | for p.VarUse() != nil || repl.AdvanceRegexp(re) { | 185 | for p.VarUse() != nil || repl.AdvanceRegexp(re) { | |
186 | } | 186 | } | |
187 | modifiers = append(modifiers, repl.Since(modifierMark)) | 187 | modifiers = append(modifiers, repl.Since(modifierMark)) |
@@ -80,27 +80,33 @@ func (ck *PatchChecker) Check() { | @@ -80,27 +80,33 @@ func (ck *PatchChecker) Check() { | |||
80 | ck.previousLineEmpty = ck.isEmptyLine(line.Text) | 80 | ck.previousLineEmpty = ck.isEmptyLine(line.Text) | |
81 | if !ck.previousLineEmpty { | 81 | if !ck.previousLineEmpty { | |
82 | ck.seenDocumentation = true | 82 | ck.seenDocumentation = true | |
83 | } | 83 | } | |
84 | } | 84 | } | |
85 | 85 | |||
86 | if patchedFiles > 1 { | 86 | if patchedFiles > 1 { | |
87 | NewLineWhole(ck.lines[0].Filename).Warnf("Contains patches for %d files, should be only one.", patchedFiles) | 87 | NewLineWhole(ck.lines[0].Filename).Warnf("Contains patches for %d files, should be only one.", patchedFiles) | |
88 | } else if patchedFiles == 0 { | 88 | } else if patchedFiles == 0 { | |
89 | NewLineWhole(ck.lines[0].Filename).Errorf("Contains no patch.") | 89 | NewLineWhole(ck.lines[0].Filename).Errorf("Contains no patch.") | |
90 | } | 90 | } | |
91 | 91 | |||
92 | ChecklinesTrailingEmptyLines(ck.lines) | 92 | ChecklinesTrailingEmptyLines(ck.lines) | |
93 | SaveAutofixChanges(ck.lines) | 93 | sha1Before, err := computePatchSha1Hex(ck.lines[0].Filename) | |
94 | if SaveAutofixChanges(ck.lines) && G.Pkg != nil && err == nil { | |||
95 | sha1After, err := computePatchSha1Hex(ck.lines[0].Filename) | |||
96 | if err == nil { | |||
97 | AutofixDistinfo(sha1Before, sha1After) | |||
98 | } | |||
99 | } | |||
94 | } | 100 | } | |
95 | 101 | |||
96 | // See http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html | 102 | // See http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html | |
97 | func (ck *PatchChecker) checkUnifiedDiff(patchedFile string) { | 103 | func (ck *PatchChecker) checkUnifiedDiff(patchedFile string) { | |
98 | if trace.Tracing { | 104 | if trace.Tracing { | |
99 | defer trace.Call0()() | 105 | defer trace.Call0()() | |
100 | } | 106 | } | |
101 | 107 | |||
102 | patchedFileType := guessFileType(ck.exp.CurrentLine(), patchedFile) | 108 | patchedFileType := guessFileType(ck.exp.CurrentLine(), patchedFile) | |
103 | if trace.Tracing { | 109 | if trace.Tracing { | |
104 | trace.Stepf("guessFileType(%q) = %s", patchedFile, patchedFileType) | 110 | trace.Stepf("guessFileType(%q) = %s", patchedFile, patchedFileType) | |
105 | } | 111 | } | |
106 | 112 |
@@ -23,38 +23,36 @@ func (s *Suite) Test_ChecklinesPlist(c * | @@ -23,38 +23,36 @@ func (s *Suite) Test_ChecklinesPlist(c * | |||
23 | "${PLIST.obsolete}@unexec rmdir /tmp", | 23 | "${PLIST.obsolete}@unexec rmdir /tmp", | |
24 | "sbin/clockctl", | 24 | "sbin/clockctl", | |
25 | "share/icons/gnome/delete-icon", | 25 | "share/icons/gnome/delete-icon", | |
26 | "share/icons/hicolor/icon1.png", | 26 | "share/icons/hicolor/icon1.png", | |
27 | "share/icons/hicolor/icon2.png", // No additional warning | 27 | "share/icons/hicolor/icon2.png", // No additional warning | |
28 | "share/tzinfo", | 28 | "share/tzinfo", | |
29 | "share/tzinfo") | 29 | "share/tzinfo") | |
30 | 30 | |||
31 | ChecklinesPlist(lines) | 31 | ChecklinesPlist(lines) | |
32 | 32 | |||
33 | s.CheckOutputLines( | 33 | s.CheckOutputLines( | |
34 | "ERROR: PLIST:1: Expected \"@comment $"+"NetBSD$\".", | 34 | "ERROR: PLIST:1: Expected \"@comment $"+"NetBSD$\".", | |
35 | "WARN: PLIST:1: The bin/ directory should not have subdirectories.", | 35 | "WARN: PLIST:1: The bin/ directory should not have subdirectories.", | |
36 | "WARN: PLIST:2: Manual page missing for bin/program.", | |||
37 | "ERROR: PLIST:3: Configuration files must not be registered in the PLIST. Please use the CONF_FILES framework, which is described in mk/pkginstall/bsd.pkginstall.mk.", | 36 | "ERROR: PLIST:3: Configuration files must not be registered in the PLIST. Please use the CONF_FILES framework, which is described in mk/pkginstall/bsd.pkginstall.mk.", | |
38 | "ERROR: PLIST:4: RCD_SCRIPTS must not be registered in the PLIST. Please use the RCD_SCRIPTS framework.", | 37 | "ERROR: PLIST:4: RCD_SCRIPTS must not be registered in the PLIST. Please use the RCD_SCRIPTS framework.", | |
39 | "ERROR: PLIST:6: \"info/dir\" must not be listed. Use install-info to add/remove an entry.", | 38 | "ERROR: PLIST:6: \"info/dir\" must not be listed. Use install-info to add/remove an entry.", | |
40 | "WARN: PLIST:7: Library filename \"c.so\" should start with \"lib\".", | 39 | "WARN: PLIST:7: Library filename \"c.so\" should start with \"lib\".", | |
41 | "WARN: PLIST:8: Redundant library found. The libtool library is in line 9.", | 40 | "WARN: PLIST:8: Redundant library found. The libtool library is in line 9.", | |
42 | "WARN: PLIST:9: \"lib/libc.la\" should be sorted before \"lib/libc.so.6\".", | 41 | "WARN: PLIST:9: \"lib/libc.la\" should be sorted before \"lib/libc.so.6\".", | |
43 | "WARN: PLIST:10: Preformatted manual page without unformatted one.", | 42 | "WARN: PLIST:10: Preformatted manual page without unformatted one.", | |
44 | "WARN: PLIST:10: Preformatted manual pages should end in \".0\".", | 43 | "WARN: PLIST:10: Preformatted manual pages should end in \".0\".", | |
45 | "WARN: PLIST:11: IMAKE_MANNEWSUFFIX is not meant to appear in PLISTs.", | 44 | "WARN: PLIST:11: IMAKE_MANNEWSUFFIX is not meant to appear in PLISTs.", | |
46 | "WARN: PLIST:12: Please remove this line. It is no longer necessary.", | 45 | "WARN: PLIST:12: Please remove this line. It is no longer necessary.", | |
47 | "WARN: PLIST:13: Manual page missing for sbin/clockctl.", | |||
48 | "ERROR: PLIST:14: The package Makefile must include \"../../graphics/gnome-icon-theme/buildlink3.mk\".", | 46 | "ERROR: PLIST:14: The package Makefile must include \"../../graphics/gnome-icon-theme/buildlink3.mk\".", | |
49 | "WARN: PLIST:14: Packages that install icon theme files should set ICON_THEMES.", | 47 | "WARN: PLIST:14: Packages that install icon theme files should set ICON_THEMES.", | |
50 | "ERROR: PLIST:15: Packages that install hicolor icons must include \"../../graphics/hicolor-icon-theme/buildlink3.mk\" in the Makefile.", | 48 | "ERROR: PLIST:15: Packages that install hicolor icons must include \"../../graphics/hicolor-icon-theme/buildlink3.mk\" in the Makefile.", | |
51 | "ERROR: PLIST:18: Duplicate filename \"share/tzinfo\", already appeared in line 17.") | 49 | "ERROR: PLIST:18: Duplicate filename \"share/tzinfo\", already appeared in line 17.") | |
52 | } | 50 | } | |
53 | 51 | |||
54 | func (s *Suite) Test_ChecklinesPlist__empty(c *check.C) { | 52 | func (s *Suite) Test_ChecklinesPlist__empty(c *check.C) { | |
55 | s.Init(c) | 53 | s.Init(c) | |
56 | lines := s.NewLines("PLIST", | 54 | lines := s.NewLines("PLIST", | |
57 | "@comment $"+"NetBSD$") | 55 | "@comment $"+"NetBSD$") | |
58 | 56 | |||
59 | ChecklinesPlist(lines) | 57 | ChecklinesPlist(lines) | |
60 | 58 |
@@ -17,62 +17,78 @@ func (s *Suite) Test_ChecklinesPatch__wi | @@ -17,62 +17,78 @@ func (s *Suite) Test_ChecklinesPatch__wi | |||
17 | "--- file.orig", | 17 | "--- file.orig", | |
18 | "+++ file", | 18 | "+++ file", | |
19 | "@@ -5,3 +5,3 @@", | 19 | "@@ -5,3 +5,3 @@", | |
20 | " context before", | 20 | " context before", | |
21 | "-old line", | 21 | "-old line", | |
22 | "+old line", | 22 | "+old line", | |
23 | " context after") | 23 | " context after") | |
24 | 24 | |||
25 | ChecklinesPatch(lines) | 25 | ChecklinesPatch(lines) | |
26 | 26 | |||
27 | s.CheckOutputEmpty() | 27 | s.CheckOutputEmpty() | |
28 | } | 28 | } | |
29 | 29 | |||
30 | func (s *Suite) Test_ChecklinesPatch__without_empty_line(c *check.C) { | 30 | func (s *Suite) Test_ChecklinesPatch__without_empty_line__autofix(c *check.C) { | |
31 | s.Init(c) | 31 | s.Init(c) | |
32 | fname := s.CreateTmpFile("patch-WithoutEmptyLines", "dummy") | 32 | patchFilename := s.CreateTmpFileLines("patch-WithoutEmptyLines", | |
33 | s.UseCommandLine("-Wall", "--autofix") | |||
34 | lines := s.NewLines(fname, | |||
35 | "$"+"NetBSD$", | 33 | "$"+"NetBSD$", | |
36 | "Text", | 34 | "Text", | |
37 | "--- file.orig", | 35 | "--- file.orig", | |
38 | "+++ file", | 36 | "+++ file", | |
39 | "@@ -5,3 +5,3 @@", | 37 | "@@ -5,3 +5,3 @@", | |
40 | " context before", | 38 | " context before", | |
41 | "-old line", | 39 | "-old line", | |
42 | "+old line", | 40 | "+old line", | |
43 | " context after") | 41 | " context after") | |
42 | distinfoFilename := s.CreateTmpFileLines("distinfo", | |||
43 | "$"+"NetBSD$", | |||
44 | "", | |||
45 | "SHA1 (some patch) = 87ffcaaa0b0677ec679fff612b44df1af05f04df") // Taken from breakpoint at AutofixDistinfo | |||
46 | ||||
47 | s.UseCommandLine("-Wall", "--autofix") | |||
48 | lines := LoadExistingLines(patchFilename, false) | |||
49 | G.CurrentDir = s.TmpDir() | |||
50 | G.Pkg = &Package{DistinfoFile: "distinfo"} | |||
44 | 51 | |||
45 | ChecklinesPatch(lines) | 52 | ChecklinesPatch(lines) | |
46 | 53 | |||
47 | s.CheckOutputLines( | 54 | s.CheckOutputLines( | |
48 | "AUTOFIX: ~/patch-WithoutEmptyLines:2: Inserting a line \"\" before this line.", | 55 | "AUTOFIX: ~/patch-WithoutEmptyLines:2: Inserting a line \"\" before this line.", | |
49 | "AUTOFIX: ~/patch-WithoutEmptyLines:3: Inserting a line \"\" before this line.", | 56 | "AUTOFIX: ~/patch-WithoutEmptyLines:3: Inserting a line \"\" before this line.", | |
50 | "AUTOFIX: ~/patch-WithoutEmptyLines: Has been auto-fixed. Please re-run pkglint.") | 57 | "AUTOFIX: ~/patch-WithoutEmptyLines: Has been auto-fixed. Please re-run pkglint.", | |
58 | "AUTOFIX: ~/distinfo:3: Replacing \"87ffcaaa0b0677ec679fff612b44df1af05f04df\" "+ | |||
59 | "with \"a7c35294b3853da0acedf8a972cb266baa9582a3\".", | |||
60 | "AUTOFIX: ~/distinfo: Has been auto-fixed. Please re-run pkglint.") | |||
51 | 61 | |||
52 | fixed, err := ioutil.ReadFile(fname) | 62 | fixed, err := ioutil.ReadFile(patchFilename) | |
53 | c.Assert(err, check.IsNil) | 63 | c.Assert(err, check.IsNil) | |
54 | c.Check(string(fixed), equals, ""+ | 64 | c.Check(string(fixed), equals, ""+ | |
55 | "$"+"NetBSD$\n"+ | 65 | "$"+"NetBSD$\n"+ | |
56 | "\n"+ | 66 | "\n"+ | |
57 | "Text\n"+ | 67 | "Text\n"+ | |
58 | "\n"+ | 68 | "\n"+ | |
59 | "--- file.orig\n"+ | 69 | "--- file.orig\n"+ | |
60 | "+++ file\n"+ | 70 | "+++ file\n"+ | |
61 | "@@ -5,3 +5,3 @@\n"+ | 71 | "@@ -5,3 +5,3 @@\n"+ | |
62 | " context before\n"+ | 72 | " context before\n"+ | |
63 | "-old line\n"+ | 73 | "-old line\n"+ | |
64 | "+old line\n"+ | 74 | "+old line\n"+ | |
65 | " context after\n") | 75 | " context after\n") | |
76 | fixedDistinfo, err := ioutil.ReadFile(distinfoFilename) | |||
77 | c.Assert(err, check.IsNil) | |||
78 | c.Check(string(fixedDistinfo), equals, ""+ | |||
79 | "$"+"NetBSD$\n"+ | |||
80 | "\n"+ | |||
81 | "SHA1 (some patch) = a7c35294b3853da0acedf8a972cb266baa9582a3\n") | |||
66 | } | 82 | } | |
67 | 83 | |||
68 | func (s *Suite) Test_ChecklinesPatch__without_comment(c *check.C) { | 84 | func (s *Suite) Test_ChecklinesPatch__without_comment(c *check.C) { | |
69 | s.Init(c) | 85 | s.Init(c) | |
70 | s.UseCommandLine("-Wall") | 86 | s.UseCommandLine("-Wall") | |
71 | lines := s.NewLines("patch-WithoutComment", | 87 | lines := s.NewLines("patch-WithoutComment", | |
72 | "$"+"NetBSD$", | 88 | "$"+"NetBSD$", | |
73 | "", | 89 | "", | |
74 | "--- file.orig", | 90 | "--- file.orig", | |
75 | "+++ file", | 91 | "+++ file", | |
76 | "@@ -5,3 +5,3 @@", | 92 | "@@ -5,3 +5,3 @@", | |
77 | " context before", | 93 | " context before", | |
78 | "-old line", | 94 | "-old line", |
@@ -165,28 +165,26 @@ func (ck *PlistChecker) checkpath(pline | @@ -165,28 +165,26 @@ func (ck *PlistChecker) checkpath(pline | |||
165 | switch topdir { | 165 | switch topdir { | |
166 | case "bin": | 166 | case "bin": | |
167 | ck.checkpathBin(pline, dirname, basename) | 167 | ck.checkpathBin(pline, dirname, basename) | |
168 | case "doc": | 168 | case "doc": | |
169 | line.Errorf("Documentation must be installed under share/doc, not doc.") | 169 | line.Errorf("Documentation must be installed under share/doc, not doc.") | |
170 | case "etc": | 170 | case "etc": | |
171 | ck.checkpathEtc(pline, dirname, basename) | 171 | ck.checkpathEtc(pline, dirname, basename) | |
172 | case "info": | 172 | case "info": | |
173 | ck.checkpathInfo(pline, dirname, basename) | 173 | ck.checkpathInfo(pline, dirname, basename) | |
174 | case "lib": | 174 | case "lib": | |
175 | ck.checkpathLib(pline, dirname, basename) | 175 | ck.checkpathLib(pline, dirname, basename) | |
176 | case "man": | 176 | case "man": | |
177 | ck.checkpathMan(pline) | 177 | ck.checkpathMan(pline) | |
178 | case "sbin": | |||
179 | ck.checkpathSbin(pline) | |||
180 | case "share": | 178 | case "share": | |
181 | ck.checkpathShare(pline) | 179 | ck.checkpathShare(pline) | |
182 | } | 180 | } | |
183 | 181 | |||
184 | if contains(text, "${PKGLOCALEDIR}") && G.Pkg != nil && G.Pkg.vardef["USE_PKGLOCALEDIR"] == nil { | 182 | if contains(text, "${PKGLOCALEDIR}") && G.Pkg != nil && G.Pkg.vardef["USE_PKGLOCALEDIR"] == nil { | |
185 | line.Warnf("PLIST contains ${PKGLOCALEDIR}, but USE_PKGLOCALEDIR was not found.") | 183 | line.Warnf("PLIST contains ${PKGLOCALEDIR}, but USE_PKGLOCALEDIR was not found.") | |
186 | } | 184 | } | |
187 | 185 | |||
188 | if contains(text, "/CVS/") { | 186 | if contains(text, "/CVS/") { | |
189 | line.Warnf("CVS files should not be in the PLIST.") | 187 | line.Warnf("CVS files should not be in the PLIST.") | |
190 | } | 188 | } | |
191 | if hasSuffix(text, ".orig") { | 189 | if hasSuffix(text, ".orig") { | |
192 | line.Warnf(".orig files should not be in the PLIST.") | 190 | line.Warnf(".orig files should not be in the PLIST.") | |
@@ -216,39 +214,26 @@ func (ck *PlistChecker) checkSorted(plin | @@ -216,39 +214,26 @@ func (ck *PlistChecker) checkSorted(plin | |||
216 | pline.line.Errorf("Duplicate filename %q, already appeared in %s.", text, prev.line.ReferenceFrom(pline.line)) | 214 | pline.line.Errorf("Duplicate filename %q, already appeared in %s.", text, prev.line.ReferenceFrom(pline.line)) | |
217 | } | 215 | } | |
218 | } | 216 | } | |
219 | } | 217 | } | |
220 | ck.lastFname = text | 218 | ck.lastFname = text | |
221 | } | 219 | } | |
222 | } | 220 | } | |
223 | 221 | |||
224 | func (ck *PlistChecker) checkpathBin(pline *PlistLine, dirname, basename string) { | 222 | func (ck *PlistChecker) checkpathBin(pline *PlistLine, dirname, basename string) { | |
225 | if contains(dirname, "/") { | 223 | if contains(dirname, "/") { | |
226 | pline.line.Warnf("The bin/ directory should not have subdirectories.") | 224 | pline.line.Warnf("The bin/ directory should not have subdirectories.") | |
227 | return | 225 | return | |
228 | } | 226 | } | |
229 | ||||
230 | if G.opts.WarnExtra && | |||
231 | ck.allFiles["man/man1/"+basename+".1"] == nil && | |||
232 | ck.allFiles["man/man6/"+basename+".6"] == nil && | |||
233 | ck.allFiles["${IMAKE_MAN_DIR}/"+basename+".${IMAKE_MANNEWSUFFIX}"] == nil { | |||
234 | pline.line.Warnf("Manual page missing for bin/%s.", basename) | |||
235 | Explain( | |||
236 | "All programs that can be run directly by the user should have a", | |||
237 | "manual page for quick reference. The programs in the bin/ directory", | |||
238 | "should have corresponding manual pages in section 1 (filename", | |||
239 | "program.1), while the programs in the sbin/ directory have their", | |||
240 | "manual pages in section 8.") | |||
241 | } | |||
242 | } | 227 | } | |
243 | 228 | |||
244 | func (ck *PlistChecker) checkpathEtc(pline *PlistLine, dirname, basename string) { | 229 | func (ck *PlistChecker) checkpathEtc(pline *PlistLine, dirname, basename string) { | |
245 | if hasPrefix(pline.text, "etc/rc.d/") { | 230 | if hasPrefix(pline.text, "etc/rc.d/") { | |
246 | pline.line.Errorf("RCD_SCRIPTS must not be registered in the PLIST. Please use the RCD_SCRIPTS framework.") | 231 | pline.line.Errorf("RCD_SCRIPTS must not be registered in the PLIST. Please use the RCD_SCRIPTS framework.") | |
247 | return | 232 | return | |
248 | } | 233 | } | |
249 | 234 | |||
250 | pline.line.Errorf("Configuration files must not be registered in the PLIST. " + | 235 | pline.line.Errorf("Configuration files must not be registered in the PLIST. " + | |
251 | "Please use the CONF_FILES framework, which is described in mk/pkginstall/bsd.pkginstall.mk.") | 236 | "Please use the CONF_FILES framework, which is described in mk/pkginstall/bsd.pkginstall.mk.") | |
252 | } | 237 | } | |
253 | 238 | |||
254 | func (ck *PlistChecker) checkpathInfo(pline *PlistLine, dirname, basename string) { | 239 | func (ck *PlistChecker) checkpathInfo(pline *PlistLine, dirname, basename string) { | |
@@ -314,50 +299,36 @@ func (ck *PlistChecker) checkpathMan(pli | @@ -314,50 +299,36 @@ func (ck *PlistChecker) checkpathMan(pli | |||
314 | line.Warnf("Preformatted manual page without unformatted one.") | 299 | line.Warnf("Preformatted manual page without unformatted one.") | |
315 | } | 300 | } | |
316 | 301 | |||
317 | if catOrMan == "cat" { | 302 | if catOrMan == "cat" { | |
318 | if ext != "0" { | 303 | if ext != "0" { | |
319 | line.Warnf("Preformatted manual pages should end in \".0\".") | 304 | line.Warnf("Preformatted manual pages should end in \".0\".") | |
320 | } | 305 | } | |
321 | } else { | 306 | } else { | |
322 | if !hasPrefix(ext, section) { | 307 | if !hasPrefix(ext, section) { | |
323 | line.Warnf("Mismatch between the section (%s) and extension (%s) of the manual page.", section, ext) | 308 | line.Warnf("Mismatch between the section (%s) and extension (%s) of the manual page.", section, ext) | |
324 | } | 309 | } | |
325 | } | 310 | } | |
326 | 311 | |||
327 | if gz != "" { | 312 | if gz != "" && !line.AutofixReplaceRegexp(`\.gz$`, "") { | |
328 | line.Notef("The .gz extension is unnecessary for manual pages.") | 313 | line.Notef("The .gz extension is unnecessary for manual pages.") | |
329 | Explain( | 314 | Explain( | |
330 | "Whether the manual pages are installed in compressed form or not is", | 315 | "Whether the manual pages are installed in compressed form or not is", | |
331 | "configured by the pkgsrc user. Compression and decompression takes", | 316 | "configured by the pkgsrc user. Compression and decompression takes", | |
332 | "place automatically, no matter if the .gz extension is mentioned in", | 317 | "place automatically, no matter if the .gz extension is mentioned in", | |
333 | "the PLIST or not.") | 318 | "the PLIST or not.") | |
334 | } | 319 | } | |
335 | } | 320 | } | |
336 | 321 | |||
337 | func (ck *PlistChecker) checkpathSbin(pline *PlistLine) { | |||
338 | binname := pline.text[5:] | |||
339 | ||||
340 | if ck.allFiles["man/man8/"+binname+".8"] == nil && G.opts.WarnExtra { | |||
341 | pline.line.Warnf("Manual page missing for sbin/%s.", binname) | |||
342 | Explain( | |||
343 | "All programs that can be run directly by the user should have a", | |||
344 | "manual page for quick reference. The programs in the sbin/", | |||
345 | "directory should have corresponding manual pages in section 8", | |||
346 | "(filename program.8), while the programs in the bin/ directory", | |||
347 | "have their manual pages in section 1.") | |||
348 | } | |||
349 | } | |||
350 | ||||
351 | func (ck *PlistChecker) checkpathShare(pline *PlistLine) { | 322 | func (ck *PlistChecker) checkpathShare(pline *PlistLine) { | |
352 | line, text := pline.line, pline.text | 323 | line, text := pline.line, pline.text | |
353 | switch { | 324 | switch { | |
354 | // Disabled due to PR 46570, item "10. It should stop". | 325 | // Disabled due to PR 46570, item "10. It should stop". | |
355 | case false && hasPrefix(text, "share/applications/") && hasSuffix(text, ".desktop"): | 326 | case false && hasPrefix(text, "share/applications/") && hasSuffix(text, ".desktop"): | |
356 | f := "../../sysutils/desktop-file-utils/desktopdb.mk" | 327 | f := "../../sysutils/desktop-file-utils/desktopdb.mk" | |
357 | if G.opts.WarnExtra && G.Pkg != nil && G.Pkg.included[f] == nil { | 328 | if G.opts.WarnExtra && G.Pkg != nil && G.Pkg.included[f] == nil { | |
358 | line.Warnf("Packages that install a .desktop entry should .include %q.", f) | 329 | line.Warnf("Packages that install a .desktop entry should .include %q.", f) | |
359 | Explain( | 330 | Explain( | |
360 | "If *.desktop files contain MimeType keys, the global MIME type", | 331 | "If *.desktop files contain MimeType keys, the global MIME type", | |
361 | "registry must be updated by desktop-file-utils. Otherwise, this", | 332 | "registry must be updated by desktop-file-utils. Otherwise, this", | |
362 | "warning is harmless.") | 333 | "warning is harmless.") | |
363 | } | 334 | } |
@@ -797,36 +797,36 @@ func (gd *GlobalData) InitVartypes() { | @@ -797,36 +797,36 @@ func (gd *GlobalData) InitVartypes() { | |||
797 | acl("PKG_GECOS.*", lkNone, BtMessage, "Makefile: set") | 797 | acl("PKG_GECOS.*", lkNone, BtMessage, "Makefile: set") | |
798 | acl("PKG_GID.*", lkNone, BtInteger, "Makefile: set") | 798 | acl("PKG_GID.*", lkNone, BtInteger, "Makefile: set") | |
799 | acl("PKG_GROUPS", lkShell, BtShellWord, "Makefile: set, append") | 799 | acl("PKG_GROUPS", lkShell, BtShellWord, "Makefile: set, append") | |
800 | pkglist("PKG_GROUPS_VARS", lkShell, BtVariableName) | 800 | pkglist("PKG_GROUPS_VARS", lkShell, BtVariableName) | |
801 | acl("PKG_HOME.*", lkNone, BtPathname, "Makefile: set") | 801 | acl("PKG_HOME.*", lkNone, BtPathname, "Makefile: set") | |
802 | acl("PKG_HACKS", lkShell, BtIdentifier, "hacks.mk: append") | 802 | acl("PKG_HACKS", lkShell, BtIdentifier, "hacks.mk: append") | |
803 | sys("PKG_INFO", lkNone, BtShellCommand) | 803 | sys("PKG_INFO", lkNone, BtShellCommand) | |
804 | sys("PKG_JAVA_HOME", lkNone, BtPathname) | 804 | sys("PKG_JAVA_HOME", lkNone, BtPathname) | |
805 | sys("PKG_JVM", lkNone, jvms) | 805 | sys("PKG_JVM", lkNone, jvms) | |
806 | acl("PKG_JVMS_ACCEPTED", lkShell, jvms, "Makefile: set; Makefile.common: default, set") | 806 | acl("PKG_JVMS_ACCEPTED", lkShell, jvms, "Makefile: set; Makefile.common: default, set") | |
807 | usr("PKG_JVM_DEFAULT", lkNone, jvms) | 807 | usr("PKG_JVM_DEFAULT", lkNone, jvms) | |
808 | acl("PKG_LEGACY_OPTIONS", lkShell, BtOption, "") | 808 | acl("PKG_LEGACY_OPTIONS", lkShell, BtOption, "") | |
809 | acl("PKG_LIBTOOL", lkNone, BtPathname, "Makefile: set") | 809 | acl("PKG_LIBTOOL", lkNone, BtPathname, "Makefile: set") | |
810 | acl("PKG_OPTIONS", lkSpace, BtOption, "bsd.options.mk: set; *: use-loadtime, use") | 810 | acl("PKG_OPTIONS", lkShell, BtOption, "bsd.options.mk: set; *: use-loadtime, use") | |
811 | usr("PKG_OPTIONS.*", lkSpace, BtOption) | 811 | usr("PKG_OPTIONS.*", lkShell, BtOption) | |
812 | acl("PKG_OPTIONS_DEPRECATED_WARNINGS", lkShell, BtShellWord, "") | 812 | acl("PKG_OPTIONS_DEPRECATED_WARNINGS", lkShell, BtShellWord, "") | |
813 | acl("PKG_OPTIONS_GROUP.*", lkSpace, BtOption, "Makefile, options.mk: set, append") | 813 | acl("PKG_OPTIONS_GROUP.*", lkShell, BtOption, "Makefile, options.mk: set, append") | |
814 | acl("PKG_OPTIONS_LEGACY_OPTS", lkSpace, BtUnknown, "Makefile, Makefile.common, options.mk: append") | 814 | acl("PKG_OPTIONS_LEGACY_OPTS", lkShell, BtUnknown, "Makefile, Makefile.common, options.mk: append") | |
815 | acl("PKG_OPTIONS_LEGACY_VARS", lkSpace, BtUnknown, "Makefile, Makefile.common, options.mk: append") | 815 | acl("PKG_OPTIONS_LEGACY_VARS", lkShell, BtUnknown, "Makefile, Makefile.common, options.mk: append") | |
816 | acl("PKG_OPTIONS_NONEMPTY_SETS", lkSpace, BtIdentifier, "") | 816 | acl("PKG_OPTIONS_NONEMPTY_SETS", lkShell, BtIdentifier, "") | |
817 | acl("PKG_OPTIONS_OPTIONAL_GROUPS", lkSpace, BtIdentifier, "options.mk: set, append") | 817 | acl("PKG_OPTIONS_OPTIONAL_GROUPS", lkShell, BtIdentifier, "options.mk: set, append") | |
818 | acl("PKG_OPTIONS_REQUIRED_GROUPS", lkSpace, BtIdentifier, "Makefile, options.mk: set") | 818 | acl("PKG_OPTIONS_REQUIRED_GROUPS", lkShell, BtIdentifier, "Makefile, options.mk: set") | |
819 | acl("PKG_OPTIONS_SET.*", lkSpace, BtOption, "") | 819 | acl("PKG_OPTIONS_SET.*", lkShell, BtOption, "") | |
820 | acl("PKG_OPTIONS_VAR", lkNone, BtPkgOptionsVar, "Makefile, Makefile.common, options.mk: set; bsd.options.mk: use-loadtime") | 820 | acl("PKG_OPTIONS_VAR", lkNone, BtPkgOptionsVar, "Makefile, Makefile.common, options.mk: set; bsd.options.mk: use-loadtime") | |
821 | acl("PKG_PRESERVE", lkNone, BtYes, "Makefile: set") | 821 | acl("PKG_PRESERVE", lkNone, BtYes, "Makefile: set") | |
822 | acl("PKG_SHELL", lkNone, BtPathname, "Makefile, Makefile.common: set") | 822 | acl("PKG_SHELL", lkNone, BtPathname, "Makefile, Makefile.common: set") | |
823 | acl("PKG_SHELL.*", lkNone, BtPathname, "Makefile, Makefile.common: set") | 823 | acl("PKG_SHELL.*", lkNone, BtPathname, "Makefile, Makefile.common: set") | |
824 | acl("PKG_SHLIBTOOL", lkNone, BtPathname, "") | 824 | acl("PKG_SHLIBTOOL", lkNone, BtPathname, "") | |
825 | pkglist("PKG_SKIP_REASON", lkShell, BtShellWord) | 825 | pkglist("PKG_SKIP_REASON", lkShell, BtShellWord) | |
826 | acl("PKG_SUGGESTED_OPTIONS", lkShell, BtOption, "Makefile, Makefile.common, options.mk: set, append") | 826 | acl("PKG_SUGGESTED_OPTIONS", lkShell, BtOption, "Makefile, Makefile.common, options.mk: set, append") | |
827 | acl("PKG_SUGGESTED_OPTIONS.*", lkShell, BtOption, "Makefile, Makefile.common, options.mk: set, append") | 827 | acl("PKG_SUGGESTED_OPTIONS.*", lkShell, BtOption, "Makefile, Makefile.common, options.mk: set, append") | |
828 | acl("PKG_SUPPORTED_OPTIONS", lkShell, BtOption, "Makefile: set, append; Makefile.common: set; options.mk: set, append, use") | 828 | acl("PKG_SUPPORTED_OPTIONS", lkShell, BtOption, "Makefile: set, append; Makefile.common: set; options.mk: set, append, use") | |
829 | pkg("PKG_SYSCONFDIR*", lkNone, BtPathname) | 829 | pkg("PKG_SYSCONFDIR*", lkNone, BtPathname) | |
830 | pkglist("PKG_SYSCONFDIR_PERMS", lkShell, BtPerms) | 830 | pkglist("PKG_SYSCONFDIR_PERMS", lkShell, BtPerms) | |
831 | sys("PKG_SYSCONFBASEDIR", lkNone, BtPathname) | 831 | sys("PKG_SYSCONFBASEDIR", lkNone, BtPathname) | |
832 | pkg("PKG_SYSCONFSUBDIR", lkNone, BtPathname) | 832 | pkg("PKG_SYSCONFSUBDIR", lkNone, BtPathname) |