[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2018-03-29 Thread Brian Dolbec
commit: 4333abb4c54ba81b1622c3cd951ae8aacf8e4560
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:46 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4333abb4

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index c79e65518..bd7c94d4e 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' is invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2018-03-29 Thread Brian Dolbec
commit: 1dd08a1ed5ad1b848a30f29f93a3b051c8bf95c4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 29 20:43:40 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1dd08a1e

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index c79e65518..bd7c94d4e 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' is invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-12-05 Thread Brian Dolbec
commit: 12f83daec005e3004a249b2e2ad600e47ae2c496
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec  6 00:13:28 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=12f83dae

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index c79e65518..bd7c94d4e 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' is invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-12-05 Thread Brian Dolbec
commit: 687f87be15129b06e761c996478e8ea4a7b6fc82
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Dec  5 18:24:49 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=687f87be

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index 00f322387..f5116b6f5 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-11-26 Thread Brian Dolbec
commit: 94b1d9fd4b903ee2e6c1f6e34275d6b3df6a7bf3
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Nov 26 17:32:21 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=94b1d9fd

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index 00f322387..f5116b6f5 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-09-11 Thread Brian Dolbec
commit: 4cdcaf7ffc9a03e5113f76e7f7860275615166c5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 11 16:13:17 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4cdcaf7f

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index 00f322387..f5116b6f5 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-08-16 Thread Brian Dolbec
commit: 927465611c1e01c945d0d131325f7e6d3eebbcc2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:50:21 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Aug 17 01:57:47 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=92746561

module.py: Extend the module loader for API version checking

If provided with an iterable of compatibility versions, The controller
will check the plugin modules module_spec 'version' variable is
compatible with the base application.

 pym/portage/module.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index 00f322387..f5116b6f5 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -15,6 +15,10 @@ class InvalidModuleName(PortageException):
"""An invalid or unknown module name."""
 
 
+class ModuleVersionError(PortageException):
+   '''An incompatible module version'''
+
+
 class Module(object):
"""Class to define and hold our plug-in module
 
@@ -87,16 +91,17 @@ class Modules(object):
@param namepath: Python import path to the "modules" directory
"""
 
-   def __init__(self, path, namepath):
+   def __init__(self, path, namepath, compat_versions=None):
self._module_path = path
self._namepath = namepath
+   self.compat_versions = compat_versions
self.parents = []
self._modules = self._get_all_modules()
self.modules = ProtectedDict(self._modules)
self.module_names = sorted(self._modules)
 
def _get_all_modules(self):
-   """scans the emaint modules dir for loadable modules
+   """scans the _module_path dir for loadable modules
 
@rtype: dictionary of module_plugins
"""
@@ -117,6 +122,7 @@ class Modules(object):
kids = {}
for entry in importables:
new_module = Module(entry, self._namepath)
+   self._check_compat(new_module)
for module_name in new_module.kids:
kid = new_module.kids[module_name]
kid['parent'] = new_module
@@ -211,6 +217,8 @@ class Modules(object):
 
@type modname: string
@param modname: the module class name
+   @type var: string
+   @param var: the base level variable to return
@type dictionary
@return: the modules class exported options descriptions
"""
@@ -220,3 +228,13 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return value
+
+   def _check_compat(self, module):
+   if self.compat_versions:
+   if not module.module_spec['version'] in 
self.compat_versions:
+   raise ModuleVersionError(
+   "Error loading '%s' plugin module: %s, 
version: %s\n"
+   "Module is not compatible with the 
current application version\n"
+   "Compatible module API versions are: %s"
+   % (self._namepath, 
module.module_spec['name'],
+   module.module_spec['version'], 
self.compat_versions))



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-07-10 Thread Brian Dolbec
commit: 63a77a1790c357625d92a1a18693480ccfbb7cde
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 17:29:05 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:33 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=63a77a17

portage/module.py: Add a generic get_spec()

This new function gets any arbitrary spec value.
The other get_* functions could be optimized to return the
get_spec result instead.  This would reduce code duplication.

 pym/portage/module.py | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index f9828a518..00f322387 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -205,3 +205,18 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return desc
+
+   def get_spec(self, modname, var):
+   """Retrieves the module class exported spec variable
+
+   @type modname: string
+   @param modname: the module class name
+   @type dictionary
+   @return: the modules class exported options descriptions
+   """
+   if modname and modname in self.module_names:
+   value = self._modules[modname].get(var, None)
+   else:
+   raise InvalidModuleName(
+   "Module name '%s' was invalid or not found" % 
modname)
+   return value



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-07-10 Thread Brian Dolbec
commit: a9da39a81f0469ab7e2086b3225c45ad5def25a1
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 17:29:05 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 17:50:19 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9da39a8

portage/module.py: Add a generic get_spec()

This new function gets any arbitrary spec value.
The other get_* functions could be optimized to return the
get_spec result instead.  This would reduce code duplication.

 pym/portage/module.py | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index f9828a518..00f322387 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -205,3 +205,18 @@ class Modules(object):
raise InvalidModuleName(
"Module name '%s' was invalid or not found" % 
modname)
return desc
+
+   def get_spec(self, modname, var):
+   """Retrieves the module class exported spec variable
+
+   @type modname: string
+   @param modname: the module class name
+   @type dictionary
+   @return: the modules class exported options descriptions
+   """
+   if modname and modname in self.module_names:
+   value = self._modules[modname].get(var, None)
+   else:
+   raise InvalidModuleName(
+   "Module name '%s' was invalid or not found" % 
modname)
+   return value



[gentoo-commits] proj/portage:repoman commit in: pym/portage/sync/modules/git/, man/

2017-06-27 Thread Brian Dolbec
commit: 8aa1a070921dc643d615a3c38b4f60e55e709850
Author: Manuel Rüger  gentoo  org>
AuthorDate: Fri May 26 11:59:27 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jun  6 01:56:05 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8aa1a070

GitSync: Support setting environment variables for git

This can be used to provide private SSH keys to portage in order to
clone repositories from a non-public repository.

An exemplary usage would be setting this in the repositories' repos.conf:
sync-git-env = "GIT_SSH_COMMAND=ssh -i /etc/portage/.ssh/id_rsa -o 
UserKnownHostsFile=/etc/portage/.ssh/known_hosts" GIT_TRACE=false
sync-git-pull-env = "GIT_SSH_COMMAND=ssh -i /etc/portage/.ssh/id_rsa -o 
UserKnownHostsFile=/etc/portage/.ssh/known_hosts" GIT_TRACE=true
sync-git-clone-env = "GIT_SSH_COMMAND=ssh -i /etc/portage/.ssh/id_rsa -o 
UserKnownHostsFile=/etc/portage/.ssh/known_hosts" GIT_TRACE=true

Closes: https://github.com/gentoo/portage/pull/165
Acked-by: Brian Dolbec  gentoo.org>

 man/portage.5| 24 +++-
 pym/portage/sync/modules/git/__init__.py |  5 -
 pym/portage/sync/modules/git/git.py  | 24 ++--
 3 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/man/portage.5 b/man/portage.5
index 366a1fa85..5f1f2bbb0 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1,4 +1,4 @@
-.TH "PORTAGE" "5" "Jan 2017" "Portage VERSION" "Portage"
+.TH "PORTAGE" "31" "May 2017" "Portage VERSION" "Portage"
 .SH NAME
 portage \- the heart of Gentoo
 .SH "DESCRIPTION"
@@ -979,9 +979,31 @@ Specifies CVS repository.
 .B sync\-depth
 This is a deprecated alias for the \fBclone\-depth\fR option.
 .TP
+.B sync\-git\-clone\-env
+Set environment variables for git when cloning repository (git clone).
+This will override settings from sync-git-env.
+.RS
+.TP
+.I Example:
+sync-git-clone-env="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
+.br
+Gives three variables "VAR1", "VAR2", "VAR3" with the values "word1 word2",
+"word3", "$word 5 6".
+.RE
+.TP
 .B sync\-git\-clone\-extra\-opts
 Extra options to give to git when cloning repository (git clone).
 .TP
+.B sync\-git\-env
+Set environment variables for git when cloning or pulling the repository.
+These will be overridden by setting them again in sync-git-clone-env and 
sync-git-pull-env.
+See also example for sync-git-clone-env.
+.TP
+.B sync\-git\-pull\-env
+Set environment variables for git when updating repository (git pull).
+This will override settings from sync-git-env.
+See also example for sync-git-clone-env.
+.TP
 .B sync\-git\-pull\-extra\-opts
 Extra options to give to git when updating repository (git pull).
 .TP

diff --git a/pym/portage/sync/modules/git/__init__.py 
b/pym/portage/sync/modules/git/__init__.py
index 60b7395b8..e7206e12d 100644
--- a/pym/portage/sync/modules/git/__init__.py
+++ b/pym/portage/sync/modules/git/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2014 Gentoo Foundation
+# Copyright 2014-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 doc = """Git plug-in module for portage.
@@ -52,7 +52,10 @@ module_spec = {
},
'validate_config': CheckGitConfig,
'module_specific_options': (
+   'sync-git-clone-env',
'sync-git-clone-extra-opts',
+   'sync-git-env',
+   'sync-git-pull-env',
'sync-git-pull-extra-opts',
),
}

diff --git a/pym/portage/sync/modules/git/git.py 
b/pym/portage/sync/modules/git/git.py
index d432886dd..bea79c7e7 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -1,4 +1,4 @@
-# Copyright 2005-2015 Gentoo Foundation
+# Copyright 2005-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import logging
@@ -6,7 +6,7 @@ import subprocess
 
 import portage
 from portage import os
-from portage.util import writemsg_level
+from portage.util import writemsg_level, shlex_split
 from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
@@ -50,6 +50,16 @@ class GitSync(NewBase):
sync_uri = sync_uri[6:]
 
git_cmd_opts = ""
+   if self.repo.module_specific_options.get('sync-git-env'):
+   shlexed_env = 
shlex_split(self.repo.module_specific_options['sync-git-env'])
+   env = dict((k, v) for k, _, v in 
(assignment.partition('=') for assignment in shlexed_env) if k)
+   self.spawn_kwargs['env'].update(env)
+
+   if self.repo.module_specific_options.get('sync-git-clone-env'):
+   shlexed_env = 

[gentoo-commits] proj/portage:repoman commit in: pym/portage/util/_eventloop/

2017-06-27 Thread Brian Dolbec
commit: dac5089eb7908e9fd643f46c913515082077281e
Author: Zac Medico  gentoo  org>
AuthorDate: Fri May  5 09:07:38 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri May  5 18:32:45 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dac5089e

Eventloop: fix deadlock involving idle_add/call_soon (bug 617550)

Guarantee that newly added idle_add/call_soon callbacks have an
opportunity to execute before the event loop decides to wait on
self._thread_condition without a timeout. This fixes a case where
the event loop would wait on self._thread_condition indefinitely,
even though a callback scheduled by the AsynchronousTask._async_wait
method needed to be executed first.

X-Gentoo-bug: 617550
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=617550
Acked-by: Brian Dolbec  gentoo.org>

 pym/portage/util/_eventloop/EventLoop.py | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/_eventloop/EventLoop.py 
b/pym/portage/util/_eventloop/EventLoop.py
index 712838e3d..cd154005f 100644
--- a/pym/portage/util/_eventloop/EventLoop.py
+++ b/pym/portage/util/_eventloop/EventLoop.py
@@ -108,6 +108,15 @@ class EventLoop(object):
self._poll_event_handler_ids = {}
# Increment id for each new handler.
self._event_handler_id = 0
+   # New call_soon callbacks must have an opportunity to
+   # execute before it's safe to wait on self._thread_condition
+   # without a timeout, since delaying its execution indefinitely
+   # could lead to a deadlock. The following attribute stores the
+   # event handler id of the most recently added call_soon 
callback.
+   # If this attribute has changed since the last time that the
+   # call_soon callbacks have been called, then it's not safe to
+   # wait on self._thread_condition without a timeout.
+   self._call_soon_id = 0
# Use OrderedDict in order to emulate the FIFO queue behavior
# of the AbstractEventLoop.call_soon method.
self._idle_callbacks = OrderedDict()
@@ -250,10 +259,15 @@ class EventLoop(object):
 
if not event_handlers:
with self._thread_condition:
+   prev_call_soon_id = self._call_soon_id
if self._run_timeouts():
events_handled += 1
timeouts_checked = True
-   if not event_handlers and not events_handled 
and may_block:
+
+   call_soon = prev_call_soon_id != 
self._call_soon_id
+
+   if (not call_soon and not event_handlers
+   and not events_handled and may_block):
# Block so that we don't waste cpu time 
by looping too
# quickly. This makes EventLoop useful 
for code that needs
# to wait for timeout callbacks 
regardless of whether or
@@ -457,7 +471,7 @@ class EventLoop(object):
@return: an integer ID
"""
with self._thread_condition:
-   source_id = self._new_source_id()
+   source_id = self._call_soon_id = self._new_source_id()
self._idle_callbacks[source_id] = 
self._idle_callback_class(
args=args, callback=callback, 
source_id=source_id)
self._thread_condition.notify()



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-06-27 Thread Brian Dolbec
commit: e6abcc0b7cbdca481862a5c7cca946c01c471ffb
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Jun 15 07:27:47 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Jun 15 17:15:05 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e6abcc0b

const: Change the MANIFEST2_REQUIRED_HASH to SHA512

Following the plan established in GLEP 59, we're long overdue
deprecating SHA256. Since we have finally got rid of the last packages
lacking SHA512 checksums, we can proceed with that. In order to prepare
for it, however, we need to change the required hash to SHA512 and make
sure developers install the new Portage & repoman versions first.

Of course, a better course of action would be to kill
MANIFEST2_REQUIRED_HASH entirely and make Portage capable of dealing
with any hash set. However, that's a larger piece of work and it would
delay the immediate goal.

Reviewed-by: Zac Medico  gentoo.org>

 pym/portage/const.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/const.py b/pym/portage/const.py
index 052d4ca2f..cbd2b6042 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -234,7 +234,7 @@ MANIFEST2_HASH_FUNCTIONS = ("SHA256", "SHA512", "WHIRLPOOL",
"BLAKE2B", "BLAKE2S", "SHA3_256", "SHA3_512",
"STREEBOG256", "STREEBOG512")
 MANIFEST2_HASH_DEFAULTS = frozenset(["SHA256", "SHA512", "WHIRLPOOL"])
-MANIFEST2_REQUIRED_HASH  = "SHA256"
+MANIFEST2_REQUIRED_HASH  = "SHA512"
 
 MANIFEST2_IDENTIFIERS= ("AUX", "MISC", "DIST", "EBUILD")
 



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2017-06-27 Thread Brian Dolbec
commit: ff2c1d017cf2f8aa6a8eba4e0495089c5d73f277
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Jun 15 07:25:23 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Jun 15 17:05:30 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff2c1d01

const: Remove unused MANIFEST1_REQUIRED_HASH

The MANIFEST1_REQUIRED_HASH constant is not used anywhere, so it should
be possible to remove it safely.

Reviewed-by: Zac Medico  gentoo.org>

 pym/portage/const.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/portage/const.py b/pym/portage/const.py
index 7e415ba9c..052d4ca2f 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -206,7 +206,6 @@ EAPI = 6
 
 HASHING_BLOCKSIZE= 32768
 MANIFEST1_HASH_FUNCTIONS = ("MD5", "SHA256", "RMD160")
-MANIFEST1_REQUIRED_HASH  = "MD5"
 
 # Past events:
 #



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/emerge/, pym/_emerge/

2017-06-27 Thread Brian Dolbec
commit: 565ceb1bebc83ec1a5572a672e2e08ea7d91e7a8
Author: Zac Medico  gentoo  org>
AuthorDate: Sun May 28 08:55:27 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue May 30 03:30:50 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=565ceb1b

emerge: warn for --autounmask-continue with --autounmask=n (bug 619612)

In order to avoid possible confusion when the user has specified
--autounmask-continue and EMERGE_DEFAULT_OPTS contains
--autounmask=n, display a warning message as follows:

 * --autounmask-continue has been disabled by --autounmask=n

X-Gentoo-bug: 619612
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=619612
Acked-by: Brian Dolbec  gentoo.org>

 pym/_emerge/actions.py  | 6 ++
 pym/portage/tests/emerge/test_simple.py | 5 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 1bc20c3ed..c8a62fb01 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2862,6 +2862,12 @@ def run_action(emerge_config):
adjust_configs(emerge_config.opts, emerge_config.trees)
apply_priorities(emerge_config.target_config.settings)
 
+   if ("--autounmask-continue" in emerge_config.opts and
+   emerge_config.opts.get("--autounmask") == "n"):
+   writemsg_level(
+   " %s --autounmask-continue has been disabled by 
--autounmask=n\n" %
+   warn("*"), level=logging.WARNING, noiselevel=-1)
+
for fmt in 
emerge_config.target_config.settings.get("PORTAGE_BINPKG_FORMAT", "").split():
if not fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
if "--pkg-format" in emerge_config.opts:

diff --git a/pym/portage/tests/emerge/test_simple.py 
b/pym/portage/tests/emerge/test_simple.py
index 5930f6cc8..f99c77927 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -311,7 +311,10 @@ pkg_preinst() {
emerge_cmd + ("--unmerge", "--quiet", "dev-libs/A"),
emerge_cmd + ("-C", "--quiet", "dev-libs/B"),
 
-   emerge_cmd + ("--autounmask-continue", "dev-libs/C",),
+   # If EMERGE_DEFAULT_OPTS contains --autounmask=n, then 
--autounmask
+   # must be specified with --autounmask-continue.
+   ({"EMERGE_DEFAULT_OPTS" : "--autounmask=n"},) + \
+   emerge_cmd + ("--autounmask", 
"--autounmask-continue", "dev-libs/C",),
# Verify that the above --autounmask-continue command 
caused
# USE=flag to be applied correctly to dev-libs/D.
portageq_cmd + ("match", eroot, "dev-libs/D[flag]"),



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/util/, cnf/

2016-05-14 Thread Brian Dolbec
commit: a810a92d615c904db59326188e1437fdab74e705
Author: Zac Medico  gentoo  org>
AuthorDate: Thu May  5 17:12:13 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat May  7 20:02:51 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a810a92d

make.globals: Respect ssh_config port (bug 499198)

Fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port.

X-Gentoo-bug: 499198
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=499198
Acked-by: Alexander Berntsen  gentoo.org>

 cnf/make.globals | 4 ++--
 pym/portage/tests/util/test_getconfig.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cnf/make.globals b/cnf/make.globals
index 836bb5c..18eba94 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -43,11 +43,11 @@ FETCHCOMMAND_RSYNC="rsync -avP \"\${URI}\" 
\"\${DISTDIR}/\${FILE}\""
 RESUMECOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
 
 # NOTE: rsync will evaluate quotes embedded inside PORTAGE_SSH_OPTS
-FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; 
port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && 
port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP 
\\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" 
\"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
+FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; 
port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && 
port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP 
\\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" 
\"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
 RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH}
 
 # NOTE: bash eval is used to evaluate quotes embedded inside PORTAGE_SSH_OPTS
-FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; 
port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && 
port=22 ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp -P \\\${port} 
\\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp 
\"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
+FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; 
port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && 
port= ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp \\\${port:+-P 
\\\${port}} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" 
\\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" 
\"\${PORTAGE_SSH_OPTS}\""
 
 # Default user options
 FEATURES="assume-digests binpkg-logs

diff --git a/pym/portage/tests/util/test_getconfig.py 
b/pym/portage/tests/util/test_getconfig.py
index b72bd6a..05e3147 100644
--- a/pym/portage/tests/util/test_getconfig.py
+++ b/pym/portage/tests/util/test_getconfig.py
@@ -20,8 +20,8 @@ class GetConfigTestCase(TestCase):
_cases = {
'FETCHCOMMAND' : 'wget -t 3 -T 60 --passive-ftp -O 
"${DISTDIR}/${FILE}" "${URI}"',
'FETCHCOMMAND_RSYNC'   : 'rsync -avP "${URI}" 
"${DISTDIR}/${FILE}"',
-   'FETCHCOMMAND_SFTP': 'bash -c "x=\\${2#sftp://} ; 
host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = 
\\${port} ]] && port=22 ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp 
-P \\${port} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" sftp 
"${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
-   'FETCHCOMMAND_SSH' : 'bash -c "x=\\${2#ssh://} ; 
host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = 
\\${port} ]] && port=22 ; exec rsync --rsh=\\"ssh -p\\${port} \\${3}\\" -avP 
\\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" rsync "${DISTDIR}/${FILE}" "${URI}" 
"${PORTAGE_SSH_OPTS}"',
+   'FETCHCOMMAND_SFTP': 'bash -c "x=\\${2#sftp://} ; 
host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = 
\\${port} ]] && port= ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp 
\\${port:+-P \\${port}} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" 
\\"\\$1\\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
+   'FETCHCOMMAND_SSH' : 'bash -c "x=\\${2#ssh://} ; 
host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = 
\\${port} ]] && port= ; exec rsync --rsh=\\"ssh \\${port:+-p\\${port}} 
\\${3}\\" -avP \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" rsync 
"${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
'PORTAGE_ELOG_MAILSUBJECT' : '[portage] ebuild log for 
${PACKAGE} on ${HOST}'
}
 



[gentoo-commits] proj/portage:repoman commit in: pym/portage/util/futures/

2016-04-25 Thread Brian Dolbec
commit: 1b23a4134f0919e9541e7544213321efc51cac81
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Apr 25 01:09:54 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 15:28:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1b23a413

portage: Create a new extended futures class which adds standard data type 
access

This new class adds standard get, set functions along with optional defaults.
It also adds the capability to ignore InvalidStateErrors when trying to set the 
reslt more 
than once.

 pym/portage/util/futures/extendedfutures.py | 73 +
 1 file changed, 73 insertions(+)

diff --git a/pym/portage/util/futures/extendedfutures.py 
b/pym/portage/util/futures/extendedfutures.py
new file mode 100644
index 000..af384c7
--- /dev/null
+++ b/pym/portage/util/futures/extendedfutures.py
@@ -0,0 +1,73 @@
+# Copyright 2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# This module provides an extended subset of the asyncio.futures.Futures
+# interface.
+
+from __future__ import unicode_literals
+
+__all__ = (
+   'CancelledError',
+   'ExtendedFuture',
+   'InvalidStateError',
+)
+
+from portage.util.futures.futures import (Future, InvalidStateError,
+   CancelledError)
+
+# Create our one time settable unset constant
+UNSET_CONST = Future()
+UNSET_CONST.set_result(object())
+
+
+class ExtendedFuture(Future):
+   '''Extended Future class adding convienince get and set operations with
+   default result capabilities for unset result().  It also adds pass
+   capability for duplicate set_result() calls.
+   '''
+
+   def __init__(self, default_result=UNSET_CONST.result()):
+   '''Class init
+
+   @param default_result: Optional data type/value to return in 
the event
+  of a result() call when result has not 
yet been
+  set.
+   '''
+   self.default_result = default_result
+   super(ExtendedFuture, self).__init__()
+   self.set = self.set_result
+
+   def set_result(self, data, ignore_InvalidState=False):
+   '''Set the Future's result to the data, optionally don't raise
+   an error for 'InvalidStateError' errors
+
+   @param ignore_exception: Boolean
+   '''
+   if ignore_InvalidState:
+   try:
+   super(ExtendedFuture, self).set_result(data)
+   except InvalidStateError:
+   pass
+   else:
+   super(ExtendedFuture, self).set_result(data)
+
+   def get(self, default=UNSET_CONST.result()):
+   '''Convienience function to wrap result() but adds an optional
+   default value to return rather than raise an InvalidStateError
+
+   @param default: Optional override for the classwide 
default_result
+   @returns: the result data or the default value, raisies an 
exception
+ if result is unset and no default is defined.
+   '''
+   if default is not UNSET_CONST.result():
+   pass
+   elif self.default_result is not UNSET_CONST.result():
+   default = self.default_result
+   if default is not UNSET_CONST.result():
+   try:
+   data = super(ExtendedFuture, self).result()
+   except InvalidStateError:
+   data = default
+   else:
+   data = super(ExtendedFuture, self).result()
+   return data



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/resolver/

2016-04-25 Thread Brian Dolbec
commit: 8e26fbf2ebb3d26765f34dbd7b14726d8cbf122f
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Apr 17 08:06:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 15:28:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8e26fbf2

tests: Add type="" to 

 pym/portage/tests/resolver/ResolverPlayground.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index 68e047a..d1434f7 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -47,7 +47,7 @@ class ResolverPlayground(object):
metadata_xml_template = """
 http://www.gentoo.org/dtd/metadata.dtd;>
 
-
+
 maintainer-nee...@gentoo.org
 Description of the maintainership
 



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/repoman/, pym/portage/tests/emerge/, ...

2016-04-25 Thread Brian Dolbec
commit: 5771d5b99f52be8c27f22d43b7a08fd555b2d893
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Apr 17 08:06:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 15:28:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5771d5b9

tests: Stop using herds

 pym/portage/tests/emerge/test_simple.py  |  2 --
 pym/portage/tests/repoman/test_simple.py |  3 ---
 pym/portage/tests/resolver/ResolverPlayground.py | 22 --
 3 files changed, 27 deletions(-)

diff --git a/pym/portage/tests/emerge/test_simple.py 
b/pym/portage/tests/emerge/test_simple.py
index 394ed43..e5ecd4b 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -153,14 +153,12 @@ pkg_preinst() {
(
"dev-libs/A",
{
-   "herd" : "base-system",
"flags" : "Description of how USE='flag' affects this package",
},
),
(
"dev-libs/B",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),

diff --git a/pym/portage/tests/repoman/test_simple.py 
b/pym/portage/tests/repoman/test_simple.py
index 98220c4..720560b 100644
--- a/pym/portage/tests/repoman/test_simple.py
+++ b/pym/portage/tests/repoman/test_simple.py
@@ -133,21 +133,18 @@ class SimpleRepomanTestCase(TestCase):
(
"dev-libs/A",
{
-   "herd" : "base-system",
"flags" : "Description of how USE='flag' affects this 
package",
},
),
(
"dev-libs/B",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),
(
"dev-libs/C",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index 6bdf2c7..68e047a 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -47,7 +47,6 @@ class ResolverPlayground(object):
metadata_xml_template = """
 http://www.gentoo.org/dtd/metadata.dtd;>
 
-%(herd)s
 
 maintainer-nee...@gentoo.org
 Description of the maintainership
@@ -381,27 +380,6 @@ class ResolverPlayground(object):
#Create profile symlink
os.symlink(sub_profile_dir, 
os.path.join(user_config_dir, "make.profile"))
 
-   #Create minimal herds.xml
-   herds_xml = """
-http://www.gentoo.org/dtd/herds.dtd;>
-
-
-
-
-  base-system
-  base-sys...@gentoo.org
-  Core system utilities and libraries.
-  
-base-sys...@gentoo.orgg
-Base System
-Base System Maintainer
-  
-
-
-"""
-   with open(os.path.join(metadata_dir, 
"metadata.xml"), 'w') as f:
-   f.write(herds_xml)
-
make_conf = {
"ACCEPT_KEYWORDS": "x86",
"CLEAN_DELAY": "0",



[gentoo-commits] proj/portage:repoman commit in: pym/portage/util/, pym/repoman/, pym/portage/util/futures/

2016-04-25 Thread Brian Dolbec
commit: 09fa3e27ae878f8bb027b728d876168d9b201d7b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Apr 24 08:04:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 15:28:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=09fa3e27

portage: Move the new util/futures.py to a futures subpkg

 pym/portage/util/futures/__init__.py  | 0
 pym/portage/util/{ => futures}/futures.py | 0
 pym/repoman/scanner.py| 2 +-
 3 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/futures/__init__.py 
b/pym/portage/util/futures/__init__.py
new file mode 100644
index 000..e69de29

diff --git a/pym/portage/util/futures.py b/pym/portage/util/futures/futures.py
similarity index 100%
rename from pym/portage/util/futures.py
rename to pym/portage/util/futures/futures.py

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index eaf023b..b3eeafd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -9,7 +9,7 @@ import portage
 from portage import normalize_path
 from portage import os
 from portage.output import green
-from portage.util.futures import Future
+from portage.util.futures.futures import Future
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/repoman/, /, cnf/

2016-04-25 Thread Brian Dolbec
commit: e34f44b2d66f2fcd830457adc5d5b9e6f90796db
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Apr 17 08:06:29 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 15:03:55 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e34f44b2

tests: Include metadata.xsd for repoman tests

 .travis.yml  |   4 +-
 MANIFEST.in  |   2 +-
 cnf/metadata.dtd | 102 --
 cnf/metadata.xsd | 547 +++
 pym/portage/tests/repoman/test_simple.py |   8 +-
 5 files changed, 554 insertions(+), 109 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b662d94..5213fee 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,8 +8,8 @@ python:
 script:
 - ./setup.py test
 - ./setup.py install --root=/tmp/install-root
-# prevent repoman tests from trying to fetch metadata.dtd
+# prevent repoman tests from trying to fetch metadata.xsd
 - mkdir -p /tmp/install-root/usr/lib/portage/cnf
-- cp cnf/metadata.dtd /tmp/install-root/usr/lib/portage/cnf/
+- cp cnf/metadata.xsd /tmp/install-root/usr/lib/portage/cnf/
 - sudo rsync -a /tmp/install-root/. /
 - python -b -Wd -m portage.tests.runTests

diff --git a/MANIFEST.in b/MANIFEST.in
index d65c874..2178460 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -12,7 +12,7 @@ include cnf/make.conf.example.*
 
 # extra files for tests
 include .portage_not_installed
-include cnf/metadata.dtd
+include cnf/metadata.xsd
 
 # extra scripts
 include misc/*

diff --git a/cnf/metadata.dtd b/cnf/metadata.dtd
deleted file mode 100644
index ff2649c..000
--- a/cnf/metadata.dtd
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-  
-  
-
-  
-  
-
-  
-  
-
-  
-  
-
-  
-  
-  
-
-
-  
-
-  
-
-  
-
-  
-  
-
-  
-
-
-  
-  
-
-  
-  
-
-  
-  
-
-
-
-
-  
-
-
-
-
-  
-
-  
-  
-  
-  
-
-
-
-  
-  
-  
-
-
-  
-  
-  
-  
-
-
-
-
-
-
-

diff --git a/cnf/metadata.xsd b/cnf/metadata.xsd
new file mode 100644
index 000..0ead09e
--- /dev/null
+++ b/cnf/metadata.xsd
@@ -0,0 +1,547 @@
+
+
+
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+
+   
+   
+   
+   
+   
+
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+
+   
+   
+   
+   
+   

[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/resolver/, pym/portage/tests/emerge/, ...

2016-04-25 Thread Brian Dolbec
commit: 98280c22d7183312750c8731ac274ab4144b04d6
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Apr 17 08:06:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 14:49:14 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=98280c22

tests: Stop using herds

 pym/portage/tests/emerge/test_simple.py  |  2 --
 pym/portage/tests/repoman/test_simple.py |  3 ---
 pym/portage/tests/resolver/ResolverPlayground.py | 22 --
 3 files changed, 27 deletions(-)

diff --git a/pym/portage/tests/emerge/test_simple.py 
b/pym/portage/tests/emerge/test_simple.py
index 394ed43..e5ecd4b 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -153,14 +153,12 @@ pkg_preinst() {
(
"dev-libs/A",
{
-   "herd" : "base-system",
"flags" : "Description of how USE='flag' affects this package",
},
),
(
"dev-libs/B",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),

diff --git a/pym/portage/tests/repoman/test_simple.py 
b/pym/portage/tests/repoman/test_simple.py
index 98220c4..720560b 100644
--- a/pym/portage/tests/repoman/test_simple.py
+++ b/pym/portage/tests/repoman/test_simple.py
@@ -133,21 +133,18 @@ class SimpleRepomanTestCase(TestCase):
(
"dev-libs/A",
{
-   "herd" : "base-system",
"flags" : "Description of how USE='flag' affects this 
package",
},
),
(
"dev-libs/B",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),
(
"dev-libs/C",
{
-   "herd" : "no-herd",
"flags" : "Description of how USE='flag' affects this package",
},
),

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index 6bdf2c7..68e047a 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -47,7 +47,6 @@ class ResolverPlayground(object):
metadata_xml_template = """
 http://www.gentoo.org/dtd/metadata.dtd;>
 
-%(herd)s
 
 maintainer-nee...@gentoo.org
 Description of the maintainership
@@ -381,27 +380,6 @@ class ResolverPlayground(object):
#Create profile symlink
os.symlink(sub_profile_dir, 
os.path.join(user_config_dir, "make.profile"))
 
-   #Create minimal herds.xml
-   herds_xml = """
-http://www.gentoo.org/dtd/herds.dtd;>
-
-
-
-
-  base-system
-  base-sys...@gentoo.org
-  Core system utilities and libraries.
-  
-base-sys...@gentoo.orgg
-Base System
-Base System Maintainer
-  
-
-
-"""
-   with open(os.path.join(metadata_dir, 
"metadata.xml"), 'w') as f:
-   f.write(herds_xml)
-
make_conf = {
"ACCEPT_KEYWORDS": "x86",
"CLEAN_DELAY": "0",



[gentoo-commits] proj/portage:repoman commit in: pym/portage/tests/resolver/

2016-04-25 Thread Brian Dolbec
commit: 8a53e6d5f119fdb5ca65e221977dd61604e8ced8
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Apr 17 08:06:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 14:49:28 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8a53e6d5

tests: Add type="" to 

 pym/portage/tests/resolver/ResolverPlayground.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index 68e047a..d1434f7 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -47,7 +47,7 @@ class ResolverPlayground(object):
metadata_xml_template = """
 http://www.gentoo.org/dtd/metadata.dtd;>
 
-
+
 maintainer-nee...@gentoo.org
 Description of the maintainership
 



[gentoo-commits] proj/portage:repoman commit in: pym/portage/util/futures/

2016-04-24 Thread Brian Dolbec
commit: 88507f5c1461d0afbe7399f3bd963f4a5e791900
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Apr 25 01:09:54 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 03:03:12 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=88507f5c

portage: Create a new extended futures class which adds standard data type 
access

This new class adds standard get, set functions along with optional defaults.
It also adds the capability to ignore InvalidStateErrors when trying to set the 
reslt more 
than once.

 pym/portage/util/futures/extendedfutures.py | 73 +
 1 file changed, 73 insertions(+)

diff --git a/pym/portage/util/futures/extendedfutures.py 
b/pym/portage/util/futures/extendedfutures.py
new file mode 100644
index 000..af384c7
--- /dev/null
+++ b/pym/portage/util/futures/extendedfutures.py
@@ -0,0 +1,73 @@
+# Copyright 2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# This module provides an extended subset of the asyncio.futures.Futures
+# interface.
+
+from __future__ import unicode_literals
+
+__all__ = (
+   'CancelledError',
+   'ExtendedFuture',
+   'InvalidStateError',
+)
+
+from portage.util.futures.futures import (Future, InvalidStateError,
+   CancelledError)
+
+# Create our one time settable unset constant
+UNSET_CONST = Future()
+UNSET_CONST.set_result(object())
+
+
+class ExtendedFuture(Future):
+   '''Extended Future class adding convienince get and set operations with
+   default result capabilities for unset result().  It also adds pass
+   capability for duplicate set_result() calls.
+   '''
+
+   def __init__(self, default_result=UNSET_CONST.result()):
+   '''Class init
+
+   @param default_result: Optional data type/value to return in 
the event
+  of a result() call when result has not 
yet been
+  set.
+   '''
+   self.default_result = default_result
+   super(ExtendedFuture, self).__init__()
+   self.set = self.set_result
+
+   def set_result(self, data, ignore_InvalidState=False):
+   '''Set the Future's result to the data, optionally don't raise
+   an error for 'InvalidStateError' errors
+
+   @param ignore_exception: Boolean
+   '''
+   if ignore_InvalidState:
+   try:
+   super(ExtendedFuture, self).set_result(data)
+   except InvalidStateError:
+   pass
+   else:
+   super(ExtendedFuture, self).set_result(data)
+
+   def get(self, default=UNSET_CONST.result()):
+   '''Convienience function to wrap result() but adds an optional
+   default value to return rather than raise an InvalidStateError
+
+   @param default: Optional override for the classwide 
default_result
+   @returns: the result data or the default value, raisies an 
exception
+ if result is unset and no default is defined.
+   '''
+   if default is not UNSET_CONST.result():
+   pass
+   elif self.default_result is not UNSET_CONST.result():
+   default = self.default_result
+   if default is not UNSET_CONST.result():
+   try:
+   data = super(ExtendedFuture, self).result()
+   except InvalidStateError:
+   data = default
+   else:
+   data = super(ExtendedFuture, self).result()
+   return data



[gentoo-commits] proj/portage:repoman commit in: pym/portage/util/, pym/portage/util/futures/, pym/repoman/

2016-04-24 Thread Brian Dolbec
commit: f902c8684148a635aa9c780908e60ec2ff4a1fc6
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Apr 24 08:04:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Apr 25 03:03:12 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f902c868

portage: Move the new util/futures.py to a futures subpkg

 pym/portage/util/futures/__init__.py  | 0
 pym/portage/util/{ => futures}/futures.py | 0
 pym/repoman/scanner.py| 2 +-
 3 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/futures/__init__.py 
b/pym/portage/util/futures/__init__.py
new file mode 100644
index 000..e69de29

diff --git a/pym/portage/util/futures.py b/pym/portage/util/futures/futures.py
similarity index 100%
rename from pym/portage/util/futures.py
rename to pym/portage/util/futures/futures.py

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index eaf023b..b3eeafd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -9,7 +9,7 @@ import portage
 from portage import normalize_path
 from portage import os
 from portage.output import green
-from portage.util.futures import Future
+from portage.util.futures.futures import Future
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata



[gentoo-commits] proj/portage:repoman commit in: pym/portage/

2015-12-30 Thread Brian Dolbec
commit: a26821f63c01005cb1e9509051fd44c7c2b08012
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Dec 30 23:28:02 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec 30 23:28:02 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a26821f6

portage/module.py: Fix bug where the module_spec module name was not being used

This only showed up when the module's target name (filename) was not the same 
as the 
modules initialization name.

 pym/portage/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/module.py b/pym/portage/module.py
index 2277e7a..69050aa 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -46,7 +46,7 @@ class Module(object):
for submodule in self.module_spec['provides']:
kid = self.module_spec['provides'][submodule]
kidname = kid['name']
-   kid['module_name'] = '.'.join([mod_name, self.name])
+   kid['module_name'] = '.'.join([mod_name, kidname])
kid['is_imported'] = False
self.kids[kidname] = kid
self.kids_names.append(kidname)