diff options
Diffstat (limited to 'pkgtools/pkglint/files/shell.go')
-rw-r--r-- | pkgtools/pkglint/files/shell.go | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/pkgtools/pkglint/files/shell.go b/pkgtools/pkglint/files/shell.go index 61f6aa534ee..e45be3c6d1a 100644 --- a/pkgtools/pkglint/files/shell.go +++ b/pkgtools/pkglint/files/shell.go @@ -3,8 +3,6 @@ package main // Parsing and checking shell commands embedded in Makefiles import ( - "netbsd.org/pkglint/line" - "netbsd.org/pkglint/linechecks" "netbsd.org/pkglint/textproc" "netbsd.org/pkglint/trace" "path" @@ -38,7 +36,7 @@ func (shline *ShellLine) CheckWord(token string, checkQuoting bool) { return } - var line line.Line = shline.mkline + var line = shline.mkline.Line p := NewMkParser(line, token, false) if varuse := p.VarUse(); varuse != nil && p.EOF() { @@ -225,7 +223,7 @@ func (shline *ShellLine) unescapeBackticks(shellword string, repl *textproc.Pref defer trace.Call(shellword, quoting, "=>", trace.Ref(&unescaped))() } - var line line.Line = shline.mkline + line := shline.mkline.Line for !repl.EOF() { switch { case repl.AdvanceStr("`"): @@ -277,7 +275,7 @@ func (shline *ShellLine) CheckShellCommandLine(shelltext string) { defer trace.Call1(shelltext)() } - var line line.Line = shline.mkline + line := shline.mkline.Line if contains(shelltext, "${SED}") && contains(shelltext, "${MV}") { line.Notef("Please use the SUBST framework instead of ${SED} and ${MV}.") @@ -326,7 +324,7 @@ func (shline *ShellLine) CheckShellCommand(shellcmd string, pSetE *bool) { defer trace.Call()() } - var line line.Line = shline.mkline + line := shline.mkline.Line program, err := parseShellProgram(line, shellcmd) if err != nil && contains(shellcmd, "$$(") { // Hack until the shell parser can handle subshells. line.Warnf("Invoking subshells via $(...) is not portable enough.") @@ -387,7 +385,7 @@ func (shline *ShellLine) checkHiddenAndSuppress(hiddenAndSuppress, rest string) // Shell comments may be hidden, since they cannot have side effects. default: - tokens, _ := splitIntoShellTokens(shline.mkline, rest) + tokens, _ := splitIntoShellTokens(shline.mkline.Line, rest) if len(tokens) > 0 { cmd := tokens[0] switch cmd { @@ -597,7 +595,7 @@ func (scc *SimpleCommandChecker) checkAbsolutePathnames() { isSubst := false for _, arg := range scc.strcmd.Args { if !isSubst { - linechecks.CheckAbsolutePathname(scc.shline.mkline, arg) + CheckLineAbsolutePathname(scc.shline.mkline.Line, arg) } if false && isSubst && !matches(arg, `"^[\"\'].*[\"\']$`) { scc.shline.mkline.Warnf("Substitution commands like %q should always be quoted.", arg) @@ -764,7 +762,7 @@ func (spc *ShellProgramChecker) checkWord(word *ShToken, checkQuoting bool) { spc.shline.CheckWord(word.MkText, checkQuoting) } -func (scc *ShellProgramChecker) checkPipeExitcode(line line.Line, pipeline *MkShPipeline) { +func (scc *ShellProgramChecker) checkPipeExitcode(line Line, pipeline *MkShPipeline) { if trace.Tracing { defer trace.Call()() } @@ -815,7 +813,7 @@ func (shline *ShellLine) checkCommandUse(shellcmd string) { return } - var line line.Line = shline.mkline + line := shline.mkline.Line switch shellcmd { case "${INSTALL}", "${INSTALL_DATA}", "${INSTALL_DATA_DIR}", @@ -850,7 +848,7 @@ func (shline *ShellLine) checkCommandUse(shellcmd string) { } // Example: "word1 word2;;;" => "word1", "word2", ";;", ";" -func splitIntoShellTokens(line line.Line, text string) (tokens []string, rest string) { +func splitIntoShellTokens(line Line, text string) (tokens []string, rest string) { if trace.Tracing { defer trace.Call(line, text)() } @@ -882,7 +880,7 @@ func splitIntoShellTokens(line line.Line, text string) (tokens []string, rest st // Example: "word1 word2;;;" => "word1", "word2;;;" // Compare devel/bmake/files/str.c, function brk_string. -func splitIntoMkWords(line line.Line, text string) (words []string, rest string) { +func splitIntoMkWords(line Line, text string) (words []string, rest string) { if trace.Tracing { defer trace.Call(line, text)() } |