diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-03 10:59:25 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-05 10:22:56 -0800 |
commit | 06f2f8ce0a3093973ca54b48f542f8485b666079 (patch) | |
tree | dbcfa5c491eb2e5d237aa539cb7c6e77dc07dd6f /meta/classes/recipe_sanity.bbclass | |
parent | d01dadfb87cfd2284b3e849d35a35fe5df0239c4 (diff) | |
download | poky-06f2f8ce0a3093973ca54b48f542f8485b666079.tar.gz |
meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)
Using "1" with getVar is bad coding style and "True" is preferred.
This patch is a sed over the meta directory of the form:
sed \
-e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \
-e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \
-i `grep -ril getVar *`
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/recipe_sanity.bbclass')
-rw-r--r-- | meta/classes/recipe_sanity.bbclass | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/meta/classes/recipe_sanity.bbclass b/meta/classes/recipe_sanity.bbclass index bb60ffa00e..b3246599b9 100644 --- a/meta/classes/recipe_sanity.bbclass +++ b/meta/classes/recipe_sanity.bbclass | |||
@@ -1,5 +1,5 @@ | |||
1 | def __note(msg, d): | 1 | def __note(msg, d): |
2 | bb.note("%s: recipe_sanity: %s" % (d.getVar("P", 1), msg)) | 2 | bb.note("%s: recipe_sanity: %s" % (d.getVar("P", True), msg)) |
3 | 3 | ||
4 | __recipe_sanity_badruntimevars = "RDEPENDS RPROVIDES RRECOMMENDS RCONFLICTS" | 4 | __recipe_sanity_badruntimevars = "RDEPENDS RPROVIDES RRECOMMENDS RCONFLICTS" |
5 | def bad_runtime_vars(cfgdata, d): | 5 | def bad_runtime_vars(cfgdata, d): |
@@ -7,7 +7,7 @@ def bad_runtime_vars(cfgdata, d): | |||
7 | bb.data.inherits_class("cross", d): | 7 | bb.data.inherits_class("cross", d): |
8 | return | 8 | return |
9 | 9 | ||
10 | for var in d.getVar("__recipe_sanity_badruntimevars", 1).split(): | 10 | for var in d.getVar("__recipe_sanity_badruntimevars", True).split(): |
11 | val = d.getVar(var, 0) | 11 | val = d.getVar(var, 0) |
12 | if val and val != cfgdata.get(var): | 12 | if val and val != cfgdata.get(var): |
13 | __note("%s should be %s_${PN}" % (var, var), d) | 13 | __note("%s should be %s_${PN}" % (var, var), d) |
@@ -15,17 +15,17 @@ def bad_runtime_vars(cfgdata, d): | |||
15 | __recipe_sanity_reqvars = "DESCRIPTION" | 15 | __recipe_sanity_reqvars = "DESCRIPTION" |
16 | __recipe_sanity_reqdiffvars = "LICENSE" | 16 | __recipe_sanity_reqdiffvars = "LICENSE" |
17 | def req_vars(cfgdata, d): | 17 | def req_vars(cfgdata, d): |
18 | for var in d.getVar("__recipe_sanity_reqvars", 1).split(): | 18 | for var in d.getVar("__recipe_sanity_reqvars", True).split(): |
19 | if not d.getVar(var, 0): | 19 | if not d.getVar(var, 0): |
20 | __note("%s should be set" % var, d) | 20 | __note("%s should be set" % var, d) |
21 | 21 | ||
22 | for var in d.getVar("__recipe_sanity_reqdiffvars", 1).split(): | 22 | for var in d.getVar("__recipe_sanity_reqdiffvars", True).split(): |
23 | val = d.getVar(var, 0) | 23 | val = d.getVar(var, 0) |
24 | cfgval = cfgdata.get(var) | 24 | cfgval = cfgdata.get(var) |
25 | 25 | ||
26 | # Hardcoding is bad, but I'm lazy. We don't care about license being | 26 | # Hardcoding is bad, but I'm lazy. We don't care about license being |
27 | # unset if the recipe has no sources! | 27 | # unset if the recipe has no sources! |
28 | if var == "LICENSE" and d.getVar("SRC_URI", 1) == cfgdata.get("SRC_URI"): | 28 | if var == "LICENSE" and d.getVar("SRC_URI", True) == cfgdata.get("SRC_URI"): |
29 | continue | 29 | continue |
30 | 30 | ||
31 | if not val: | 31 | if not val: |
@@ -43,11 +43,11 @@ def var_renames_overwrite(cfgdata, d): | |||
43 | def incorrect_nonempty_PACKAGES(cfgdata, d): | 43 | def incorrect_nonempty_PACKAGES(cfgdata, d): |
44 | if bb.data.inherits_class("native", d) or \ | 44 | if bb.data.inherits_class("native", d) or \ |
45 | bb.data.inherits_class("cross", d): | 45 | bb.data.inherits_class("cross", d): |
46 | if d.getVar("PACKAGES", 1): | 46 | if d.getVar("PACKAGES", True): |
47 | return True | 47 | return True |
48 | 48 | ||
49 | def can_use_autotools_base(cfgdata, d): | 49 | def can_use_autotools_base(cfgdata, d): |
50 | cfg = d.getVar("do_configure", 1) | 50 | cfg = d.getVar("do_configure", True) |
51 | if not bb.data.inherits_class("autotools", d): | 51 | if not bb.data.inherits_class("autotools", d): |
52 | return False | 52 | return False |
53 | 53 | ||
@@ -65,10 +65,10 @@ def can_use_autotools_base(cfgdata, d): | |||
65 | 65 | ||
66 | def can_remove_FILESPATH(cfgdata, d): | 66 | def can_remove_FILESPATH(cfgdata, d): |
67 | expected = cfgdata.get("FILESPATH") | 67 | expected = cfgdata.get("FILESPATH") |
68 | #expected = "${@':'.join([os.path.normpath(os.path.join(fp, p, o)) for fp in d.getVar('FILESPATHBASE', 1).split(':') for p in d.getVar('FILESPATHPKG', 1).split(':') for o in (d.getVar('OVERRIDES', 1) + ':').split(':') if os.path.exists(os.path.join(fp, p, o))])}:${FILESDIR}" | 68 | #expected = "${@':'.join([os.path.normpath(os.path.join(fp, p, o)) for fp in d.getVar('FILESPATHBASE', True).split(':') for p in d.getVar('FILESPATHPKG', True).split(':') for o in (d.getVar('OVERRIDES', True) + ':').split(':') if os.path.exists(os.path.join(fp, p, o))])}:${FILESDIR}" |
69 | expectedpaths = bb.data.expand(expected, d) | 69 | expectedpaths = bb.data.expand(expected, d) |
70 | unexpanded = d.getVar("FILESPATH", 0) | 70 | unexpanded = d.getVar("FILESPATH", 0) |
71 | filespath = d.getVar("FILESPATH", 1).split(":") | 71 | filespath = d.getVar("FILESPATH", True).split(":") |
72 | filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] | 72 | filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] |
73 | for fp in filespath: | 73 | for fp in filespath: |
74 | if not fp in expectedpaths: | 74 | if not fp in expectedpaths: |
@@ -79,13 +79,13 @@ def can_remove_FILESPATH(cfgdata, d): | |||
79 | 79 | ||
80 | def can_remove_FILESDIR(cfgdata, d): | 80 | def can_remove_FILESDIR(cfgdata, d): |
81 | expected = cfgdata.get("FILESDIR") | 81 | expected = cfgdata.get("FILESDIR") |
82 | #expected = "${@bb.which(d.getVar('FILESPATH', 1), '.')}" | 82 | #expected = "${@bb.which(d.getVar('FILESPATH', True), '.')}" |
83 | unexpanded = d.getVar("FILESDIR", 0) | 83 | unexpanded = d.getVar("FILESDIR", 0) |
84 | if unexpanded is None: | 84 | if unexpanded is None: |
85 | return False | 85 | return False |
86 | 86 | ||
87 | expanded = os.path.normpath(d.getVar("FILESDIR", 1)) | 87 | expanded = os.path.normpath(d.getVar("FILESDIR", True)) |
88 | filespath = d.getVar("FILESPATH", 1).split(":") | 88 | filespath = d.getVar("FILESPATH", True).split(":") |
89 | filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] | 89 | filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] |
90 | 90 | ||
91 | return unexpanded != expected and \ | 91 | return unexpanded != expected and \ |
@@ -103,7 +103,7 @@ def can_remove_others(p, cfgdata, d): | |||
103 | continue | 103 | continue |
104 | 104 | ||
105 | try: | 105 | try: |
106 | expanded = d.getVar(k, 1) | 106 | expanded = d.getVar(k, True) |
107 | cfgexpanded = bb.data.expand(cfgunexpanded, d) | 107 | cfgexpanded = bb.data.expand(cfgunexpanded, d) |
108 | except bb.fetch.ParameterError: | 108 | except bb.fetch.ParameterError: |
109 | continue | 109 | continue |
@@ -115,8 +115,8 @@ def can_remove_others(p, cfgdata, d): | |||
115 | (p, cfgunexpanded, unexpanded, expanded)) | 115 | (p, cfgunexpanded, unexpanded, expanded)) |
116 | 116 | ||
117 | python do_recipe_sanity () { | 117 | python do_recipe_sanity () { |
118 | p = d.getVar("P", 1) | 118 | p = d.getVar("P", True) |
119 | p = "%s %s %s" % (d.getVar("PN", 1), d.getVar("PV", 1), d.getVar("PR", 1)) | 119 | p = "%s %s %s" % (d.getVar("PN", True), d.getVar("PV", True), d.getVar("PR", True)) |
120 | 120 | ||
121 | sanitychecks = [ | 121 | sanitychecks = [ |
122 | (can_remove_FILESDIR, "candidate for removal of FILESDIR"), | 122 | (can_remove_FILESDIR, "candidate for removal of FILESDIR"), |