[gentoo-portage-dev] prefix portage chaining

2009-03-20 Thread Markus Duft
Hey guys :)

Just wanted to stop by and get some opinions on a patch i wrote for the
prefix branch.

i'll try and explain what i want in the first place: i'm porting things
to native windows. since windows isn't too cooperative, i'm unable to
merge most things (and with other things, i simply don't want to), and
thus i need to take those things from somewhere else (more or less the
complete @system). I _am_ able to build all those things for interix
(which is the host system in the windows case). So what i want is a
setup of two prefix instances with a certain relation to each other: the
native windows prefix should be able to recognize installed packages
from the other instance, and resolve dependencies by eventually using
the other .../var/db/...

This could be (and is) quite usefull for all other platforms too. For
exmaple i could use prefix chaining on a linux box. I could create a
prefix containing a base system, and then for testing of
i-don't-know-whatever, i could create another small prefix inheriting
all installed packages from the other one. this way new prefixes can
stay very slim, but still the parent prefix is not altered on merges.

one issue not handled by the current patch is, that prefixes can have
different CHOST/ARCH/... (which is the case with x86-interix and
x86-winnt for example).

another thing is, that i plan to add some output in the merge list,
telling the user, which packages have been readonly-resolved from
another portage instance. right now the dependency is treated as if it
didn't exist.

all together, i'm pretty sure i did the one or the other forbidden thing
in my patch, but that's why i'm asking the guys-who-know :) it was hard
enough to read the portage source and get where i am, so i'm happy with
the result ;)

Waiting for comments, suggestions, etc.

Thanks in advance,
Cheers, Markus




Re: [gentoo-portage-dev] prefix portage chaining

2009-03-20 Thread Markus Duft
On Fri, 2009-03-20 at 11:35 +0100, Markus Duft wrote:
 Hey guys :)
 
 Just wanted to stop by and get some opinions on a patch i wrote for the
 prefix branch.

argh... managed to fail to attach the patch _again_ :) at least i
managed to add the output stuff i mentioned before to the patch in the
meantime. so this patch should be pretty much complete.

Thanks and Cheers, Markus

 
 i'll try and explain what i want in the first place: i'm porting things
 to native windows. since windows isn't too cooperative, i'm unable to
 merge most things (and with other things, i simply don't want to), and
 thus i need to take those things from somewhere else (more or less the
 complete @system). I _am_ able to build all those things for interix
 (which is the host system in the windows case). So what i want is a
 setup of two prefix instances with a certain relation to each other: the
 native windows prefix should be able to recognize installed packages
 from the other instance, and resolve dependencies by eventually using
 the other .../var/db/...
 
 This could be (and is) quite usefull for all other platforms too. For
 exmaple i could use prefix chaining on a linux box. I could create a
 prefix containing a base system, and then for testing of
 i-don't-know-whatever, i could create another small prefix inheriting
 all installed packages from the other one. this way new prefixes can
 stay very slim, but still the parent prefix is not altered on merges.
 
 one issue not handled by the current patch is, that prefixes can have
 different CHOST/ARCH/... (which is the case with x86-interix and
 x86-winnt for example).
 
 another thing is, that i plan to add some output in the merge list,
 telling the user, which packages have been readonly-resolved from
 another portage instance. right now the dependency is treated as if it
 didn't exist.
 
 all together, i'm pretty sure i did the one or the other forbidden thing
 in my patch, but that's why i'm asking the guys-who-know :) it was hard
 enough to read the portage source and get where i am, so i'm happy with
 the result ;)
 
 Waiting for comments, suggestions, etc.
 
 Thanks in advance,
 Cheers, Markus
 
 
diff -ru portage.orig/pym/_emerge/__init__.py portage/pym/_emerge/__init__.py
--- portage.orig/pym/_emerge/__init__.py	2009-03-18 10:13:34.0 +0100
+++ portage/pym/_emerge/__init__.py	2009-03-20 12:08:49.0 +0100
@@ -49,7 +49,7 @@
 import portage.xpak, commands, errno, re, socket, time
 from portage.output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \
 	nc_len, red, teal, turquoise, xtermTitle, \
-	xtermTitleReset, yellow
+	xtermTitleReset, yellow, purple
 from portage.output import create_color_func
 good = create_color_func(GOOD)
 bad = create_color_func(BAD)
@@ -69,6 +69,7 @@
 from portage.util import cmp_sort_key, writemsg, writemsg_level
 from portage.sets import load_default_config, SETPREFIX
 from portage.sets.base import InternalPackageSet
+from portage.dbapi.vartree import vartree
 
 from itertools import chain, izip
 
@@ -4692,6 +4693,7 @@
 		self._unsatisfied_deps_for_display = []
 		self._unsatisfied_blockers_for_display = None
 		self._circular_deps_for_display = None
+		self._injected_readonly_deps_for_display = []
 		self._dep_stack = []
 		self._unsatisfied_deps = []
 		self._initially_unsatisfied_deps = []
@@ -5270,18 +5272,35 @@
 		if removal_action and self.myopts.get(--with-bdeps, y) == n:
 			edepend[DEPEND] = 
 
+		# MDUFT: create additional vartrees for every readonly root here
+		# (maybe FakeVartree's?). Then below search those trees and set
+		# mypriority.satisfied to True.
+		# the ro_vartrees instances are created below as they are needed to
+		# avoid reading vartrees of portage instances which aren't required
+		# while resolving this dependencies.
+		ro_trees = {}
+		ro_vartrees = {}
+		
+		for type in (DEPEND,RDEPEND, PDEPEND):
+			ro_trees[type] = []
+			
+			for ro_root, ro_dep_types in self.settings.readonly_roots.items():
+if type in ro_dep_types:
+	ro_trees[type].append(ro_root)
+
 		deps = (
-			(/, edepend[DEPEND],
+			(/, DEPEND,
 self._priority(buildtime=(not bdeps_optional),
 optional=bdeps_optional)),
-			(myroot, edepend[RDEPEND], self._priority(runtime=True)),
-			(myroot, edepend[PDEPEND], self._priority(runtime_post=True))
+			(myroot, RDEPEND, self._priority(runtime=True)),
+			(myroot, PDEPEND, self._priority(runtime_post=True))
 		)
 
 		debug = --debug in self.myopts
 		strict = mytype != installed
 		try:
-			for dep_root, dep_string, dep_priority in deps:
+			for dep_root, dep_type, dep_priority in deps:
+dep_string = edepend[dep_type]
 if not dep_string:
 	continue
 if debug:
@@ -5309,6 +5328,32 @@
 		if not atom.blocker and vardb.match(atom):
 			mypriority.satisfied = True
 
+		# MDUFT: How erver we do it - if we find atom beeing installed
+		# in a valid readonly root for the current dependency type, then
+		# _DONT_ call the