Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 509136 | Differences between
and this patch

Collapse All | Expand All

(-)./prefix-portage-2.2.8/pym/_emerge/depgraph.py.orig (-19 / +61 lines)
Lines 23-28 Link Here
23
from portage.dep import Atom, best_match_to_list, extract_affecting_use, \
23
from portage.dep import Atom, best_match_to_list, extract_affecting_use, \
24
	check_required_use, human_readable_required_use, match_from_list, \
24
	check_required_use, human_readable_required_use, match_from_list, \
25
	_repo_separator
25
	_repo_separator
26
from portage.dep.dep_check import ro_selected
26
from portage.dep._slot_operator import ignore_built_slot_operator_deps
27
from portage.dep._slot_operator import ignore_built_slot_operator_deps
27
from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use, \
28
from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use, \
28
	_get_eapi_attrs
29
	_get_eapi_attrs
Lines 2231-2237 Link Here
2231
				edepend["HDEPEND"] = ""
2232
				edepend["HDEPEND"] = ""
2232
2233
2233
		deps = (
2234
		deps = (
2234
			(depend_root, edepend["DEPEND"],
2235
			(depend_root, "DEPEND",
2235
				self._priority(buildtime=True,
2236
				self._priority(buildtime=True,
2236
				optional=(pkg.built or ignore_depend_deps),
2237
				optional=(pkg.built or ignore_depend_deps),
2237
				ignored=ignore_depend_deps)),
2238
				ignored=ignore_depend_deps)),
Lines 2239-2253 Link Here
2239
				self._priority(buildtime=True,
2240
				self._priority(buildtime=True,
2240
				optional=(pkg.built or ignore_hdepend_deps),
2241
				optional=(pkg.built or ignore_hdepend_deps),
2241
				ignored=ignore_hdepend_deps)),
2242
				ignored=ignore_hdepend_deps)),
2242
			(myroot, edepend["RDEPEND"],
2243
			(myroot, "RDEPEND",
2243
				self._priority(runtime=True)),
2244
				self._priority(runtime=True)),
2244
			(myroot, edepend["PDEPEND"],
2245
			(myroot, "PDEPEND",
2245
				self._priority(runtime_post=True))
2246
				self._priority(runtime_post=True))
2246
		)
2247
		)
2247
2248
2248
		debug = "--debug" in self._frozen_config.myopts
2249
		debug = "--debug" in self._frozen_config.myopts
2249
2250
2250
		for dep_root, dep_string, dep_priority in deps:
2251
		for dep_root, dep_type, dep_priority in deps:
2252
				dep_string=""
2253
				if dep_type and edepend[dep_type]:
2254
					dep_string = edepend[dep_type] 
2251
				if not dep_string:
2255
				if not dep_string:
2252
					continue
2256
					continue
2253
				if debug:
2257
				if debug:
Lines 2285-2291 Link Here
2285
2289
2286
				try:
2290
				try:
2287
					dep_string = list(self._queue_disjunctive_deps(
2291
					dep_string = list(self._queue_disjunctive_deps(
2288
						pkg, dep_root, dep_priority, dep_string))
2292
						pkg, dep_root, dep_priority, dep_string, dep_type))
2289
				except portage.exception.InvalidDependString as e:
2293
				except portage.exception.InvalidDependString as e:
2290
					if pkg.installed:
2294
					if pkg.installed:
2291
						self._dynamic_config._masked_installed.add(pkg)
2295
						self._dynamic_config._masked_installed.add(pkg)
Lines 2300-2313 Link Here
2300
2304
2301
				if not self._add_pkg_dep_string(
2305
				if not self._add_pkg_dep_string(
2302
					pkg, dep_root, dep_priority, dep_string,
2306
					pkg, dep_root, dep_priority, dep_string,
2303
					allow_unsatisfied):
2307
					allow_unsatisfied, dep_type=dep_type):
2304
					return 0
2308
					return 0
2305
2309
2306
		self._dynamic_config._traversed_pkg_deps.add(pkg)
2310
		self._dynamic_config._traversed_pkg_deps.add(pkg)
2307
		return 1
2311
		return 1
2308
2312
2309
	def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
2313
	def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
2310
		allow_unsatisfied):
2314
		allow_unsatisfied, dep_type=None):
2311
		_autounmask_backup = self._dynamic_config._autounmask
2315
		_autounmask_backup = self._dynamic_config._autounmask
2312
		if dep_priority.optional or dep_priority.ignored:
2316
		if dep_priority.optional or dep_priority.ignored:
2313
			# Temporarily disable autounmask for deps that
2317
			# Temporarily disable autounmask for deps that
Lines 2352-2358 Link Here
2352
			not slot_operator_rebuild
2356
			not slot_operator_rebuild
2353
2357
2354
	def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
2358
	def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
2355
		dep_string, allow_unsatisfied):
2359
		dep_string, allow_unsatisfied, dep_type=None):
2356
		depth = pkg.depth + 1
2360
		depth = pkg.depth + 1
2357
		deep = self._dynamic_config.myparams.get("deep", 0)
2361
		deep = self._dynamic_config.myparams.get("deep", 0)
2358
		recurse_satisfied = deep is True or depth <= deep
2362
		recurse_satisfied = deep is True or depth <= deep
Lines 2372-2378 Link Here
2372
		try:
2376
		try:
2373
			selected_atoms = self._select_atoms(dep_root,
2377
			selected_atoms = self._select_atoms(dep_root,
2374
				dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
2378
				dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
2375
				strict=strict, priority=dep_priority)
2379
				strict=strict, priority=dep_priority, dep_type=dep_type)
2376
		except portage.exception.InvalidDependString:
2380
		except portage.exception.InvalidDependString:
2377
			if pkg.installed:
2381
			if pkg.installed:
2378
				self._dynamic_config._masked_installed.add(pkg)
2382
				self._dynamic_config._masked_installed.add(pkg)
Lines 2670-2676 Link Here
2670
					child_pkgs.sort()
2674
					child_pkgs.sort()
2671
				yield (atom, child_pkgs[-1])
2675
				yield (atom, child_pkgs[-1])
2672
2676
2673
	def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct):
2677
	def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
2674
		"""
2678
		"""
2675
		Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
2679
		Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
2676
		Yields non-disjunctive deps. Raises InvalidDependString when
2680
		Yields non-disjunctive deps. Raises InvalidDependString when
Lines 2679-2711 Link Here
2679
		for x in dep_struct:
2683
		for x in dep_struct:
2680
			if isinstance(x, list):
2684
			if isinstance(x, list):
2681
				if x and x[0] == "||":
2685
				if x and x[0] == "||":
2682
					self._queue_disjunction(pkg, dep_root, dep_priority, [x])
2686
					self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
2683
				else:
2687
				else:
2684
					for y in self._queue_disjunctive_deps(
2688
					for y in self._queue_disjunctive_deps(
2685
						pkg, dep_root, dep_priority, x):
2689
					        pkg, dep_root, dep_priority, x, dep_type):
2686
						yield y
2690
						yield y
2687
			else:
2691
			else:
2688
				# Note: Eventually this will check for PROPERTIES=virtual
2692
				# Note: Eventually this will check for PROPERTIES=virtual
2689
				# or whatever other metadata gets implemented for this
2693
				# or whatever other metadata gets implemented for this
2690
				# purpose.
2694
				# purpose.
2691
				if x.cp.startswith('virtual/'):
2695
				if x.cp.startswith('virtual/'):
2692
					self._queue_disjunction(pkg, dep_root, dep_priority, [x])
2696
					self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
2693
				else:
2697
				else:
2694
					yield x
2698
					yield x
2695
2699
2696
	def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
2700
	def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
2697
		self._dynamic_config._dep_disjunctive_stack.append(
2701
		self._dynamic_config._dep_disjunctive_stack.append(
2698
			(pkg, dep_root, dep_priority, dep_struct))
2702
			(pkg, dep_root, dep_priority, dep_struct, dep_type))
2699
2703
2700
	def _pop_disjunction(self, allow_unsatisfied):
2704
	def _pop_disjunction(self, allow_unsatisfied):
2701
		"""
2705
		"""
2702
		Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
2706
		Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
2703
		populate self._dynamic_config._dep_stack.
2707
		populate self._dynamic_config._dep_stack.
2704
		"""
2708
		"""
2705
		pkg, dep_root, dep_priority, dep_struct = \
2709
		pkg, dep_root, dep_priority, dep_struct, dep_type = \
2706
			self._dynamic_config._dep_disjunctive_stack.pop()
2710
			self._dynamic_config._dep_disjunctive_stack.pop()
2707
		if not self._add_pkg_dep_string(
2711
		if not self._add_pkg_dep_string(
2708
			pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied):
2712
			pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied, dep_type):
2709
			return 0
2713
			return 0
2710
		return 1
2714
		return 1
2711
2715
Lines 3513-3519 Link Here
3513
			**portage._native_kwargs(kwargs))
3517
			**portage._native_kwargs(kwargs))
3514
3518
3515
	def _select_atoms_highest_available(self, root, depstring,
3519
	def _select_atoms_highest_available(self, root, depstring,
3516
		myuse=None, parent=None, strict=True, trees=None, priority=None):
3520
		myuse=None, parent=None, strict=True, trees=None, priority=None, dep_type=None):
3517
		"""This will raise InvalidDependString if necessary. If trees is
3521
		"""This will raise InvalidDependString if necessary. If trees is
3518
		None then self._dynamic_config._filtered_trees is used."""
3522
		None then self._dynamic_config._filtered_trees is used."""
3519
3523
Lines 3536-3541 Link Here
3536
		pkgsettings = self._frozen_config.pkgsettings[root]
3540
		pkgsettings = self._frozen_config.pkgsettings[root]
3537
		if trees is None:
3541
		if trees is None:
3538
			trees = self._dynamic_config._filtered_trees
3542
			trees = self._dynamic_config._filtered_trees
3543
3544
		# this one is needed to guarantee good readonly root
3545
		# resolution display in the merge list. required since
3546
		# parent (below) can be None
3547
		trees[root]["disp_parent"] = parent
3548
3539
		mytrees = trees[root]
3549
		mytrees = trees[root]
3540
		atom_graph = digraph()
3550
		atom_graph = digraph()
3541
		if True:
3551
		if True:
Lines 3564-3570 Link Here
3564
3574
3565
				mycheck = portage.dep_check(depstring, None,
3575
				mycheck = portage.dep_check(depstring, None,
3566
					pkgsettings, myuse=myuse,
3576
					pkgsettings, myuse=myuse,
3567
					myroot=root, trees=trees)
3577
					myroot=root, trees=trees, dep_type=dep_type)
3568
			finally:
3578
			finally:
3569
				# restore state
3579
				# restore state
3570
				self._dynamic_config._autounmask = _autounmask_backup
3580
				self._dynamic_config._autounmask = _autounmask_backup
Lines 3631-3636 Link Here
3631
							continue
3641
							continue
3632
						node_stack.append((child_node, node, child_atom))
3642
						node_stack.append((child_node, node, child_atom))
3633
3643
3644
		trees[root].pop("disp_parent")
3634
		return selected_atoms
3645
		return selected_atoms
3635
3646
3636
	def _expand_virt_from_graph(self, root, atom):
3647
	def _expand_virt_from_graph(self, root, atom):
Lines 3906-3911 Link Here
3906
3917
3907
	def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
3918
	def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
3908
		check_backtrack=False, check_autounmask_breakage=False, show_req_use=None):
3919
		check_backtrack=False, check_autounmask_breakage=False, show_req_use=None):
3920
		# print readonly selected packages
3921
		if len(ro_selected) > 0:
3922
			out.write("\n%s\n\n" % (darkgreen("Packages resolved from readonly installations:")))
3923
3924
		ro_mismatch_warning = False
3925
		ro_dupcheck = []
3926
		for x in ro_selected:
3927
			tmp_type = x["type"].replace("END","")
3928
			while len(tmp_type) < 4:
3929
				tmp_type += " "
3930
			if str(x["atom"]) not in ro_dupcheck:
3931
				out.write("[%s %s] %s %s %s (%s by %s)" % (teal("readonly"), 
3932
					green(tmp_type), green(str(x["matches"][0])), yellow("from"), 
3933
					blue(x["ro_root"]), turquoise(str(x["atom"])), green(x["parent"].cpv)))
3934
3935
				ro_dupcheck.append(str(x["atom"]))
3936
3937
				if x["host_mismatch"]:
3938
					ro_mismatch_warning = True
3939
					out.write(" %s\n" % (red("**")))
3940
				else:
3941
					out.write("\n")
3942
3943
		if ro_mismatch_warning:
3944
			out.write("\n%s:" % (red("**")))
3945
			out.write(yellow(" WARNING: packages marked with ** have been resolved as a\n"))
3946
			out.write(yellow("    runtime dependency, but the CHOST variable for the parent\n"))
3947
			out.write(yellow("    and dependency package don't match. This could cause link\n"))
3948
			out.write(yellow("    errors. It is recommended to use RDEPEND READONLY_EPREFIX's\n"))
3949
			out.write(yellow("    only with matching CHOST portage instances.\n"))
3950
3909
		"""
3951
		"""
3910
		When check_backtrack=True, no output is produced and
3952
		When check_backtrack=True, no output is produced and
3911
		the method either returns or raises _backtrack_mask if
3953
		the method either returns or raises _backtrack_mask if
(-)./prefix-portage-2.2.8/pym/portage/exception.py.orig (+3 lines)
Lines 197-199 Link Here
197
class UntrustedSignature(SignatureException):
197
class UntrustedSignature(SignatureException):
198
	"""Signature was not certified to the desired security level"""
198
	"""Signature was not certified to the desired security level"""
199
199
200
class InvalidReadonlyERoot(PortageException):
201
	"""Readonly EROOT definition string in make.conf invalid."""
202
(-)./prefix-portage-2.2.8/pym/portage/dep/dep_check.py.orig (-1 / +98 lines)
Lines 261-266 Link Here
261
	__slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
261
	__slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
262
		'all_installed_slots')
262
		'all_installed_slots')
263
263
264
ro_trees={}
265
ro_vartrees={}
266
ro_selected=[]
267
268
def dep_match_readonly_roots(settings, atom, dep_type, parent=None):
269
	if len(ro_trees) < len(settings.readonly_roots):
270
		# MDUFT: create additional vartrees for every readonly root here.
271
		# the ro_vartrees instances are created below as they are needed to
272
		# avoid reading vartrees of portage instances which aren't required
273
		# while resolving this dependencies.
274
		for type in ("DEPEND","RDEPEND", "PDEPEND"):
275
			ro_trees[type] = []
276
			
277
			for ro_root, ro_dep_types in settings.readonly_roots.items():
278
				if type in ro_dep_types:
279
					ro_trees[type].append(ro_root)
280
281
	if len(ro_trees) == 0:
282
		return []
283
	
284
	matches = []
285
286
	for ro_root in ro_trees[dep_type]:
287
		if not ro_vartrees.has_key(ro_root):
288
			# target_root=ro_root ok? or should it be the real target_root?
289
			_tmp_settings = portage.config(config_root=ro_root, target_root=ro_root,
290
				config_incrementals=portage.const.INCREMENTALS)
291
			
292
			ro_vartrees[ro_root] = portage.vartree(root=ro_root, 
293
				categories=_tmp_settings.categories, 
294
				settings=_tmp_settings, kill_eprefix=True)
295
				
296
		ro_matches = ro_vartrees[ro_root].dbapi.match(atom)
297
298
		if ro_matches:
299
			ro_host_mismatch = False
300
			if dep_type is "RDEPEND":
301
				# we need to assure binary compatability, so it needs to be
302
				# the same CHOST! But how? for now i cannot do anything...
303
				if parent and parent.metadata["CHOST"] != ro_vartrees[ro_root].settings.get("CHOST", ""):
304
					# provocate a big fat warning in the list of external packages.
305
					ro_host_mismatch = True
306
				pass
307
308
			matches.append({ "ro_root": ro_root, "atom": atom, "matches": ro_matches, 
309
				"type": dep_type, "parent": parent, "host_mismatch": ro_host_mismatch })
310
311
	return matches
312
313
def dep_wordreduce_readonly(reduced, unreduced, settings, dep_type, parent):
314
	for mypos, token in enumerate(unreduced):
315
		# recurse if it's a list.
316
		if isinstance(reduced[mypos], list):
317
			reduced[mypos] = dep_wordreduce_readonly(reduced[mypos], 
318
				unreduced[mypos], settings, dep_type, parent)
319
		# do nothing if it's satisfied already.
320
		elif not reduced[mypos]:
321
			ro_matches = dep_match_readonly_roots(settings, unreduced[mypos], dep_type, parent)
322
323
			if ro_matches:
324
				# TODO: select a match if there are more than one?
325
				# for now, the first match is taken...
326
				ro_selected.append(ro_matches[0])
327
				reduced[mypos] = True
328
329
	return reduced
330
331
# this may be better placed somewhere else, but i put it here for now, to
332
# keep all functions in the patch on one big heap.
333
def readonly_pathmatch_any(settings, path):
334
	path = path.lstrip('/')
335
	# first try locally, and match that if it exists.
336
	if os.path.exists(os.path.join(EPREFIX,path)):
337
		return os.path.join(EPREFIX,path)
338
339
	# after that try all readonly roots where DEPEND is allowed. this makes
340
	# sure that executing binaries is possible from there.
341
	for ro_root, ro_deps in settings.readonly_roots.items():
342
		if "DEPEND" in ro_deps:
343
			print(" --- checking %s --- " % (os.path.join(ro_root,path)))
344
			if os.path.exists(os.path.join(ro_root,path)):
345
				return os.path.join(ro_root,path)
346
			break
347
	
348
	# as a fallback make the string the same as it was originally.
349
	# even though this path doesn't exist.
350
	return os.path.join(EPREFIX,path)
351
352
264
def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
353
def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
265
	"""
354
	"""
266
	Takes an unreduced and reduced deplist and removes satisfied dependencies.
355
	Takes an unreduced and reduced deplist and removes satisfied dependencies.
Lines 571-577 Link Here
571
	assert(False) # This point should not be reachable
660
	assert(False) # This point should not be reachable
572
661
573
def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
662
def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
574
	use_cache=1, use_binaries=0, myroot=None, trees=None):
663
	use_cache=1, use_binaries=0, myroot=None, trees=None, dep_type=None):
575
	"""
664
	"""
576
	Takes a depend string, parses it, and selects atoms.
665
	Takes a depend string, parses it, and selects atoms.
577
	The myroot parameter is unused (use mysettings['EROOT'] instead).
666
	The myroot parameter is unused (use mysettings['EROOT'] instead).
Lines 667-672 Link Here
667
	writemsg("mysplit:  %s\n" % (mysplit), 1)
756
	writemsg("mysplit:  %s\n" % (mysplit), 1)
668
	writemsg("mysplit2: %s\n" % (mysplit2), 1)
757
	writemsg("mysplit2: %s\n" % (mysplit2), 1)
669
758
759
	if dep_type is not None:
760
		mysplit2=dep_wordreduce_readonly(unreduced=mysplit[:], 
761
			reduced=mysplit2, settings=mysettings, 
762
			dep_type=dep_type, parent=trees[myroot].get("disp_parent"))
763
764
		writemsg("\n", 1)
765
		writemsg("mysplit2 after readonly reduce: %s\n" % (mysplit2), 1)
766
670
	selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
767
	selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
671
		use_binaries=use_binaries, trees=trees)
768
		use_binaries=use_binaries, trees=trees)
672
769
(-)./prefix-portage-2.2.8/pym/portage/package/ebuild/config.py.orig (+50 lines)
Lines 296-301 Link Here
296
			self.features = features_set(self)
296
			self.features = features_set(self)
297
			self.features._features = copy.deepcopy(clone.features._features)
297
			self.features._features = copy.deepcopy(clone.features._features)
298
			self._features_overrides = copy.deepcopy(clone._features_overrides)
298
			self._features_overrides = copy.deepcopy(clone._features_overrides)
299
			self.readonly_roots = copy.deepcopy(clone.readonly_roots)
299
300
300
			#Strictly speaking _license_manager is not immutable. Users need to ensure that
301
			#Strictly speaking _license_manager is not immutable. Users need to ensure that
301
			#extract_global_changes() is called right after __init__ (if at all).
302
			#extract_global_changes() is called right after __init__ (if at all).
Lines 885-890 Link Here
885
886
886
			self._validate_commands()
887
			self._validate_commands()
887
888
889
			# expand READONLY_EPREFIX to a list of all readonly portage instances
890
			# all the way down to the last one. beware that ATM a deeper instance
891
			# in the chain can provide more than the toplevel! this means that
892
			# if you only inherit DEPENDS from one instance, that instance may
893
			# inherit RDEPENDs from another one, making the top-level instance
894
			# inherit RDEPENDs from there too - even if the intermediate prefix
895
			# does not do this.
896
			self.readonly_roots = {}
897
			my_ro_current_instance = config_root
898
			my_ro_widest_depset = set(['DEPEND', 'RDEPEND', 'PDEPEND'])
899
900
			while True:
901
				my_ro_current_make_conf_file = os.path.join(my_ro_current_instance,MAKE_CONF_FILE.lstrip(os.path.sep))
902
903
				if os.path.exists(my_ro_current_make_conf_file):
904
					my_ro_cfg = getconfig(my_ro_current_make_conf_file, tolerant=1)
905
					
906
					if my_ro_cfg.has_key("READONLY_EPREFIX"):
907
						if not my_ro_cfg["READONLY_EPREFIX"].find(":"):
908
							raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s" % (my_ro_current_make_conf_file))
909
910
						(my_ro_cfg_root,my_ro_cfg_root_deps) = my_ro_cfg["READONLY_EPREFIX"].rsplit(":",1)
911
912
						if not os.path.exists(my_ro_cfg_root):
913
							raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s: path does not exist!" % (my_ro_current_instance))
914
915
						if self.readonly_roots.has_key(my_ro_cfg_root):
916
							raise portage.exception.InvalidReadonlyERoot("ERROR: circular READONLY_EPREFIX's in %s. %s already checked for %s" % (my_ro_current_make_conf_file, my_ro_cfg_root, self.readonly_roots[my_ro_cfg_root]))
917
918
						if my_ro_cfg_root == config_root:
919
							raise portage.exception.InvalidReadonlyERoot("ERROR: cannot add this instance as READONLY_EPREFIX in %s." % (my_ro_current_make_conf_file))
920
921
						# intersect the widest depset with the current one to strip down
922
						# the allowed dependency resolution to not be wider than the
923
						# next higher one. this way we can prevent for a given prefix
924
						# to resolve RDEPENDs from a prefix with a different CHOST that
925
						# is a few levels deeper in the chain.
926
						my_ro_widest_depset = set(my_ro_cfg_root_deps.split(",")) & my_ro_widest_depset
927
						self.readonly_roots[my_ro_cfg_root] = my_ro_widest_depset
928
						my_ro_current_instance = my_ro_cfg_root
929
						continue
930
931
				break
932
933
888
			for k in self._case_insensitive_vars:
934
			for k in self._case_insensitive_vars:
889
				if k in self:
935
				if k in self:
890
					self[k] = self[k].lower()
936
					self[k] = self[k].lower()
Lines 2658-2663 Link Here
2658
		if not eapi_exports_merge_type(eapi):
2704
		if not eapi_exports_merge_type(eapi):
2659
			mydict.pop("MERGE_TYPE", None)
2705
			mydict.pop("MERGE_TYPE", None)
2660
2706
2707
		# populate with PORTAGE_READONLY_EPREFIXES
2708
		if self.readonly_roots and len(self.readonly_roots) > 0:
2709
			mydict["PORTAGE_READONLY_EPREFIXES"] = ':'.join(self.readonly_roots)
2710
2661
		# Prefix variables are supported beginning with EAPI 3, or when
2711
		# Prefix variables are supported beginning with EAPI 3, or when
2662
		# force-prefix is in FEATURES, since older EAPIs would otherwise be
2712
		# force-prefix is in FEATURES, since older EAPIs would otherwise be
2663
		# useless with prefix configurations. This brings compatibility with
2713
		# useless with prefix configurations. This brings compatibility with
(-)./prefix-portage-2.2.8/pym/portage/dbapi/vartree.py.orig (-4 / +28 lines)
Lines 181-188 Link Here
181
		self._counter_path = os.path.join(self._eroot,
181
		self._counter_path = os.path.join(self._eroot,
182
			CACHE_PATH, "counter")
182
			CACHE_PATH, "counter")
183
183
184
		plibreg_path = os.path.join(self.root, PRIVATE_PATH, "preserved_libs_registry")
185
186
		if vartree:
187
			self._kill_eprefix = vartree._kill_eprefix
188
		else:
189
			self._kill_eprefix = False
190
191
		if self._kill_eprefix:
192
			self._aux_cache_filename = os.path.join(self.root, self._aux_cache_filename.replace(EPREFIX, ""))
193
			self._counter_path = os.path.join(self.root, self._counter_path.replace(EPREFIX, ""))
194
			plibreg_path = os.path.join(self.root, plibreg_path.replace(EPREFIX, ""))
195
184
		self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
196
		self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
185
			os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"))
197
			os.path.join(self._eroot, plibreg_path))
186
		self._linkmap = LinkageMap(self)
198
		self._linkmap = LinkageMap(self)
187
		chost = self.settings.get('CHOST')
199
		chost = self.settings.get('CHOST')
188
		if not chost:
200
		if not chost:
Lines 212-217 Link Here
212
		# This is an optimized hotspot, so don't use unicode-wrapped
224
		# This is an optimized hotspot, so don't use unicode-wrapped
213
		# os module and don't use os.path.join().
225
		# os module and don't use os.path.join().
214
		rValue = self._eroot + VDB_PATH + _os.sep + mykey
226
		rValue = self._eroot + VDB_PATH + _os.sep + mykey
227
		if self._kill_eprefix:
228
			rValue = rValue.replace(EPREFIX, "")
229
215
		if filename is not None:
230
		if filename is not None:
216
			# If filename is always relative, we can do just
231
			# If filename is always relative, we can do just
217
			# rValue += _os.sep + filename
232
			# rValue += _os.sep + filename
Lines 528-537 Link Here
528
			return list(self._iter_match(mydep,
543
			return list(self._iter_match(mydep,
529
				self.cp_list(mydep.cp, use_cache=use_cache)))
544
				self.cp_list(mydep.cp, use_cache=use_cache)))
530
		try:
545
		try:
546
			_tmp_path = os.path.join(self.root, VDB_PATH, mycat)
547
			
548
			if self._kill_eprefix:
549
				_tmp_path = os.path.join(self.root, _tmp_path.replace(EPREFIX, ""))
531
			if sys.hexversion >= 0x3030000:
550
			if sys.hexversion >= 0x3030000:
532
				curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime_ns
551
				curmtime = os.stat(_tmp_path).st_mtime_ns
533
			else:
552
			else:
534
				curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime
553
				curmtime = os.stat(_tmp_path).st_mtime
535
		except (IOError, OSError):
554
		except (IOError, OSError):
536
			curmtime=0
555
			curmtime=0
537
556
Lines 1319-1325 Link Here
1319
class vartree(object):
1338
class vartree(object):
1320
	"this tree will scan a var/db/pkg database located at root (passed to init)"
1339
	"this tree will scan a var/db/pkg database located at root (passed to init)"
1321
	def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
1340
	def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
1322
		settings=None):
1341
		settings=None, kill_eprefix=False):
1323
1342
1324
		if settings is None:
1343
		if settings is None:
1325
			settings = portage.settings
1344
			settings = portage.settings
Lines 1338-1343 Link Here
1338
				DeprecationWarning, stacklevel=2)
1357
				DeprecationWarning, stacklevel=2)
1339
1358
1340
		self.settings = settings
1359
		self.settings = settings
1360
		self._kill_eprefix = kill_eprefix
1341
		self.dbapi = vardbapi(settings=settings, vartree=self)
1361
		self.dbapi = vardbapi(settings=settings, vartree=self)
1342
		self.populated = 1
1362
		self.populated = 1
1343
1363
Lines 1377-1382 Link Here
1377
			raise
1397
			raise
1378
		except Exception as e:
1398
		except Exception as e:
1379
			mydir = self.dbapi.getpath(mycpv)
1399
			mydir = self.dbapi.getpath(mycpv)
1400
1401
			if self._kill_eprefix:
1402
				mydir = os.path.join(self.root, mydir.replace(EPREFIX, ""))
1403
1380
			writemsg(_("\nParse Error reading PROVIDE and USE in '%s'\n") % mydir,
1404
			writemsg(_("\nParse Error reading PROVIDE and USE in '%s'\n") % mydir,
1381
				noiselevel=-1)
1405
				noiselevel=-1)
1382
			if mylines:
1406
			if mylines:
(-)./prefix-portage-2.2.8/bin/ebuild.sh.orig (+77 lines)
Lines 107-112 Link Here
107
# Unset some variables that break things.
107
# Unset some variables that break things.
108
unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
108
unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
109
109
110
if [[ -n "${PORTAGE_READONLY_EPREFIXES}" ]]; then
111
	new_PATH=${PATH}
112
113
	prefixes="${PORTAGE_READONLY_EPREFIXES}:${EPREFIX}"
114
115
	# build up a PATH for the current environment. the path has to
116
	# contain all the paths the start with $EPREFIX _first_, and
117
	# after that, all the others. We have to re-order the new_PATH,
118
	# so that EPREFIX paths move to the front. after that, the paths
119
	# of all parent prefixes are added, and finally, after that, the
120
	# paths not containing any prefix are added.
121
122
	save_IFS=$IFS
123
	IFS=':'
124
	pth_pfx=
125
	pth_nopfx=
126
	for pth in ${new_PATH}; do
127
		IFS=$save_IFS
128
		if [[ "${pth#${EPREFIX}}" == "${pth}" ]]; then
129
			[[ ":${pth_nopfx}:" == *":${pth}:"* ]] && continue
130
			if [[ -z "${pth_nopfx}" ]]; then
131
				pth_nopfx="${pth}"
132
			else
133
				pth_nopfx="${pth_nopfx}:${pth}"
134
			fi
135
		else
136
			[[ ":${pth_pfx}:" == *":${pth}:"* ]] && continue
137
			if [[ -z "${pth_pfx}" ]]; then
138
				pth_pfx="${pth}"
139
			else
140
				pth_pfx="${pth_pfx}:${pth}"
141
			fi
142
		fi
143
	done
144
	IFS=$save_IFS
145
146
	new_PATH=
147
148
	save_IFS=$IFS
149
	IFS=':'
150
	for eroot in ${prefixes}; do
151
		IFS=$save_IFS
152
		if [[ -f ${eroot}/usr/share/portage/config/make.globals ]]; then
153
			# ok, there is a portage instance installed in this prefix,
154
			# so we can ask (politely) for the DEFAULT_PATH of it :)
155
156
			defpath="$(. ${eroot}/etc/make.globals && echo $DEFAULT_PATH)"
157
			okpath=
158
			save_IFS2=$IFS
159
			IFS=':'
160
			for p in $defpath; do
161
				IFS=$save_IFS2
162
				# we have that one already...
163
				[[ ":${new_PATH}:" == *":$p:"* ]] && continue
164
				# we skip paths, that are outside our prefix ...
165
				[[ "${p#${eroot}}" == "${p}" ]] && continue
166
				if [[ -z "${okpath}" ]]; then
167
					okpath="${p}"
168
				else
169
					okpath="${okpath}:${p}"
170
				fi
171
			done
172
			IFS=$save_IFS2
173
174
			new_PATH="${okpath}:${new_PATH}"
175
		else
176
			# no portage installed in this prefix. this means we have to
177
			# somehow fiddle together a sane path for that prefix for at
178
			# least the standard things to work.
179
			new_PATH="${eroot}/usr/bin:${eroot}/usr/sbin:${eroot}/bin:${eroot}/sbin:${new_PATH}"
180
		fi
181
	done
182
	IFS=$save_IFS
183
184
	export PATH=${pth_pfx}:$new_PATH:${pth_nopfx}
185
fi
186
110
[[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
187
[[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
111
188
112
# sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
189
# sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)

Return to bug 509136