Skip to contentSkip to conversation

update-alternatives: Fix absolute symlink handling

PATCH New Richard Purdie 1 participant 1 message May 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update-alternatives: Fix absolute symlink handling

After the class changes, absolute symlinks are not being handled correctly by the class file. This adds handling for absolute symlinks to account for the pkgdest directory, removing dangling symlink messages from recipes like bzip2.

---

meta/classes/update-alternatives.bbclass +5 -1
index fce1e84..9f2e59f 100644
@@ -247,7 +247,11 @@ python perform_packagecopy_append () {
 		for alt_target in link_rename:
 			src = '%s/%s' % (pkgdest, alt_target)
 			dest = '%s/%s' % (pkgdest, link_rename[alt_target])
-			link_target = os.path.join(os.path.dirname(src), os.readlink(src))
+			link = os.readlink(src)
+			if os.path.isabs(link):
+				link_target = pkgdest + os.readlink(src)
+			else:
+				link_target = os.path.join(os.path.dirname(src), link)
 
 			if os.path.lexists(link_target):
 				# Ok, the link_target exists, we can rename