scummvm random work
[patches.git] / portage-only-ldconfig-when-needed.patch
CommitLineData
5e993f12 1Index: pym/portage.py
2===================================================================
3--- pym/portage.py (revision 2563)
4+++ pym/portage.py (working copy)
5@@ -521,7 +521,7 @@
6
7 #parse /etc/env.d and generate /etc/profile.env
8
9-def env_update(makelinks=1):
10+def env_update(makelinks=1,srcroot=""):
11 global root
12 if not os.path.exists(root+"etc/env.d"):
13 prevmask=os.umask(0)
14@@ -637,7 +634,10 @@
15 if not mtimedb.has_key("ldpath"):
16 mtimedb["ldpath"]={}
17
18- for x in specials["LDPATH"]+['/usr/lib','/lib']:
19+ skip_makelinks=1
20+ for x in portage_util.unique_array(specials["LDPATH"]+['/usr/lib','/usr/lib64','/usr/lib32','/lib','/lib64','/lib32']):
21+ if makelinks and skip_makelinks and os.access(srcroot+x,os.R_OK):
22+ skip_makelinks=0
23 try:
24 newldpathtime=os.stat(x)[stat.ST_MTIME]
25 except SystemExit, e:
26@@ -654,9 +654,10 @@
27 mtimedb["ldpath"][x]=newldpathtime
28 ld_cache_update=True
29
30- # ldconfig has very different behaviour between FreeBSD and Linux
31- if ostype=="Linux" or ostype.lower().endswith("gnu"):
32- if (ld_cache_update or makelinks):
33+ # Don't run ldconfig if the package didn't install any libs
34+ if (ld_cache_update or (makelinks and not skip_makelinks)):
35+ # ldconfig has very different behaviour between FreeBSD and Linux
36+ if ostype=="Linux" or ostype.lower().endswith("gnu"):
37 # We can't update links if we haven't cleaned other versions first, as
38 # an older package installed ON TOP of a newer version will cause ldconfig
39 # to overwrite the symlinks we just made. -X means no links. After 'clean'
40@@ -666,8 +667,7 @@
41 commands.getstatusoutput("cd / ; /sbin/ldconfig -r "+root)
42 else:
43 commands.getstatusoutput("cd / ; /sbin/ldconfig -X -r "+root)
44- elif ostype in ("FreeBSD","DragonFly"):
45- if (ld_cache_update):
46+ elif ostype in ("FreeBSD","DragonFly"):
47 writemsg(">>> Regenerating "+str(root)+"var/run/ld-elf.so.hints...\n")
48 commands.getstatusoutput("cd / ; /sbin/ldconfig -elf -i -f "+str(root)+"var/run/ld-elf.so.hints "+str(root)+"etc/ld.so.conf")
49
50@@ -6113,7 +6113,7 @@
51 downgrade = True
52
53 #update environment settings, library paths. DO NOT change symlinks.
54- env_update(makelinks=(not downgrade))
55+ env_update(makelinks=(not downgrade),srcroot=srcroot)
56 #dircache may break autoclean because it remembers the -MERGING-pkg file
57 global dircache
58 if dircache.has_key(self.dbcatdir):