Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 152828
Collapse All | Expand All

(-)pym/portage.py (-10 / +20 lines)
Lines 538-550 Link Here
538
538
539
#parse /etc/env.d and generate /etc/profile.env
539
#parse /etc/env.d and generate /etc/profile.env
540
540
541
def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None):
541
def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
542
	env=None):
542
	if target_root is None:
543
	if target_root is None:
543
		global root
544
		global root
544
		target_root = root
545
		target_root = root
545
	if prev_mtimes is None:
546
	if prev_mtimes is None:
546
		global mtimedb
547
		global mtimedb
547
		prev_mtimes = mtimedb["ldpath"]
548
		prev_mtimes = mtimedb["ldpath"]
549
	if env is None:
550
		env = os.environ
548
	envd_dir = os.path.join(target_root, "etc", "env.d")
551
	envd_dir = os.path.join(target_root, "etc", "env.d")
549
	portage_util.ensure_dirs(envd_dir, mode=0755)
552
	portage_util.ensure_dirs(envd_dir, mode=0755)
550
	fns = listdir(envd_dir, EmptyOnError=1)
553
	fns = listdir(envd_dir, EmptyOnError=1)
Lines 729-736 Link Here
729
		if not libdir_contents_changed:
732
		if not libdir_contents_changed:
730
			makelinks = False
733
			makelinks = False
731
734
735
	ldconfig = "/sbin/ldconfig"
736
	if "CHOST" in env and "CBUILD" in env and \
737
		env["CHOST"] != env["CBUILD"]:
738
		from portage_exec import find_binary
739
		ldconfig = find_binary("%s-ldconfig" % env["CHOST"])
740
732
	# Only run ldconfig as needed
741
	# Only run ldconfig as needed
733
	if (ld_cache_update or makelinks):
742
	if (ld_cache_update or makelinks) and ldconfig:
734
		# ldconfig has very different behaviour between FreeBSD and Linux
743
		# ldconfig has very different behaviour between FreeBSD and Linux
735
		if ostype=="Linux" or ostype.lower().endswith("gnu"):
744
		if ostype=="Linux" or ostype.lower().endswith("gnu"):
736
			# We can't update links if we haven't cleaned other versions first, as
745
			# We can't update links if we haven't cleaned other versions first, as
Lines 739-752 Link Here
739
			# we can safely create links.
748
			# we can safely create links.
740
			writemsg(">>> Regenerating %setc/ld.so.cache...\n" % target_root)
749
			writemsg(">>> Regenerating %setc/ld.so.cache...\n" % target_root)
741
			if makelinks:
750
			if makelinks:
742
				commands.getstatusoutput("cd / ; /sbin/ldconfig -r '%s'" % target_root)
751
				os.system("cd / ; %s -r '%s'" % (ldconfig, target_root))
743
			else:
752
			else:
744
				commands.getstatusoutput("cd / ; /sbin/ldconfig -X -r '%s'" % target_root)
753
				os.system("cd / ; %s -X -r '%s'" % (ldconfig, target_root))
745
		elif ostype in ("FreeBSD","DragonFly"):
754
		elif ostype in ("FreeBSD","DragonFly"):
746
			writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % target_root)
755
			writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % \
747
			commands.getstatusoutput(
756
				target_root)
748
				"cd / ; /sbin/ldconfig -elf -i -f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'" % \
757
			os.system(("cd / ; %s -elf -i " + \
749
				(target_root, target_root))
758
				"-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
759
				(ldconfig, target_root, target_root))
750
760
751
	del specials["LDPATH"]
761
	del specials["LDPATH"]
752
762
Lines 7072-7078 Link Here
7072
						del e
7082
						del e
7073
					portage_locks.unlockdir(catdir_lock)
7083
					portage_locks.unlockdir(catdir_lock)
7074
		env_update(target_root=self.myroot, prev_mtimes=ldpath_mtimes,
7084
		env_update(target_root=self.myroot, prev_mtimes=ldpath_mtimes,
7075
			contents=contents)
7085
			contents=contents, env=self.settings.environ())
7076
		return os.EX_OK
7086
		return os.EX_OK
7077
7087
7078
	def _unmerge_pkgfiles(self, pkgfiles, new_contents=None):
7088
	def _unmerge_pkgfiles(self, pkgfiles, new_contents=None):
Lines 7583-7589 Link Here
7583
		#update environment settings, library paths. DO NOT change symlinks.
7593
		#update environment settings, library paths. DO NOT change symlinks.
7584
		env_update(makelinks=(not downgrade),
7594
		env_update(makelinks=(not downgrade),
7585
			target_root=self.settings["ROOT"], prev_mtimes=prev_mtimes,
7595
			target_root=self.settings["ROOT"], prev_mtimes=prev_mtimes,
7586
			contents=contents)
7596
			contents=contents, env=self.settings.environ())
7587
		#dircache may break autoclean because it remembers the -MERGING-pkg file
7597
		#dircache may break autoclean because it remembers the -MERGING-pkg file
7588
		global dircache
7598
		global dircache
7589
		if dircache.has_key(self.dbcatdir):
7599
		if dircache.has_key(self.dbcatdir):

Return to bug 152828