diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-04 16:56:25 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-05 21:19:12 +0100 |
commit | e492016a7bf3932aa9f7181024a515f86618891a (patch) | |
tree | 4e849a5d23ed6fc1dcf1d36bbbd54f70fcf30b7e | |
parent | 4c5831e8eb0a8352fbde09c7f80acacb6790730a (diff) | |
download | poky-e492016a7bf3932aa9f7181024a515f86618891a.tar.gz |
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>
-rw-r--r-- | meta/classes-recipe/update-alternatives.bbclass | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/meta/classes-recipe/update-alternatives.bbclass b/meta/classes-recipe/update-alternatives.bbclass index b153e1b297..5f40dc23ea 100644 --- a/meta/classes-recipe/update-alternatives.bbclass +++ b/meta/classes-recipe/update-alternatives.bbclass | |||
@@ -73,24 +73,6 @@ UPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_ | |||
73 | 73 | ||
74 | PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native" | 74 | PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native" |
75 | 75 | ||
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 | |||
94 | def ua_extend_depends(d): | 76 | def ua_extend_depends(d): |
95 | if not 'virtual/update-alternatives' in d.getVar('PROVIDES'): | 77 | if not 'virtual/update-alternatives' in d.getVar('PROVIDES'): |
96 | d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives') | 78 | d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives') |
@@ -112,9 +94,6 @@ python __anonymous() { | |||
112 | if not update_alternatives_enabled(d): | 94 | if not update_alternatives_enabled(d): |
113 | return | 95 | return |
114 | 96 | ||
115 | # compute special vardeps | ||
116 | gen_updatealternativesvardeps(d) | ||
117 | |||
118 | # extend the depends to include virtual/update-alternatives | 97 | # extend the depends to include virtual/update-alternatives |
119 | ua_extend_depends(d) | 98 | ua_extend_depends(d) |
120 | } | 99 | } |
@@ -124,13 +103,20 @@ def gen_updatealternativesvars(d): | |||
124 | pkgs = (d.getVar("PACKAGES") or "").split() | 103 | pkgs = (d.getVar("PACKAGES") or "").split() |
125 | vars = (d.getVar("UPDALTVARS") or "").split() | 104 | vars = (d.getVar("UPDALTVARS") or "").split() |
126 | 105 | ||
106 | # First compute them for non_pkg versions | ||
127 | for v in vars: | 107 | 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 + "]") | ||
129 | 112 | ||
130 | for p in pkgs: | 113 | for p in pkgs: |
131 | for v in vars: | 114 | for v in vars: |
132 | ret.append(v + ":" + p) | 115 | for flag in sorted((d.getVarFlags("%s:%s" % (v,p)) or {}).keys()): |
133 | ret.append(v + "_VARDEPS_" + p) | 116 | if flag == "doc" or flag == "vardeps" or flag == "vardepsexp": |
117 | continue | ||
118 | ret.append('%s:%s' % (v,p) + "[" + flag + "]") | ||
119 | |||
134 | return " ".join(ret) | 120 | return " ".join(ret) |
135 | 121 | ||
136 | # Now the new stuff, we use a custom function to generate the right values | 122 | # Now the new stuff, we use a custom function to generate the right values |