diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-10-05 22:46:07 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-10-05 22:46:07 +0000 |
commit | 64aa363c8a7b19303cd6ca5f54a0c114e50b74c7 (patch) | |
tree | ca35b7fc420ba03c1ea9a6a9a4fc6ce8e5c5208a | |
parent | cd6cd22a2953ab4601affb30c99ae6617a42422e (diff) | |
download | portage-64aa363c8a7b19303cd6ca5f54a0c114e50b74c7.tar.gz portage-64aa363c8a7b19303cd6ca5f54a0c114e50b74c7.tar.bz2 portage-64aa363c8a7b19303cd6ca5f54a0c114e50b74c7.zip |
* Add default ACCEPT_LICENSE and ACCEPT_PROPERTIES values in make.globals.
* Set default values if missing from make.globals.
* Only warn once if a given license group is missing.
* Prune off any parts of an ACCEPT_LICENSE and ACCEPT_PROPERTIES that are
made irrelevant by the latest occuring * or -* wildcard.
svn path=/main/trunk/; revision=14496
-rw-r--r-- | cnf/make.globals | 3 | ||||
-rw-r--r-- | pym/portage/__init__.py | 51 |
2 files changed, 42 insertions, 12 deletions
diff --git a/cnf/make.globals b/cnf/make.globals index 4693e2062..892d054f6 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -24,6 +24,9 @@ SYNC="rsync://rsync.gentoo.org/gentoo-portage" # Default distfiles mirrors GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" +ACCEPT_LICENSE="* -@EULA" +ACCEPT_PROPERTIES="*" + # Repository Paths PORTDIR=/usr/portage DISTDIR=/usr/portage/distfiles diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index d44cad8ac..8969db3e0 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1479,6 +1479,12 @@ class config(object): _environ_filter = frozenset(_environ_filter) + _undef_lic_groups = set() + _default_globals = ( + ('ACCEPT_LICENSE', '* -@EULA'), + ('ACCEPT_PROPERTIES', '*'), + ) + def __init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, local_config=True, env=None): @@ -1872,6 +1878,9 @@ class config(object): if self.mygcfg is None: self.mygcfg = {} + for k, v in self._default_globals: + self.mygcfg.setdefault(k, v) + self.configlist.append(self.mygcfg) self.configdict["globals"]=self.configlist[-1] @@ -2270,8 +2279,11 @@ class config(object): else: rValue.extend(self._expandLicenseToken(l, traversed_groups)) else: - writemsg(_("Undefined license group '%s'\n") % group_name, - noiselevel=-1) + if self._license_groups and \ + group_name not in self._undef_lic_groups: + self._undef_lic_groups.add(group_name) + writemsg(_("Undefined license group '%s'\n") % group_name, + noiselevel=-1) rValue.append("@"+group_name) if negate: rValue = ["-" + token for token in rValue] @@ -3003,8 +3015,6 @@ class config(object): @rtype: List @return: A list of licenses that have not been accepted. """ - if not self._accept_license: - return [] accept_license = self._accept_license cpdict = self._plicensedict.get(dep_getkey(cpv), None) if cpdict: @@ -3084,8 +3094,6 @@ class config(object): @rtype: List @return: A list of properties that have not been accepted. """ - if not self._accept_properties: - return [] accept_properties = self._accept_properties cpdict = self._ppropertiesdict.get(dep_getkey(cpv), None) if cpdict: @@ -3236,6 +3244,25 @@ class config(object): # env_d will be None if profile.env doesn't exist. self.configdict["env.d"].update(env_d) + def _prune_incremental(self, split): + """ + Prune off any parts of an incremental variable that are + made irrelevant by the latest occuring * or -*. This + could be more aggressive but that might be confusing + and the point is just to reduce noise a bit. + """ + for i, x in enumerate(reversed(split)): + if x == '*': + split = split[-i-1:] + break + elif x == '-*': + if i == 0: + split = [] + else: + split = split[-i:] + break + return split + def regenerate(self,useonly=0,use_cache=1): """ Regenerate settings @@ -3287,28 +3314,28 @@ class config(object): mysplit = [] for curdb in mydbs: mysplit.extend(curdb.get('ACCEPT_LICENSE', '').split()) + mysplit = self._prune_incremental(mysplit) accept_license_str = ' '.join(mysplit) - if accept_license_str: - self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str + self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str if accept_license_str != self._accept_license_str: self._accept_license_str = accept_license_str self._accept_license = tuple(self.expandLicenseTokens(mysplit)) else: # repoman will accept any license - self._accept_license = () + self._accept_license = ('*',) # ACCEPT_PROPERTIES works like ACCEPT_LICENSE, without groups if self.local_config: mysplit = [] for curdb in mydbs: mysplit.extend(curdb.get('ACCEPT_PROPERTIES', '').split()) - if mysplit: - self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit) + mysplit = self._prune_incremental(mysplit) + self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit) if tuple(mysplit) != self._accept_properties: self._accept_properties = tuple(mysplit) else: # repoman will accept any property - self._accept_properties = () + self._accept_properties = ('*',) for mykey in myincrementals: |