Skip to content

Commit e492016

Browse files
committed
update-alternatives: Simplfy variable dependency logic
When looking at bitbake parsing speed issues, I noticed a lot of weird looking variables from the update-alternatives class. It is possible this was written before variable dependencies could handle flags. It can handle flags now so simplfy the code to take advantage of that and avoid the indirection variables. The win here is a significant reduction in the number of variables, which in turn significantly reduces the looping bitbake's taskhash calculation code needs to do. (From OE-Core rev: bd8fc4c59a137a37bd7a54f398949617982d447e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 parent 4c5831e commit e492016

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

meta/classes-recipe/update-alternatives.bbclass

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,6 @@ UPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_
7373

7474
PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
7575

76-
def gen_updatealternativesvardeps(d):
77-
pkgs = (d.getVar("PACKAGES") or "").split()
78-
vars = (d.getVar("UPDALTVARS") or "").split()
79-
80-
# First compute them for non_pkg versions
81-
for v in vars:
82-
for flag in sorted((d.getVarFlags(v) or {}).keys()):
83-
if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
84-
continue
85-
d.appendVar('%s_VARDEPS' % (v), ' %s:%s' % (flag, d.getVarFlag(v, flag, False)))
86-
87-
for p in pkgs:
88-
for v in vars:
89-
for flag in sorted((d.getVarFlags("%s:%s" % (v,p)) or {}).keys()):
90-
if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
91-
continue
92-
d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s:%s' % (v,p), flag, False)))
93-
9476
def ua_extend_depends(d):
9577
if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
9678
d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
@@ -112,9 +94,6 @@ python __anonymous() {
11294
if not update_alternatives_enabled(d):
11395
return
11496

115-
# compute special vardeps
116-
gen_updatealternativesvardeps(d)
117-
11897
# extend the depends to include virtual/update-alternatives
11998
ua_extend_depends(d)
12099
}
@@ -124,13 +103,20 @@ def gen_updatealternativesvars(d):
124103
pkgs = (d.getVar("PACKAGES") or "").split()
125104
vars = (d.getVar("UPDALTVARS") or "").split()
126105

106+
# First compute them for non_pkg versions
127107
for v in vars:
128-
ret.append(v + "_VARDEPS")
108+
for flag in sorted((d.getVarFlags(v) or {}).keys()):
109+
if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
110+
continue
111+
ret.append(v + "[" + flag + "]")
129112

130113
for p in pkgs:
131114
for v in vars:
132-
ret.append(v + ":" + p)
133-
ret.append(v + "_VARDEPS_" + p)
115+
for flag in sorted((d.getVarFlags("%s:%s" % (v,p)) or {}).keys()):
116+
if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
117+
continue
118+
ret.append('%s:%s' % (v,p) + "[" + flag + "]")
119+
134120
return " ".join(ret)
135121

136122
# Now the new stuff, we use a custom function to generate the right values

0 commit comments

Comments
 (0)