Hi,

I'm currently working on a project that involve distribution of a
custom profile for portage. I've recently switched it to cascading
whereas it was flat before. No doubt that's much more convenient,
but i still have a problem for the "parent" file. What i would
like is a way to make it reference "default-linux/ppc/2004.3",
wherever the user install my profile and wherever his portage tree
actually is.

That has already briefly been discussed on gentoo-dev, but the
question was left opened:
http://thread.gmane.org/gmane.linux.gentoo.devel/23508

My idea was be to make portage support parent files with paths
like "${PORTDIR}/profiles/default-linux/ppc/2004.3". Currently,
that doesn't work for two reasons:
 - absolute paths are not supported, but that's really a one line
change to fix it (see attached patch for a possible solution) 
 - the "${PORTDIR}" should be evaluated to "/usr/portage" or
something else depending if the user changed it in his make.conf. 
The portage_utils.py "varexpand()" function seems to be a good
candidate for that task, but the problem is that when the profiles
list is built, $PORTDIR value is not known yet (the obvious
reason being that it can be defined and redefined by profiles,
so that's basically a chicken and egg dilemma).

So, does anyone has ideas on how parent's handling could be
modified so that it's possible to distribute custom profiles that
work for everybody? (if possible without hacks like requirering
that the user has a symlink to his portage tree at a well known
place or things like that)

Thanks,

-- 
TGL.
--- portage.py.orig	2005-02-20 23:13:30.201099264 +0100
+++ portage.py	2005-02-21 00:02:42.062348144 +0100
@@ -913,9 +913,18 @@
 
 			mypath = self.profiles[0]
 			while os.path.exists(mypath+"/parent"):
-				mypath = os.path.normpath(mypath+"///"+grabfile(mypath+"/parent")[0])
+				mypath = os.path.normpath(os.path.join(mypath,grabfile(mypath+"/parent")[0]))
+				if mypath in self.profiles:
+					writemsg("!!! There is a loop in your cascading profiles!\n")
+					writemsg("!!! Please check your \"parent\" files. Profiles list:\n")
+					for myprofilepath in self.profiles[::-1]:
+						writemsg("!!! "+myprofilepath+"\n")
+					break
 				if os.path.exists(mypath):
 					self.profiles.insert(0,mypath)
+				else:
+					writemsg("!!! Parent profile does not exists: "+mypath+"\n")
+					writemsg("!!! Ignoring.\n")
 
 			if os.environ.has_key("PORTAGE_CALLER") and os.environ["PORTAGE_CALLER"] == "repoman":
 				pass

--
[email protected] mailing list

Reply via email to