On Monday 16 January 2006 19:52, Zac Medico wrote:
> Mike Frysinger wrote:
> > -   for x in specials["LDPATH"]+['/usr/lib','/lib']:
> > +   skip_makelinks=1
> > +   for x in
> > portage_util.unique_array(specials["LDPATH"]+['/usr/lib','/usr/lib64','/u
> >sr/lib32','/lib','/lib64','/lib32']): +              if makelinks and 
> >skip_makelinks
> > and os.access(srcroot+x,os.R_OK): +                 skip_makelinks=0
>
> The logic here isn't obvious to me, could you clarify?

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've tried the 
> patch (against trunk revision 2564) and it seems that the skip_makelinks=0
> executes even when a package with no shared libraries is installed, making
> the patch ineffective (I still get "Regenerating /etc/ld.so.cache" no
> matter what).  If I comment out the skip_makelinks=0 part then ldconfig
> doesn't run unecessarily (as expected).

that's because there's one small hunk missing from what i posted

updated patch attached
-mike
Index: pym/portage.py
===================================================================
--- pym/portage.py	(revision 2563)
+++ pym/portage.py	(working copy)
@@ -521,7 +521,7 @@
 
 #parse /etc/env.d and generate /etc/profile.env
 
-def env_update(makelinks=1):
+def env_update(makelinks=1,srcroot=""):
 	global root
 	if not os.path.exists(root+"etc/env.d"):
 		prevmask=os.umask(0)
@@ -637,7 +634,10 @@
 	if not mtimedb.has_key("ldpath"):
 		mtimedb["ldpath"]={}
 
-	for x in specials["LDPATH"]+['/usr/lib','/lib']:
+	skip_makelinks=1
+	for x in portage_util.unique_array(specials["LDPATH"]+['/usr/lib','/usr/lib64','/usr/lib32','/lib','/lib64','/lib32']):
+		if makelinks and skip_makelinks and os.access(srcroot+x,os.R_OK):
+			skip_makelinks=0
 		try:
 			newldpathtime=os.stat(x)[stat.ST_MTIME]
 		except SystemExit, e:
@@ -654,9 +654,10 @@
 			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 or (makelinks and not skip_makelinks)):
+		# 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 +667,7 @@
 				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")
 
@@ -6113,7 +6113,7 @@
 				downgrade = True
 
 		#update environment settings, library paths. DO NOT change symlinks.
-		env_update(makelinks=(not downgrade))
+		env_update(makelinks=(not downgrade),srcroot=srcroot)
 		#dircache may break autoclean because it remembers the -MERGING-pkg file
 		global dircache
 		if dircache.has_key(self.dbcatdir):

Reply via email to