-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zac Medico wrote:
> Mike Frysinger wrote:
>>> makelinks is set to 1 by default when upgrading a package so that running 
>>> ldconfig will update any shared lib links ... however, if the package 
>>> doesnt 
>>> install any libraries, then there's no point in running ldconfig
> 
> I tried the updated patch and it works for me now.  While reviewing the patch 
> I got the impression that the os.access(srcroot+x,os.R_OK) thing and the 
> mtimedb stuff are mutually redundant.  Both are being used to track whether 
> the installed package has changed libraries in the search path.  In order to 
> simplify the code, it seems logical to use either one or the other, not both.

I've revised the patch so that it relies on the mtimedb in order to determine 
whether or not ldconfig needs to be run (making the 'srcroot' parameter 
unnecessary).  The revised patch assumes that it is not necessary to run 
ldconfig when the mtimedb contains matching mtimes for all existent paths in 
the search path (nonexistent paths are ignored).

Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDzK23/ejvha5XGaMRAh+mAJ9PkFg6BQINfBXerZrY34f+0QpRiQCePR1M
ISuHnCjy8sofNlj9eQFWFmk=
=48g9
-----END PGP SIGNATURE-----
Index: pym/portage.py
===================================================================
--- pym/portage.py.orig
+++ pym/portage.py
@@ -637,12 +637,20 @@ def env_update(makelinks=1):
 	if not mtimedb.has_key("ldpath"):
 		mtimedb["ldpath"]={}
 
-	for x in specials["LDPATH"]+['/usr/lib','/lib']:
+	import errno
+	for x in portage_util.unique_array(specials["LDPATH"]+['/usr/lib','/usr/lib64','/usr/lib32','/lib','/lib64','/lib32']):
 		try:
 			newldpathtime=os.stat(x)[stat.ST_MTIME]
 		except SystemExit, e:
 			raise
-		except:
+		except Exception, e:
+			if isinstance(e,OSError) and e.errno == errno.ENOENT:
+				try:
+					del mtimedb["ldpath"][x]
+				except KeyError:
+					pass
+				# ignore this path because it doesn't exist
+				continue
 			newldpathtime=0
 		if mtimedb["ldpath"].has_key(x):
 			if mtimedb["ldpath"][x]==newldpathtime:
@@ -654,9 +662,10 @@ def env_update(makelinks=1):
 			mtimedb["ldpath"][x]=newldpathtime
 			ld_cache_update=True
 
-	# ldconfig has very different behaviour between FreeBSD and Linux
-	if ostype=="Linux" or ostype.lower().endswith("gnu"):
-		if (ld_cache_update or makelinks):
+	# Don't run ldconfig if the package didn't install any libs
+	if ld_cache_update:
+		# ldconfig has very different behaviour between FreeBSD and Linux
+		if ostype=="Linux" or ostype.lower().endswith("gnu"):
 			# We can't update links if we haven't cleaned other versions first, as
 			# an older package installed ON TOP of a newer version will cause ldconfig
 			# to overwrite the symlinks we just made. -X means no links. After 'clean'
@@ -666,8 +675,7 @@ def env_update(makelinks=1):
 				commands.getstatusoutput("cd / ; /sbin/ldconfig -r "+root)
 			else:
 				commands.getstatusoutput("cd / ; /sbin/ldconfig -X -r "+root)
-	elif ostype in ("FreeBSD","DragonFly"):
-		if (ld_cache_update):
+		elif ostype in ("FreeBSD","DragonFly"):
 			writemsg(">>> Regenerating "+str(root)+"var/run/ld-elf.so.hints...\n")
 			commands.getstatusoutput("cd / ; /sbin/ldconfig -elf -i -f "+str(root)+"var/run/ld-elf.so.hints "+str(root)+"etc/ld.so.conf")
 

Reply via email to