diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/update-alternatives.bbclass | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass index ee66379933..1362274d4d 100644 --- a/meta/classes/update-alternatives.bbclass +++ b/meta/classes/update-alternatives.bbclass | |||
@@ -148,7 +148,7 @@ def apply_update_alternative_renames(d): | |||
148 | pkgdest = d.getVar('PKGD') | 148 | pkgdest = d.getVar('PKGD') |
149 | for pkg in (d.getVar('PACKAGES') or "").split(): | 149 | for pkg in (d.getVar('PACKAGES') or "").split(): |
150 | # If the src == dest, we know we need to rename the dest by appending ${BPN} | 150 | # If the src == dest, we know we need to rename the dest by appending ${BPN} |
151 | link_rename = {} | 151 | link_rename = [] |
152 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split(): | 152 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split(): |
153 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) | 153 | alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) |
154 | if not alt_link: | 154 | if not alt_link: |
@@ -174,7 +174,7 @@ def apply_update_alternative_renames(d): | |||
174 | elif os.path.lexists(src): | 174 | elif os.path.lexists(src): |
175 | if os.path.islink(src): | 175 | if os.path.islink(src): |
176 | # Delay rename of links | 176 | # Delay rename of links |
177 | link_rename[alt_target] = alt_target_rename | 177 | link_rename.append((alt_target, alt_target_rename)) |
178 | else: | 178 | else: |
179 | bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename)) | 179 | bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename)) |
180 | os.rename(src, dest) | 180 | os.rename(src, dest) |
@@ -185,22 +185,21 @@ def apply_update_alternative_renames(d): | |||
185 | 185 | ||
186 | # Process delayed link names | 186 | # Process delayed link names |
187 | # Do these after other renames so we can correct broken links | 187 | # Do these after other renames so we can correct broken links |
188 | for alt_target in link_rename: | 188 | for (alt_target, alt_target_rename) in link_rename: |
189 | src = '%s/%s' % (pkgdest, alt_target) | 189 | src = '%s/%s' % (pkgdest, alt_target) |
190 | dest = '%s/%s' % (pkgdest, link_rename[alt_target]) | 190 | dest = '%s/%s' % (pkgdest, alt_target_rename) |
191 | link = os.readlink(src) | ||
192 | link_target = oe.path.realpath(src, pkgdest, True) | 191 | link_target = oe.path.realpath(src, pkgdest, True) |
193 | 192 | ||
194 | if os.path.lexists(link_target): | 193 | if os.path.lexists(link_target): |
195 | # Ok, the link_target exists, we can rename | 194 | # Ok, the link_target exists, we can rename |
196 | bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, link_rename[alt_target])) | 195 | bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, alt_target_rename)) |
197 | os.rename(src, dest) | 196 | os.rename(src, dest) |
198 | else: | 197 | else: |
199 | # Try to resolve the broken link to link.${BPN} | 198 | # Try to resolve the broken link to link.${BPN} |
200 | link_maybe = '%s.%s' % (os.readlink(src), pn) | 199 | link_maybe = '%s.%s' % (os.readlink(src), pn) |
201 | if os.path.lexists(os.path.join(os.path.dirname(src), link_maybe)): | 200 | if os.path.lexists(os.path.join(os.path.dirname(src), link_maybe)): |
202 | # Ok, the renamed link target exists.. create a new link, and remove the original | 201 | # Ok, the renamed link target exists.. create a new link, and remove the original |
203 | bb.note('%s: Creating new link %s -> %s' % (pn, link_rename[alt_target], link_maybe)) | 202 | bb.note('%s: Creating new link %s -> %s' % (pn, alt_target_rename, link_maybe)) |
204 | os.symlink(link_maybe, dest) | 203 | os.symlink(link_maybe, dest) |
205 | os.unlink(src) | 204 | os.unlink(src) |
206 | else: | 205 | else: |