From 16036759ddb02a6ad56afaedbce90f5548346c01 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 25 Apr 2006 03:42:44 +0000 Subject: Move ACCEPT_KEYWORDS and PORTAGE_ARCHLIST validation from global scope to the config class. svn path=/main/trunk/; revision=3221 --- pym/portage.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'pym/portage.py') diff --git a/pym/portage.py b/pym/portage.py index 7dd659bfe..1dc1a999c 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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={} -- cgit v1.2.3-1-g7c22