version 1.53, 2019/03/10 19:01:50 |
version 1.54, 2019/03/24 13:58:38 |
Line 374 func (s *Suite) Test_MkLine_VariableNeed |
|
Line 374 func (s *Suite) Test_MkLine_VariableNeed |
|
t.SetUpMasterSite("MASTER_SITE_SOURCEFORGE", "http://downloads.sourceforge.net/sourceforge/") |
t.SetUpMasterSite("MASTER_SITE_SOURCEFORGE", "http://downloads.sourceforge.net/sourceforge/") |
mkline := t.NewMkLine("Makefile", 95, "MASTER_SITES=\t${HOMEPAGE}") |
mkline := t.NewMkLine("Makefile", 95, "MASTER_SITES=\t${HOMEPAGE}") |
|
|
vuc := VarUseContext{G.Pkgsrc.vartypes["MASTER_SITES"], vucTimeRun, VucQuotPlain, false} |
vuc := VarUseContext{G.Pkgsrc.vartypes.Canon("MASTER_SITES"), vucTimeRun, VucQuotPlain, false} |
nq := mkline.VariableNeedsQuoting("HOMEPAGE", G.Pkgsrc.vartypes["HOMEPAGE"], &vuc) |
nq := mkline.VariableNeedsQuoting("HOMEPAGE", G.Pkgsrc.vartypes.Canon("HOMEPAGE"), &vuc) |
|
|
c.Check(nq, equals, no) |
c.Check(nq, equals, no) |
|
|
Line 407 func (s *Suite) Test_MkLine_VariableNeed |
|
Line 407 func (s *Suite) Test_MkLine_VariableNeed |
|
MkLineChecker{mkline}.checkVarassign() |
MkLineChecker{mkline}.checkVarassign() |
|
|
t.CheckOutputLines( |
t.CheckOutputLines( |
"WARN: builtin.mk:3: PKG_ADMIN should not be evaluated at load time.", |
"WARN: builtin.mk:3: PKG_ADMIN should not be used at load time in any file.", |
"NOTE: builtin.mk:3: The :Q operator isn't necessary for ${BUILTIN_PKG.Xfixes} here.") |
"NOTE: builtin.mk:3: The :Q operator isn't necessary for ${BUILTIN_PKG.Xfixes} here.") |
} |
} |
|
|
Line 701 func (s *Suite) Test_MkLine_VariableNeed |
|
Line 701 func (s *Suite) Test_MkLine_VariableNeed |
|
// only appear completely unquoted. There is no practical way of |
// only appear completely unquoted. There is no practical way of |
// using it inside backticks, and luckily there is no need for it. |
// using it inside backticks, and luckily there is no need for it. |
t.CheckOutputLines( |
t.CheckOutputLines( |
"WARN: Makefile:4: COMMENT may not be used in any file; it is a write-only variable.", |
|
// TODO: Better suggest that COMMENT should not be used inside backticks or other quotes. |
// TODO: Better suggest that COMMENT should not be used inside backticks or other quotes. |
"WARN: Makefile:4: The variable COMMENT should be quoted as part of a shell word.") |
"WARN: Makefile:4: The variable COMMENT should be quoted as part of a shell word.") |
} |
} |
Line 781 func (s *Suite) Test_MkLine_VariableNeed |
|
Line 780 func (s *Suite) Test_MkLine_VariableNeed |
|
func (s *Suite) Test_MkLine_VariableNeedsQuoting__uncovered_cases(c *check.C) { |
func (s *Suite) Test_MkLine_VariableNeedsQuoting__uncovered_cases(c *check.C) { |
t := s.Init(c) |
t := s.Init(c) |
|
|
t.SetUpCommandLine("-Wall,no-space") |
t.SetUpCommandLine("-Wall,no-space", "--explain") |
t.SetUpVartypes() |
t.SetUpVartypes() |
|
|
mklines := t.SetUpFileMkLines("Makefile", |
mklines := t.SetUpFileMkLines("Makefile", |
Line 796 func (s *Suite) Test_MkLine_VariableNeed |
|
Line 795 func (s *Suite) Test_MkLine_VariableNeed |
|
mklines.Check() |
mklines.Check() |
|
|
t.CheckOutputLines( |
t.CheckOutputLines( |
// TODO: Explain why the variable may not be set, by listing the current rules. |
"WARN: ~/Makefile:4: The variable LINKER_RPATH_FLAG should not be set by any package.", |
"WARN: ~/Makefile:4: The variable LINKER_RPATH_FLAG may not be set by any package.", |
"", |
"WARN: ~/Makefile:4: Please use ${LINKER_RPATH_FLAG:S/-rpath/& /:Q} instead of ${LINKER_RPATH_FLAG:S/-rpath/& /}.", |
"\tThe allowed actions for a variable are determined based on the file", |
"WARN: ~/Makefile:4: LINKER_RPATH_FLAG should not be evaluated at load time.", |
"\tname in which the variable is used or defined. The rules for", |
"WARN: ~/Makefile:6: The variable PATH may not be set by any package.", |
"\tLINKER_RPATH_FLAG are:", |
"WARN: ~/Makefile:6: PREFIX should not be evaluated at load time.", |
"", |
"WARN: ~/Makefile:6: PATH should not be evaluated at load time.") |
"\t* in buildlink3.mk, it should not be accessed at all", |
|
"\t* in any file, it may be used", |
|
"", |
|
"\tIf these rules seem to be incorrect, please ask on the", |
|
"\ttech-pkg@NetBSD.org mailing list.", |
|
"", |
|
"WARN: ~/Makefile:4: Please use ${LINKER_RPATH_FLAG:S/-rpath/& /:Q} "+ |
|
"instead of ${LINKER_RPATH_FLAG:S/-rpath/& /}.", |
|
"", |
|
"\tSee the pkgsrc guide, section \"Echoing a string exactly as-is\":", |
|
"\thttps://www.NetBSD.org/docs/pkgsrc/pkgsrc.html#echo-literal", |
|
"", |
|
"WARN: ~/Makefile:4: LINKER_RPATH_FLAG should not be used at load time in any file.", |
|
"", |
|
"\tMany variables, especially lists of something, get their values", |
|
"\tincrementally. Therefore it is generally unsafe to rely on their", |
|
"\tvalue until it is clear that it will never change again. This point", |
|
"\tis reached when the whole package Makefile is loaded and execution", |
|
"\tof the shell commands starts; in some cases earlier.", |
|
"", |
|
"\tAdditionally, when using the \":=\" operator, each $$ is replaced with", |
|
"\ta single $, so variables that have references to shell variables or", |
|
"\tregular expressions are modified in a subtle way.", |
|
"", |
|
"\tThe allowed actions for a variable are determined based on the file", |
|
"\tname in which the variable is used or defined. The rules for", |
|
"\tLINKER_RPATH_FLAG are:", |
|
"", |
|
"\t* in buildlink3.mk, it should not be accessed at all", |
|
"\t* in any file, it may be used", |
|
"", |
|
"\tIf these rules seem to be incorrect, please ask on the", |
|
"\ttech-pkg@NetBSD.org mailing list.", |
|
"", |
|
"WARN: ~/Makefile:6: The variable PATH should not be set by any package.", |
|
"", |
|
"\tThe allowed actions for a variable are determined based on the file", |
|
"\tname in which the variable is used or defined. The rules for PATH", |
|
"\tare:", |
|
"", |
|
"\t* in buildlink3.mk, it should not be accessed at all", |
|
"\t* in any file, it may be used", |
|
"", |
|
"\tIf these rules seem to be incorrect, please ask on the", |
|
"\ttech-pkg@NetBSD.org mailing list.", |
|
"", |
|
"WARN: ~/Makefile:6: PREFIX should not be used at load time in any file.", |
|
"", |
|
"\tMany variables, especially lists of something, get their values", |
|
"\tincrementally. Therefore it is generally unsafe to rely on their", |
|
"\tvalue until it is clear that it will never change again. This point", |
|
"\tis reached when the whole package Makefile is loaded and execution", |
|
"\tof the shell commands starts; in some cases earlier.", |
|
"", |
|
"\tAdditionally, when using the \":=\" operator, each $$ is replaced with", |
|
"\ta single $, so variables that have references to shell variables or", |
|
"\tregular expressions are modified in a subtle way.", |
|
"", |
|
"\tThe allowed actions for a variable are determined based on the file", |
|
"\tname in which the variable is used or defined. The rules for PREFIX", |
|
"\tare:", |
|
"", |
|
"\t* in any file, it may be used", |
|
"", |
|
"\tIf these rules seem to be incorrect, please ask on the", |
|
"\ttech-pkg@NetBSD.org mailing list.", |
|
"", |
|
"WARN: ~/Makefile:6: PATH should not be used at load time in any file.", |
|
"", |
|
"\tMany variables, especially lists of something, get their values", |
|
"\tincrementally. Therefore it is generally unsafe to rely on their", |
|
"\tvalue until it is clear that it will never change again. This point", |
|
"\tis reached when the whole package Makefile is loaded and execution", |
|
"\tof the shell commands starts; in some cases earlier.", |
|
"", |
|
"\tAdditionally, when using the \":=\" operator, each $$ is replaced with", |
|
"\ta single $, so variables that have references to shell variables or", |
|
"\tregular expressions are modified in a subtle way.", |
|
"", |
|
"\tThe allowed actions for a variable are determined based on the file", |
|
"\tname in which the variable is used or defined. The rules for PATH", |
|
"\tare:", |
|
"", |
|
"\t* in buildlink3.mk, it should not be accessed at all", |
|
"\t* in any file, it may be used", |
|
"", |
|
"\tIf these rules seem to be incorrect, please ask on the", |
|
"\ttech-pkg@NetBSD.org mailing list.", |
|
"") |
|
|
// Just for branch coverage. |
// Just for branch coverage. |
trace.Tracing = false |
trace.Tracing = false |
MkLineChecker{mklines.mklines[2]}.Check() |
MkLineChecker{mklines.mklines[2]}.Check() |
|
|
t.CheckOutputLines( |
t.CheckOutputEmpty() |
"WARN: ~/Makefile:3: GO_SRCPATH is defined but not used.") |
|
} |
} |
|
|
func (s *Suite) Test_MkLine__shell_varuse_in_backt_dquot(c *check.C) { |
func (s *Suite) Test_MkLine__shell_varuse_in_backt_dquot(c *check.C) { |
Line 1131 func (s *Suite) Test_MkLine_ResolveVarsI |
|
Line 1217 func (s *Suite) Test_MkLine_ResolveVarsI |
|
mklines.Check() |
mklines.Check() |
|
|
t.CheckOutputLines( |
t.CheckOutputLines( |
|
"WARN: ~/multimedia/totem/bla.mk:2: "+ |
|
"The variable BUILDLINK_PKGSRCDIR.totem should not be given a default value in this file; "+ |
|
"it would be ok in buildlink3.mk.", |
"ERROR: ~/multimedia/totem/bla.mk:2: There is no package in \"multimedia/totem\".") |
"ERROR: ~/multimedia/totem/bla.mk:2: There is no package in \"multimedia/totem\".") |
} |
} |
|
|