Move ACCEPT_KEYWORDS and PORTAGE_ARCHLIST validation from global scope to the config...
authorZac Medico <zmedico@gentoo.org>
Tue, 25 Apr 2006 03:42:44 +0000 (03:42 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 25 Apr 2006 03:42:44 +0000 (03:42 -0000)
svn path=/main/trunk/; revision=3221

pym/portage.py

index 7dd659bfedd1d4e3e1740f1cc1c595c4395c8812..1dc1a999c4bd8d8b12b374f7187b96c632f56a63 100644 (file)
@@ -1263,6 +1263,15 @@ class config:
                        self["CBUILD"] = self["CHOST"]
                        self.backup_changes("CBUILD")
 
+               groups = self["ACCEPT_KEYWORDS"].split()
+               archlist = self.archlist()
+               if not archlist:
+                       writemsg("--- 'profiles/arch.list' is empty or not available. Empty portage tree?\n")
+               else:
+                       for group in groups:
+                               if group not in archlist and group[0] != '-':
+                                       writemsg("!!! INVALID ACCEPT_KEYWORDS: %s\n" % str(group))
+
                if mycpv:
                        self.setcpv(mycpv)
 
@@ -1651,6 +1660,10 @@ class config:
                thirdparty_lists = [grabdict(os.path.join(x, "thirdpartymirrors")) for x in profileroots]
                return stack_dictlist(thirdparty_lists, incremental=True)
 
+       def archlist(self):
+               return flatten([[myarch, "~" + myarch] \
+                       for myarch in self["PORTAGE_ARCHLIST"].split()])
+
 # XXX This would be to replace getstatusoutput completely.
 # XXX Issue: cannot block execution. Deadlock condition.
 def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,sesandbox=0,fd_pipes=None,**keywords):
@@ -6850,14 +6863,7 @@ if not os.path.isdir(settings["PORTAGE_TMPDIR"]):
 pkglines = settings.packages
 
 groups = settings["ACCEPT_KEYWORDS"].split()
-archlist = flatten([[myarch, "~"+myarch] for myarch in settings["PORTAGE_ARCHLIST"].split()])
-
-for group in groups:
-       if not archlist:
-               writemsg("--- 'profiles/arch.list' is empty or not available. Empty portage tree?\n")
-               break
-       elif (group not in archlist) and group[0]!='-':
-               writemsg("\n"+red("!!! INVALID ACCEPT_KEYWORDS: ")+str(group)+"\n")
+archlist = settings.archlist()
 
 # Clear the cache
 dircache={}