diff options
author | Marius Mauch <genone@gentoo.org> | 2008-09-28 16:08:50 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2008-09-28 16:08:50 +0000 |
commit | 918421b4cd656cae82476b17682f3300020687bf (patch) | |
tree | 06bd47b0e6ffa791905e27663464b57259d715f6 /pym/portage | |
parent | c0d0d98f99d8473e6f82ab77bb42ebaba07d4072 (diff) | |
download | portage-918421b4cd656cae82476b17682f3300020687bf.tar.gz portage-918421b4cd656cae82476b17682f3300020687bf.tar.bz2 portage-918421b4cd656cae82476b17682f3300020687bf.zip |
implement set arguments to reconfigure and create package sets on the commandline
svn path=/main/trunk/; revision=11581
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/sets/__init__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index f88e1b6ee..8e6a0ea86 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -33,6 +33,29 @@ class SetConfig(SafeConfigParser): self._parsed = False self.active = [] + def update(self, setname, options): + self.errors = [] + if not setname in self.psets: + options["name"] = setname + + # for the unlikely case that there is already a section with the requested setname + import random + while setname in self.sections(): + setname = "%08d" % random.randint(0, 10**10) + + self.add_section(setname) + for k, v in options.items(): + self.set(setname, k, v) + else: + section = self.psets[setname].creator + if self.has_option(section, "multiset") and self.getboolean(section, "multiset"): + self.errors.append("Invalid request to reconfigure set '%s' generated by multiset section '%s'" % (setname, section)) + return + for k, v in options.items(): + self.set(section, k, v) + self._parsed = False + self._parse() + def _parse(self): if self._parsed: return |