public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3f0553996ab99a1923bc35e609efc42008c6d4cd
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Jul 17 06:02:01 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3f055399

some docstring updates

---
 layman/api.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 7784861..a3ac497 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -44,7 +44,14 @@ class LaymanAPI(object):
     ## It is a near duplicate of the actions classes.
 
     def __init__(self, config=None, report_errors=False, output=None):
-        """@param configfile, optional config file to use instead of the default
+        """
+        @param configfile: optional config file to use instead of the default.
+                                        can be a BareConfig or ArgsParser config class.
+                                        default is BareConfig(output=output)
+        @param report_errors: optional bool to silence some error reporting to stdout
+                                                default is False
+        @param output: optional Message class instance created with your settings.
+                                    default is Message(module='layman') other params are defaults.
         """
         
         self.output = output if output  else OUT
@@ -88,6 +95,10 @@ class LaymanAPI(object):
 
     @staticmethod
     def _check_repo_type( repos, caller):
+        """internal function that validates the repos parameter,
+        converting a string to a list[string] if it is not already a list.
+        produces and error message if it is any other type
+        returns repos as list always"""
         if isinstance(repos, str):
             repos = [repos]
         elif not isinstance(repos, list):
@@ -184,7 +195,6 @@ class LaymanAPI(object):
         }
         """
         
-        # In progress, has, been coded to the above dict. yet.
         repos = self._check_repo_type(repos, "get_info")
         result = {}
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2020-04-24 20:59 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2020-04-24 20:59 UTC (permalink / raw
  To: gentoo-commits

commit:     8c4e2883180ad126d8b334d82898622dad9d0b47
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 13:03:33 2020 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 13:57:26 2020 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8c4e2883

Update version for a release

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index 402a339..966582c 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.4.2'
+VERSION = '2.4.3'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2020-04-24 20:59 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2020-04-24 20:59 UTC (permalink / raw
  To: gentoo-commits

commit:     e4de947fd48a95b078e7d6a35099e200e6f19a02
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 12:36:33 2020 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 13:56:34 2020 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=e4de947f

layman/config.py: Fix py3.7, py3.8 ConfigParser error

Newer pythons require string defaults only.
The final config instance variable is either a NoneType or list

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 layman/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/config.py b/layman/config.py
index 853e22f..bc3172b 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -96,7 +96,7 @@ class BareConfig(object):
             'cache'     : '%(storage)s/cache',
             'local_list': '%(storage)s/overlays.xml',
             'installed': '%(storage)s/installed.xml',
-            'protocol_filter': [],
+            'protocol_filter': '',
             'auto_sync': 'No',
             'check_official': 'Yes',
             'conf_type': 'repos.conf',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2017-03-22  6:36 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2017-03-22  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     e5a21d0da92e258e375d49c6a606ad740933f0ff
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 22 06:28:25 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Mar 22 06:28:25 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=e5a21d0d

api.py: Fix typo in string substitution dictionary

 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 73fb72a..574e25a 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -399,7 +399,7 @@ class LaymanAPI(object):
                 #self._error(str(error))
                 fatals.append((ovl,
                     'Failed to select overlay "%(repo)s".\nError was: %(error)s'
-                     % {'repo': ovl, 'err': error}))
+                     % {'repo': ovl, 'error': error}))
                 self.output.debug("API.sync(); UnknownOverlayException "
                     "selecting %(repo)s.   continuing to next ovl..."
                     % {'repo': ovl}, 5)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2017-02-02 17:12 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2017-02-02 17:12 UTC (permalink / raw
  To: gentoo-commits

commit:     e90bacf006e4ae4842f8dc49fb763513898f37e0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 17:00:30 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 17:06:49 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=e90bacf0

layman/cli.py: Typo fix

 layman/cli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/cli.py b/layman/cli.py
index 86d6e70..870255f 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -164,7 +164,7 @@ class Main(object):
 
         # Make fetching the overlay list a default action
         if not 'nofetch' in self.config.keys():
-            # Actions that implicitely call the fetch operation before
+            # Actions that implicitly call the fetch operation before
             fetch_actions = ['sync', 'sync_all', 'list']
             for i in fetch_actions:
                 if i in self.config.keys():


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2017-02-02  1:12 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2017-02-02  1:12 UTC (permalink / raw
  To: gentoo-commits

commit:     d9112d003d5d9bcc71d681206522cc161f59f169
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 01:11:01 2017 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 01:11:03 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d9112d00

api.py: Moves instantiation of rdb to above for-loop

There is no need to repeatedly connect to the rdb when syncing
overlays. We are better off connecting once and querying it whenever
we need to. Doing it every time leads us to issues like bug #603296

X-Gentoo-Bug: 603296
X-Gentoo-Bug-URL: https://bugs.gentoo.org/603296

 layman/api.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 2c46bb7..73fb72a 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -384,6 +384,7 @@ class LaymanAPI(object):
         success  = []
         repos = self._check_repo_type(repos, "sync")
         db = self._get_installed_db()
+        rdb = self._get_remote_db()
 
         self.output.debug("API.sync(); starting ovl loop", 5)
         for ovl in repos:
@@ -406,7 +407,7 @@ class LaymanAPI(object):
 
             try:
                 self.output.debug("API.sync(); try: self._get_remote_db().select(ovl)", 5)
-                ordb = self._get_remote_db().select(ovl)
+                ordb = rdb.select(ovl)
             except UnknownOverlayException:
                 message = 'Overlay "%(repo)s" could not be found in the remote '\
                         'lists.\nPlease check if it has been renamed and '\


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2017-02-02  1:12 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2017-02-02  1:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fc23ec8246c2700111cbf8f4a4eb55ac4a5eb000
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 00:47:27 2017 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 00:47:33 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=fc23ec82

argparser.py: Fixed typo in --help output

Thank you dewey for pointing this out.

 layman/argsparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index f3cc8fa..272ac47 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -193,7 +193,7 @@ class ArgsParser(BareConfig):
                                action = 'store',
                                default = self.defaults['overlay_defs'],
                                # Force interpolation (to prevent argparse tracebacks)
-                               help = 'Path to aditional overlay.xml files [default: '
+                               help = 'Path to additional overlay.xml files [default: '
                                '%s].' % (self.defaults['overlay_defs'] %self.defaults))
 
         path_opts.add_argument('-z',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-11-10  2:59 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2016-11-10  2:59 UTC (permalink / raw
  To: gentoo-commits

commit:     7d1a6df6514991adeaa6deeb5d710354967bcc8c
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 10 02:49:06 2016 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Nov 10 02:49:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=7d1a6df6

utils.py: Removes catching KeyboardInterrupt

As per bug 539336 it's near impossible to kill a stampeding layman
process. This was due to the run_command() function which caught
the KeyboardInterrupt exception.

 layman/utils.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index 9530701..c008530 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -270,9 +270,6 @@ def run_command(config, command, args, **kwargs):
 
     try:
         result = proc.wait()
-    except KeyboardInterrupt:
-        output.info('Interrupted manually', 2)
-        result = 1
     except Exception as err:
         output.error(
             'Unknown exception running command: %s' % command_repr)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-05-10 22:13 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2016-05-10 22:13 UTC (permalink / raw
  To: gentoo-commits

commit:     90fe6724d0a8d1ebfe6443dee118432e20432b8b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 10 22:12:02 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue May 10 22:12:02 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=90fe6724

layman/module.py: Fix commit 63808ef00f94 mis-applied 'sourcefile' attribute changes

It was not looking for the 'sourcefile' attribute first, then falling back to the kidname for
backward compatibility.
It was incorrectly looking for an ImportError, instead of a 'sourcefile' KeyError.
The filepath of the affected file for the error message had an extra leading '_'.
Add the module name to the warning message.

 layman/module.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/layman/module.py b/layman/module.py
index 08bcbc2..092418f 100644
--- a/layman/module.py
+++ b/layman/module.py
@@ -49,13 +49,14 @@ class Module(object):
             kid = self.module_spec['provides'][submodule]
             kidname = kid['name']
             try:
+                kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
+            except KeyError:
                 kid['module_name'] = '.'.join([mod_name, kidname])
-            except ImportError:
-                kid['module_name'] = '.'.join([mod_name, self.name])
-                f = self.__module.__file__
-                msg = 'Module.__initialize(); module spec is old, missing '\
+                f = self._module.__file__
+                msg = 'Module.__initialize(); %(module)s module spec is old, missing '\
                       'attribute: \'sourcefile\'.\nBackward compatibility '\
-                      'may be removed in the future.\nFile: %(f)s' % {'f': f}
+                      'may be removed in the future.\nFile: %(f)s' % {
+                      'module': self.name, 'f': f}
                 self.output.warn(msg)
             kid['is_imported'] = False
             self.kids[kidname] = kid


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-05-02  3:30 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2016-05-02  3:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ec141d305949dac2d7ea3aab9f4c42d73f690777
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun May  1 01:06:09 2016 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun May  1 01:06:09 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=ec141d30

version.py: Changes version to reflect update

 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index e6d19ff..1e1427f 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.4.0-git'
+VERSION = '2.4.0'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-03-10  0:00 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2016-03-10  0:00 UTC (permalink / raw
  To: gentoo-commits

commit:     b15d33d547a8fa99f6919036991e2a7e539fe04c
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  9 23:59:13 2016 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Mar  9 23:59:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=b15d33d5

remotedb.py: Removes climit param for internel _fetch_file() params

As _fetch_file() is for fetching internal files and does not use ssl-fetch
it should not have climit as a parameter.

 layman/remotedb.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index acade02..2df0c63 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -145,7 +145,7 @@ class RemoteDB(DbBase):
                 filepath, mpath, tpath, sig = self._paths(url)
                 if 'file://' in url:
                     success, olist, timestamp = self._fetch_file(
-                        url, mpath, tpath, climit=60)
+                        url, mpath, tpath)
                 elif sig:
                     success, olist, timestamp = fetcher.fetch_content(
                         url[0], tpath, climit=60)
@@ -222,7 +222,7 @@ class RemoteDB(DbBase):
 
         return base + '_' + hashlib.md5(url_encoded).hexdigest()
 
-    def _fetch_file(self, url, mpath, tpath=None, climit=60):
+    def _fetch_file(self, url, mpath, tpath=None):
         self.output.debug('RemoteDB._fetch_file() url = %s' % url, 2)
         # check when the cache was last updated
         # and don't re-fetch it unless it has changed


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-03-09 23:37 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2016-03-09 23:37 UTC (permalink / raw
  To: gentoo-commits

commit:     5f5e2626e0f4a5c3acca62083ce479828597462f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  9 23:37:13 2016 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Mar  9 23:37:15 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5f5e2626

remotedb.py: Adds climit param to _fetch_file() definition

Following up on the updating of ssl-fetch's API update in commit
5ffbc7ae to make use of climit parameter.

 layman/remotedb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index 75f6739..acade02 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -222,7 +222,7 @@ class RemoteDB(DbBase):
 
         return base + '_' + hashlib.md5(url_encoded).hexdigest()
 
-    def _fetch_file(self, url, mpath, tpath=None):
+    def _fetch_file(self, url, mpath, tpath=None, climit=60):
         self.output.debug('RemoteDB._fetch_file() url = %s' % url, 2)
         # check when the cache was last updated
         # and don't re-fetch it unless it has changed


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-02-29  6:21 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2016-02-29  6:21 UTC (permalink / raw
  To: gentoo-commits

commit:     c8170ca79751fa8785527683b8627317d61bde2b
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 29 06:22:25 2016 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Feb 29 06:22:25 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=c8170ca7

dbbase.py: adds return value for read_db()

 layman/dbbase.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 8b25fcd..9a8ba3f 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -219,7 +219,7 @@ class DbBase(object):
             db_type = 'xml_db'
 
         db_ctl = self._get_dbctl(db_type)
-        db_ctl.read_db(path, text=text)
+        return db_ctl.read_db(path, text=text)
 
 
     def write(self, path, remove=False, migrate_type=None):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2016-01-29 10:21 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2016-01-29 10:21 UTC (permalink / raw
  To: gentoo-commits

commit:     032c1c60eb2a33f1cd52a0023dcd2e6d0de54f01
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 29 10:18:34 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 10:20:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=032c1c60

remotedb.py: Update for latest ssl-fetch API

 layman/remotedb.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index 5a66a3f..75f6739 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -119,9 +119,15 @@ class RemoteDB(DbBase):
             'info':  self.output.info,
             'debug': self.output.debug,
             'error': self.output.error,
+            'exception': self.output.error,
+            # we want any warnings to be printed to the terminal
+            # so assign it to output.info with a lower noise level
+            'warning': self.output.info,
+            'kwargs-exception': {'level': None},
             'kwargs-info': {'level': 5},
             'kwargs-debug': {'level': 2},
             'kwargs-error':{'level': None},
+            'kwargs-warning': {'level': 2},
         }
         fetcher = Connector(connector_output, self.proxies, USERAGENT)
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-12-31  1:03 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-12-31  1:03 UTC (permalink / raw
  To: gentoo-commits

commit:     40b99fb93f0cbc80083a72e23e93da4bafb365fb
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 31 01:02:44 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Dec 31 01:02:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=40b99fb9

module.py: fixes bug where the module_spec module name was not used

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

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

diff --git a/layman/module.py b/layman/module.py
index 6d7a40b..99d243b 100644
--- a/layman/module.py
+++ b/layman/module.py
@@ -48,7 +48,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)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-12-26 23:24 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2015-12-26 23:24 UTC (permalink / raw
  To: gentoo-commits

commit:     5ffbc7aef1251366173a4b01cb4453a585d9e064
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 26 23:23:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Dec 26 23:23:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5ffbc7ae

remotedb.py: Add climit due to sslfetch API change

 layman/remotedb.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index b9c4ae0..5a66a3f 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -139,13 +139,13 @@ class RemoteDB(DbBase):
                 filepath, mpath, tpath, sig = self._paths(url)
                 if 'file://' in url:
                     success, olist, timestamp = self._fetch_file(
-                        url, mpath, tpath)
+                        url, mpath, tpath, climit=60)
                 elif sig:
                     success, olist, timestamp = fetcher.fetch_content(
-                        url[0], tpath)
+                        url[0], tpath, climit=60)
                 else:
                     success, olist, timestamp = fetcher.fetch_content(
-                        url, tpath)
+                        url, tpath, climit=60)
                 if not success:
                     #succeeded = False
                     continue


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-11-29  3:26 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-11-29  3:26 UTC (permalink / raw
  To: gentoo-commits

commit:     491baec51fabb75160170dbea9b55887b1083773
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 29 03:25:15 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Nov 29 03:25:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=491baec5

updater.py: Sets set_db_type installed var to new_name

Previously the set_db_type function would be passed the old installed
database name instead of the new one. This would lead to setting
the "installed" variable in the layman config to an incorrect one.

 layman/updater.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 6cd98c4..6384429 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -164,7 +164,7 @@ class Main(object):
                                    'to_type': migrate_type}
         self.output.info(msg)
 
-        self.set_db_type(migrate_type, os.path.basename(installed))
+        self.set_db_type(migrate_type, os.path.basename(new_name))
 
         msg = '  Warning: Please be sure to update your config file via '\
               'the\n  `dispatch-conf` command or you *will* lose database '\


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-11-29  3:12 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-11-29  3:12 UTC (permalink / raw
  To: gentoo-commits

commit:     c8f2cda02daf9752e0c169db2051ee33a4e1f9d7
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 29 03:11:59 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Nov 29 03:12:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=c8f2cda0

updater.py: Adds expected "." to database migration check to ensure proper backup naming

 layman/updater.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 5cef2b0..6cd98c4 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -124,7 +124,7 @@ class Main(object):
         installed = self.config['installed']
         old_ext = os.path.splitext(installed)[1]
         backup_name = installed + '.' + self.config['db_type']
-        if old_ext == self.config['db_type']:
+        if old_ext == "." + self.config['db_type']:
             backup_name = installed + '.bak'
         new_name = installed.replace(old_ext, '.db')
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-10-17  3:20 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-10-17  3:20 UTC (permalink / raw
  To: gentoo-commits

commit:     909afd209034ec26bca6f8c5d646852b2bd62c3e
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 17 03:19:25 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Oct 17 03:19:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=909afd20

dbbase.py: Whitespace cleanup

Shamelessly hiding the fact that I'm also ammending the lack of
self.db_type use in the remove() function.

 layman/dbbase.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index ebcd7a4..c2b25b8 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -173,8 +173,8 @@ class DbBase(object):
             self.output.die(msg)
 
         return db_ctl
-        
-        
+
+
     def add_new(self, xml=None, origin=None, from_dict=None):
         '''
         Reads xml text and dictionary definitions and adds
@@ -229,7 +229,7 @@ class DbBase(object):
         '''
         Remove an overlay from the database.
         '''
-        db_ctl = self._get_dbctl(db_type)
+        db_ctl = self._get_dbctl(self.db_type)
         db_ctl.remove(overlay, path)
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-10-16 18:49 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-10-16 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     a4ee3c8a29db32aad6e5b5404fbc1714185f7ab8
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 16 18:47:06 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Oct 16 18:47:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=a4ee3c8a

updater.py: Alters the way migrate_database handles an invalid db_type

Instead of showing the user the error and raising an exception, an
alternative method of dying after hitting the error has been
implemented.

 layman/updater.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 25abf72..5cef2b0 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -118,8 +118,7 @@ class Main(object):
         if migrate_type not in DB_TYPES:
             msg = 'migrate_database() error; invalid migration type: '\
                   '"%(db_type)s"' % {'db_type': migrate_type}
-            self.output.error('  ' + msg)
-            raise Exception(msg)
+            self.output.die(msg)
 
         db = DB(self.config)
         installed = self.config['installed']


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-10-16 18:49 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-10-16 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     d1c17e2c30f47ef5ac8450f269824976605b58a0
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 16 18:19:27 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Oct 16 18:19:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d1c17e2c

dbbase.py: Creates internal function to get database module controller

This internal function centralizes the functionality of getting the
database module controller while also adding in checks to gracefully
handle invalid module names.

 layman/dbbase.py | 43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index dc089d8..ebcd7a4 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -36,7 +36,7 @@ import os
 import os.path
 import sys
 
-from   layman.module             import Modules
+from   layman.module             import Modules, InvalidModuleName
 from   layman.overlays.overlay   import Overlay
 
 
@@ -155,6 +155,26 @@ class DbBase(object):
         raise NotImplementedError(msg)
 
 
+    def _get_dbctl(self, db_type):
+        '''
+        Returns database module controller for class or dies trying.
+        '''
+        try:
+            db_ctl = self.mod_ctl.get_class(db_type)(self.config,
+                        self.overlays,
+                        self.paths,
+                        self.ignore,
+                        self.ignore_init_read_errors)
+        except InvalidModuleName:
+            msg = 'DbBase._get_dbctl() error:\nDatabase module name '\
+                  '"%(name)s" is invalid or not found.\nPlease set db_type '\
+                  'variable to proper value to continue.'\
+                  % {'name': db_type.replace('_db', '')}
+            self.output.die(msg)
+
+        return db_ctl
+        
+        
     def add_new(self, xml=None, origin=None, from_dict=None):
         '''
         Reads xml text and dictionary definitions and adds
@@ -188,12 +208,7 @@ class DbBase(object):
         if 'cache' in path and '.xml' in path:
             db_type = 'xml_db'
 
-        db_ctl = self.mod_ctl.get_class(db_type)(self.config,
-                 self.overlays,
-                 self.paths,
-                 self.ignore,
-                 self.ignore_init_read_errors)
-
+        db_ctl = self._get_dbctl(db_type)
         db_ctl.read_db(path, text=text)
 
 
@@ -206,12 +221,7 @@ class DbBase(object):
         if migrate_type:
             db_type = migrate_type + '_db'
 
-        db_ctl = self.mod_ctl.get_class(db_type)(self.config,
-                 self.overlays,
-                 self.paths,
-                 self.ignore,
-                 self.ignore_init_read_errors)
-
+        db_ctl = self._get_dbctl(db_type)
         db_ctl.write(path, remove=remove)
 
 
@@ -219,12 +229,7 @@ class DbBase(object):
         '''
         Remove an overlay from the database.
         '''
-        db_ctl = self.mod_ctl.get_class(self.db_type)(self.config,
-                 self.overlays,
-                 self.paths,
-                 self.ignore,
-                 self.ignore_init_read_errors)
-
+        db_ctl = self._get_dbctl(db_type)
         db_ctl.remove(overlay, path)
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-09-23 15:25 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-09-23 15:25 UTC (permalink / raw
  To: gentoo-commits

commit:     dd07c3c8ff231ca440a19ad288603573be1a02bb
Author:     Pastafarianist <mr.pastafarianist <AT> gmail <DOT> com>
AuthorDate: Tue Sep 22 15:35:54 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Sep 23 15:24:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=dd07c3c8

Improved grammar

Signed-off-by: Devan Franchini <twitch153 <AT> gentoo.org>

 layman/db.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/db.py b/layman/db.py
index a7ed1ce..d67ea87 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -87,7 +87,7 @@ class DB(DbBase):
         @rtype bool: reflect the user's decision to install overlay.
         '''
         if self.config['check_official'] and not overlay.status == 'official':
-            msg = 'Overlay "%(repo)s" is not an official. Continue install?'\
+            msg = 'Overlay "%(repo)s" is not official. Continue installing?'\
                   ' [y/n]: ' % {'repo': overlay.name}
             if not get_ans(msg, color='green'):
                 msg = 'layman will not add "%(repo)s", due to user\'s'\


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-09-05  6:03 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-09-05  6:03 UTC (permalink / raw
  To: gentoo-commits

commit:     3ed3bc4d73658acc7f9541d34c7e9d1190211a41
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  5 06:03:32 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 06:03:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=3ed3bc4d

api.py: Corrects typo in enable/disable_repo functions()

References git issue #30.

 layman/api.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 20fe402..2c46bb7 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -193,7 +193,7 @@ class LaymanAPI(object):
         for ovl in repos:
             if not self.is_repo(ovl):
                 self.output.error(UnknownOverlayMessage(ovl))
-                result.append(False)
+                results.append(False)
                 continue
             success = False
             try:
@@ -218,7 +218,7 @@ class LaymanAPI(object):
         for ovl in repos:
             if not self.is_repo(ovl):
                 self.output.error(UnknownOverlayMessage(ovl))
-                result.append(False)
+                results.append(False)
                 continue
             success = False
             try:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-08-28  1:48 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-08-28  1:48 UTC (permalink / raw
  To: gentoo-commits

commit:     a84d2c42eda377be883b889fbe3d094ecc48221e
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 01:33:19 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 01:47:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=a84d2c42

maker.py: Adds multiple owner user query

 layman/maker.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/layman/maker.py b/layman/maker.py
index caf5655..06d624b 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -401,9 +401,25 @@ class Interactive(object):
         then appends the values to the overlay
         being created.
         '''
+        self.overlay['owner'] = []
         self.output.notice('')
-        self.overlay['owner_name'] = get_input('Define owner name: ')
-        self.overlay['owner_email'] = get_input('Define owner email: ')
+
+        msg = 'How many people own this overlay?: '
+        owner_amount = int(get_input(msg))
+
+        for i in range(1, owner_amount + 1):
+            owner = {}
+            extra = ''
+
+            if owner_amount > 1:
+                extra = '[%(i)s]\'s' % {'i': str(i)}
+
+            owner['name'] = get_input('Define owner%(extra)s name: '\
+                            % {'extra': extra})
+            owner['email'] = get_input('Define owner%(extra)s email: '\
+                             % {'extra': extra})
+            self.overlay['owner'].append(owner)
+
         self.output.notice('')
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-08-28  1:48 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-08-28  1:48 UTC (permalink / raw
  To: gentoo-commits

commit:     d5ca0ce0d10220401176b981882349c9f25294c4
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 01:45:45 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 01:47:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d5ca0ce0

maker.py: Modifies query prompts

These modifications remove a lot of duplicated prompts that were created
when trying to prompt the user for an item that could be of more than
one value.

 layman/maker.py | 70 ++++++++++++++++++++++-----------------------------------
 1 file changed, 27 insertions(+), 43 deletions(-)

diff --git a/layman/maker.py b/layman/maker.py
index 06d624b..c184f6b 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -295,11 +295,11 @@ class Interactive(object):
         feeds = []
 
         for i in range(1, feed_amount + 1):
+            extra = ''
             if feed_amount > 1:
-                msg = 'Define overlay feed[%(i)s]: ' % ({'i': str(i)})
-                feeds.append(get_input(msg))
-            else:
-                feeds.append(get_input('Define overlay feed: '))
+                extra = '[%(i)s]' % {'i': str(i)}
+            feeds.append(get_input('Define overlay%(extra)s feed: '\
+                         % {'extra': extra}))
 
         self.overlay['feed'] = feeds
         self.output.notice('')
@@ -344,48 +344,32 @@ class Interactive(object):
         for i in range(1, source_amount + 1):
             sources = []
             correct = False
+            extra = ''
             if source_amount > 1:
-                msg = 'Define source[%(i)s]\'s URL: ' % ({'i': str(i)})
-                sources.append(get_input(msg))
+                extra = '[%(i)s]\'s' % {'i': str(i)}
 
-                ovl_type = self.guess_overlay_type(sources[0])
-                if ovl_type:
-                    msg = 'Is "%(type)s" the correct overlay type?: '\
-                        % ({'type': ovl_type})
-                    correct = get_ans(msg)
-                while not ovl_type or not correct:
-                    msg = 'Please provide overlay type: '
-                    ovl_type = self.check_overlay_type(\
-                                get_input(msg, color='yellow'))
-                    correct = True
-
-                sources.append(ovl_type)
-                if 'branch' in self.required:
-                    msg = 'Define source[%(i)s]\'s branch (if applicable): '\
-                          % ({'i': str(i)})
-                    sources.append(get_input(msg))
-                else:
-                    sources.append('')
+            msg = 'Define source%(extra)s URL: ' % {'extra': extra}
+            sources.append(get_input(msg))
+
+            ovl_type = self.guess_overlay_type(sources[0])
+            if ovl_type:
+                msg = 'Is "%(type)s" the correct overlay type?: '\
+                    % ({'type': ovl_type})
+                correct = get_ans(msg)
+            while not ovl_type or not correct:
+                msg = 'Please provide overlay type: '
+                ovl_type = self.check_overlay_type(\
+                            get_input(msg, color='yellow'))
+                correct = True
+
+            sources.append(ovl_type)
+            if 'branch' in self.required:
+                msg = 'Define source%(extra)s branch (if applicable): '\
+                      % {'extra': extra}
+                sources.append(get_input(msg))
             else:
-                sources.append(get_input('Define source URL: '))
-
-                ovl_type = self.guess_overlay_type(sources[0])
-                if ovl_type:
-                    msg = 'Is %(type)s the correct overlay type?: '\
-                           % ({'type': ovl_type})
-                    correct = get_ans(msg)
-                while not ovl_type or not correct:
-                    msg = 'Please provide overlay type: '
-                    ovl_type = self.check_overlay_type(\
-                                   get_input(msg, color='yellow'))
-                    correct = True
-
-                sources.append(ovl_type)
-                if 'branch' in self.required:
-                    msg = 'Define source branch (if applicable): '
-                    sources.append(get_input(msg))
-                else:
-                    sources.append('')
+                sources.append('')
+
             if self.auto_complete:
                 sources = self._set_additional_info(sources)
                 for source in sources:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-08-28  1:48 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-08-28  1:48 UTC (permalink / raw
  To: gentoo-commits

commit:     b5239542b305a6b2638b5dc8cfe19ddb3fe09ef4
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 00:52:16 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 00:52:18 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=b5239542

utils.py: Gives create_overlay_dict a well needed updating

As this function exists with the API consumer in mind the function
was well overdue for getting it the result keys updated to reflect
all the ongoing changes in layman's API.

 layman/utils.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index b8e1e2a..9530701 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -331,13 +331,12 @@ def create_overlay_dict(**kwargs):
     """
     result = {
         'name': '',
-        'owner_name': '',
-        'owner_email': '',
+        'owner': [],
         'homepage': '',
         'irc': '',
-        'description': '',
-        'feeds': [],
-        'sources': [('','','')],
+        'description': [],
+        'feed': [],
+        'source': [('','','')],
         'priority': 50,
         'quality': 'experimental',
         'status': '',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-08-04  1:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-08-04  1:05 UTC (permalink / raw
  To: gentoo-commits

commit:     d95ae901856d94b2f7693b58aaa5618582c17280
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  4 01:02:38 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Aug  4 01:02:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d95ae901

update.py: Adds functionality to ensure proper sqlite migration

 layman/updater.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 746373d..25abf72 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -140,7 +140,10 @@ class Main(object):
         self.output.info(msg)
 
         try:
-            shutil.copy(installed, backup_name)
+            if migrate_type in ('json', 'xml'):
+                shutil.copy(installed, backup_name)
+            else:
+                shutil.move(installed, backup_name)
         except IOError as err:
             msg = '  migrate_database() error; failed to back up old database '\
                   'file.\n  Error was: %(err)s' % {'err': err}


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-19  3:53 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-19  3:53 UTC (permalink / raw
  To: gentoo-commits

commit:     4adf2984147062b8cadc5e769aa49c48abab2e93
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 19 03:50:25 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Jul 19 03:52:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=4adf2984

updater.py: Modifies the db_type setting method

In order to preserve the config file set up of the layman config
file the set_db_type() function has been modified to not use
configparser as it doesn't preserve comments. Changes have also
been made in case the database file ends with the old extension,
so the backup name will end in ".bak" as opposed to the database's
file type.

 layman/updater.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index f727632..9d7b176 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -7,6 +7,7 @@ import argparse
 import os
 import shutil
 import sys
+import re
 
 from layman.api           import LaymanAPI
 from layman.compatibility import fileopen
@@ -122,8 +123,10 @@ class Main(object):
 
         db = DB(self.config)
         installed = self.config['installed']
-        backup_name = installed + '.' + self.config['db_type']
         old_ext = os.path.splitext(installed)[1]
+        backup_name = installed + '.' + self.config['db_type']
+        if old_ext == self.config['db_type']:
+            backup_name = installed + '.bak'
         new_name = installed.replace(old_ext, '.db')
 
         if not os.path.isfile(installed):
@@ -271,17 +274,15 @@ class Main(object):
         repos_conf = ConfigHandler(self.config, overlays)
         repos_conf.write()
 
-    def set_db_type(self, migrate_type, installed):
-        if sys.hexversion >= 0x30200f0:
-            import configparser as ConfigParser
-        else:
-            import ConfigParser
 
-        config = ConfigParser.ConfigParser()
+    def set_db_type(self, migrate_type, installed):
         config_path = self.config['config']\
                       % {'configdir': self.config['configdir']}
+        db_type_found = False
+        installed_found = False
         new_conf = os.path.dirname(config_path) + '/' + '._cfg0000_' +\
                    os.path.basename(config_path)
+        new_lines = []
 
         try:
             shutil.copy(config_path, new_conf)
@@ -300,15 +301,28 @@ class Main(object):
             raise Exception(msg)
 
         try:
-            config.read(new_conf)
+            with fileopen(new_conf, 'r') as laymanconf:
+                lines = laymanconf.readlines()
         except Exception as err:
             msg = '  set_db_type() error; failed to read config at "%(path)s".'\
                   '\n  Error was: "%(err)s"' % {'path': new_conf, 'err': err}
             self.output.error(msg)
             raise err
 
-        config.set('MAIN', 'db_type', migrate_type)
-        config.set('MAIN', 'installed', '%(storage)s/'+installed)
+        for line in lines:
+            if re.search('^#*\s*db_type\s*:', line):
+                db_type_found = True
+                line = 'db_type : ' + migrate_type + '\n'
+            if re.search('^#*\s*installed\s*:', line):
+                installed_found = True
+                line = 'installed : %(storage)s/' + installed + '\n'
+            new_lines.append(line)
+
+        if not db_type_found:
+            new_lines.append('db_type : ' + migrate_type + '\n')
+        if not installed_found:
+            new_lines.append('installed : %(storage)s/' + installed + '\n')
 
         with fileopen(new_conf, 'w') as laymanconf:
-            config.write(laymanconf)
+            for line in new_lines:
+                laymanconf.write(line)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-17 17:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-17 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     3c05ffbe24899799a6b744212e7308d251679932
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 17 16:25:59 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Jul 17 16:26:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=3c05ffbe

updater.py: Cleans up imports

 layman/updater.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 1959a31..54ea86a 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -3,15 +3,14 @@
 
 from __future__ import unicode_literals
 
-from sys import stderr
+import argparse
 import os
 import sys
-import argparse
 
-from layman.config import OptionConfig
-from layman.api import LaymanAPI
-from layman.version import VERSION
+from layman.api           import LaymanAPI
 from layman.compatibility import fileopen
+from layman.config        import OptionConfig
+from layman.version       import VERSION
 
 if sys.hexversion >= 0x30200f0:
     STR = str


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-17 17:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-17 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     46846091abef6fb8339ad640c1baa25c63e85bc9
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 17 16:12:26 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Jul 17 16:18:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=46846091

constants.py: Adds constant DB_TYPES for supported db checking

 layman/constants.py | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/layman/constants.py b/layman/constants.py
index a39071f..f8292f7 100644
--- a/layman/constants.py
+++ b/layman/constants.py
@@ -1,8 +1,8 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-#################################################################################
+################################################################################
 # LAYMAN CONSTANTS
-#################################################################################
+################################################################################
 # File:       constants.py
 #
 #             Handles layman actions via the command line interface.
@@ -26,11 +26,11 @@ __version__ = "$Id: constants.py 2011-01-16 23:52 PST Brian Dolbec$"
 
 
 
-#################################################################################
+################################################################################
 ##
 ## Color codes (taken from portage)
 ##
-#################################################################################
+################################################################################
 
 esc_seq = '\x1b['
 
@@ -57,31 +57,38 @@ DEBUG_VERBOSITY = 2
 FAILURE = 1
 SUCCEED = 0
 
-#################################################################################
+################################################################################
 ##
 ## Overlay components
 ##
-#################################################################################
+################################################################################
 
 COMPONENT_DEFAULTS  = ['name', 'description', 'owner', 'type', 'source']
 POSSIBLE_COMPONENTS = ['name', 'description', 'homepage', 'owner', 'quality',
                        'priority', 'source', 'branch', 'irc', 'feed']
 
-###############################################################################
+################################################################################
 ##
 ## Archive overlay possible file extensions
 ##
-###############################################################################
+################################################################################
 
 FILE_EXTENSIONS = {'Squashfs': ('.squashfs', '.squash', '.sqfs', '.sfs'),
                    'Tar': ('bz2', 'gz', 'lzma', 'xz', 'Z', 'tgz', 'tbz', 'taz',
                            'tlz', 'txz'),
                   }
 
-###################################################################################
+################################################################################
 ##
 ## Overlay types mountable by script
 ##
-####################################################################################
+################################################################################
 
 MOUNT_TYPES = ['Squashfs']
+
+################################################################################
+##
+## Supported database types
+##
+################################################################################
+DB_TYPES = ['json', 'xml']


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-17 17:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-17 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     8448d587d1e8367ba5b2cc5aa6214166dc0649f1
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 17 17:05:01 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Jul 17 17:06:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8448d587

updater.py: Adds database migration tool

 layman/updater.py | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 54ea86a..f727632 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -5,11 +5,14 @@ from __future__ import unicode_literals
 
 import argparse
 import os
+import shutil
 import sys
 
 from layman.api           import LaymanAPI
 from layman.compatibility import fileopen
 from layman.config        import OptionConfig
+from layman.constants     import DB_TYPES
+from layman.db            import DB
 from layman.version       import VERSION
 
 if sys.hexversion >= 0x30200f0:
@@ -56,6 +59,8 @@ class Main(object):
             help = 'Print the NEW INSTALL help messages.')
         self.parser.add_argument("-c", "--config",
             help='the path to config file')
+        self.parser.add_argument("-m", "--migrate_db",
+            help="the database you'd like to migrate to")
         self.parser.add_argument("-R", "--rebuild", action='store_true',
             help='rebuild the Package Manager config file')
         self.parser.add_argument('--version', action='version',
@@ -88,7 +93,8 @@ class Main(object):
             self.print_instructions()
         elif not self.check_is_new(self.args.rebuild):
             self.rename_check()
-
+        if self.args.migrate_db:
+            self.migrate_database(self.args.migrate_db)
 
     def check_is_new(self, rebuild=False):
         print_instructions = False
@@ -106,6 +112,61 @@ class Main(object):
         return False
 
 
+
+    def migrate_database(self, migrate_type):
+        if migrate_type not in DB_TYPES:
+            msg = 'migrate_database() error; invalid migration type: '\
+                  '"%(db_type)s"' % {'db_type': migrate_type}
+            self.output.error('  ' + msg)
+            raise Exception(msg)
+
+        db = DB(self.config)
+        installed = self.config['installed']
+        backup_name = installed + '.' + self.config['db_type']
+        old_ext = os.path.splitext(installed)[1]
+        new_name = installed.replace(old_ext, '.db')
+
+        if not os.path.isfile(installed):
+            msg = 'migrate_database() error; database file "%(loc)s" does not '\
+                  'exist!' % {'loc': backup_name}
+            self.output.error('  ' + msg)
+            raise Exception(msg)
+
+        msg = '  Creating backup of "%(db)s" at:\n "%(loc)s"\n'\
+              % {'db': installed, 'loc': backup_name}
+        self.output.info(msg)
+
+        try:
+            shutil.copy(installed, backup_name)
+        except IOError as err:
+            msg = '  migrate_database() error; failed to back up old database '\
+                  'file.\n  Error was: %(err)s' % {'err': err}
+            self.output.error(msg)
+            raise err
+
+        db.write(installed, migrate_type=migrate_type)
+
+        try:
+            os.rename(installed, new_name)
+        except OSError as err:
+            msg = '  migrate_database() error: failed to rename old database '\
+                  ' to "%(name)s".\n  Error was: %(err)s' % {'err': err}
+            self.output.error(msg)
+            raise err
+
+        msg = '  Successfully migrated database from "%(from_type)s" to '\
+              '"%(to_type)s"\n' % {'from_type': self.config['db_type'],
+                                   'to_type': migrate_type}
+        self.output.info(msg)
+
+        self.set_db_type(migrate_type, os.path.basename(installed))
+
+        msg = '  Warning: Please be sure to update your config file via '\
+              'the\n  `dispatch-conf` command or you *will* lose database '\
+              'functionality!\n'
+        self.output.warn(msg)
+
+
     def rename_check(self):
         '''Checks for and renames the installed db if needed
         '''
@@ -209,3 +270,45 @@ class Main(object):
         from layman.config_modules.reposconf.reposconf import ConfigHandler
         repos_conf = ConfigHandler(self.config, overlays)
         repos_conf.write()
+
+    def set_db_type(self, migrate_type, installed):
+        if sys.hexversion >= 0x30200f0:
+            import configparser as ConfigParser
+        else:
+            import ConfigParser
+
+        config = ConfigParser.ConfigParser()
+        config_path = self.config['config']\
+                      % {'configdir': self.config['configdir']}
+        new_conf = os.path.dirname(config_path) + '/' + '._cfg0000_' +\
+                   os.path.basename(config_path)
+
+        try:
+            shutil.copy(config_path, new_conf)
+        except IOError as err:
+            msg = '  set_db_type() error; failed to copy "%(old)s" to '\
+                  '"%(new)s\n  Error was: %(err)s"' % {'old': config_path,
+                                                       'new': new_conf,
+                                                       'err': err}
+            self.output.error(msg)
+            raise err
+
+        if not os.path.isfile(new_conf):
+            msg = 'set_db_type() error; failed to read config at "%(path)s".'\
+                  % {'path': new_conf}
+            self.output.error('  ' + msg)
+            raise Exception(msg)
+
+        try:
+            config.read(new_conf)
+        except Exception as err:
+            msg = '  set_db_type() error; failed to read config at "%(path)s".'\
+                  '\n  Error was: "%(err)s"' % {'path': new_conf, 'err': err}
+            self.output.error(msg)
+            raise err
+
+        config.set('MAIN', 'db_type', migrate_type)
+        config.set('MAIN', 'installed', '%(storage)s/'+installed)
+
+        with fileopen(new_conf, 'w') as laymanconf:
+            config.write(laymanconf)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-15 16:15 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-15 16:15 UTC (permalink / raw
  To: gentoo-commits

commit:     1a95bc82b26678e8dc22560949756f6580169855
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 16:15:29 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 16:15:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=1a95bc82

version.py: Changes version to 2.4.0-git

As the next release will include some noticeable changes an increment
of the second version number in layman was necessary.

 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index ee73005..e6d19ff 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.3.1-git'
+VERSION = '2.4.0-git'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-15 15:53 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-15 15:53 UTC (permalink / raw
  To: gentoo-commits

commit:     57848c6abf1a43a9df8efcefc4cbe2297d4ecac4
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 15:54:28 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 15:54:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=57848c6a

dbbase.py: Optimizes if check for db_type

 layman/dbbase.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 0bdd4e9..283d65c 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -179,10 +179,10 @@ class DbBase(object):
         '''
         Read the overlay database for installed overlay definitions.
         '''
+        db_type = self.db_type
+
         if text and text_type:
             db_type = text_type
-        else:
-            db_type = self.db_type
 
         #Added to keep xml functionality for cached overlay XML definitions
         if 'cache' in path and '.xml' in path:
@@ -197,11 +197,16 @@ class DbBase(object):
         db_ctl.read_db(path, text=text)
 
 
-    def write(self, path):
+    def write(self, path, migrate_type=None):
         '''
         Write the list of overlays to a file.
         '''
-        db_ctl = self.mod_ctl.get_class(self.db_type)(self.config,
+        db_type = self.db_type
+
+        if migrate_type:
+            db_type = migrate_type
+
+        db_ctl = self.mod_ctl.get_class(db_type)(self.config,
                  self.overlays,
                  self.paths,
                  self.ignore,


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-13 23:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-13 23:05 UTC (permalink / raw
  To: gentoo-commits

commit:     d4a11440154449a27357dc2b670803220e7c2f06
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 13 23:05:39 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Jul 13 23:05:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d4a11440

dbbase.py: Adds limitation to use only one db type

 layman/dbbase.py | 48 +++++++++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 09133c2..0bdd4e9 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -82,7 +82,7 @@ class DbBase(object):
            ignore_init_read_errors=False, allow_missing=False):
 
         self.config = config
-        self.db_types = config['db_type']
+        self.db_type = config['db_type']
         self.ignore = ignore
         self.ignore_init_read_errors = ignore_init_read_errors
         self.mod_ctl = Modules(path=MOD_PATH,
@@ -96,8 +96,16 @@ class DbBase(object):
 
         self.output.debug('Initializing overlay list handler', 8)
 
-        if isinstance(self.db_types, STR):
-            self.db_types = [x.strip() for x in self.db_types.split(',')]
+        if isinstance(self.db_type, STR):
+            self.db_type = [x.strip() for x in self.db_type.split(',')]
+
+        if len(self.db_type) > 1:
+            msg = 'DbBase; warning, multiple instances of "db_type" found:'\
+                  ' %(db_types)s.\nDefaulting to: %(db_type)s'\
+                  % {'db_types': self.db_type, 'db_type': self.db_type[0]}
+            self.output.warn(msg)
+
+        self.db_type = self.db_type[0]
 
         for path in self.paths:
             if not os.path.exists(path):
@@ -172,32 +180,34 @@ class DbBase(object):
         Read the overlay database for installed overlay definitions.
         '''
         if text and text_type:
-            types = [text_type]
+            db_type = text_type
         else:
-            types = self.db_types
+            db_type = self.db_type
+
+        #Added to keep xml functionality for cached overlay XML definitions
+        if 'cache' in path and '.xml' in path:
+            db_type = 'xml_db'
 
-        for t in types:
-            db_ctl = self.mod_ctl.get_class(t)(self.config,
-                     self.overlays,
-                     self.paths,
-                     self.ignore,
-                     self.ignore_init_read_errors)
+        db_ctl = self.mod_ctl.get_class(db_type)(self.config,
+                 self.overlays,
+                 self.paths,
+                 self.ignore,
+                 self.ignore_init_read_errors)
 
-            db_ctl.read_db(path, text=text)
+        db_ctl.read_db(path, text=text)
 
 
     def write(self, path):
         '''
         Write the list of overlays to a file.
         '''
-        for types in self.db_types:
-            db_ctl = self.mod_ctl.get_class(types)(self.config,
-                     self.overlays,
-                     self.paths,
-                     self.ignore,
-                     self.ignore_init_read_errors)
+        db_ctl = self.mod_ctl.get_class(self.db_type)(self.config,
+                 self.overlays,
+                 self.paths,
+                 self.ignore,
+                 self.ignore_init_read_errors)
 
-            db_ctl.write(path)
+        db_ctl.write(path)
 
 
     def select(self, overlay):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-13 13:26 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-13 13:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 13 13:25:36 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Jul 13 13:25:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=a3ef79ec

Adds switch on read_db if text is provided

Logically speaking, if the database "document" text is provided then
it will likely not be universal to every database provided. Therefore
adding another parameter that specifies the type of text that is being
provided will help distinguish which database type it is.

 layman/dbbase.py   | 11 ++++++++---
 layman/remotedb.py |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 56ef158..09133c2 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -167,12 +167,17 @@ class DbBase(object):
         return
 
 
-    def read_db(self, path, text=None):
+    def read_db(self, path, text=None, text_type=None):
         '''
         Read the overlay database for installed overlay definitions.
         '''
-        for types in self.db_types:
-            db_ctl = self.mod_ctl.get_class(types)(self.config,
+        if text and text_type:
+            types = [text_type]
+        else:
+            types = self.db_types
+
+        for t in types:
+            db_ctl = self.mod_ctl.get_class(t)(self.config,
                      self.overlays,
                      self.paths,
                      self.ignore,

diff --git a/layman/remotedb.py b/layman/remotedb.py
index cd6ece3..89caf7a 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -280,7 +280,7 @@ class RemoteDB(DbBase):
     def _check_download(self, olist, url):
 
         try:
-            self.read_db(url, text=olist)
+            self.read_db(url, text=olist, text_type="xml_db")
         except Exception as error:
             self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n"
                 % url,2)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-09 17:23 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-09 17:23 UTC (permalink / raw
  To: gentoo-commits

commit:     37a7107a3eaca6a91b48b4e588be247f43107c6f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  9 17:24:09 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Jul  9 17:24:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=37a7107a

api.py: Removes annoying lack of space in error message

 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 5a02aab..0718dce 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -561,7 +561,7 @@ class LaymanAPI(object):
                 % str(dbreload),8)
         except Exception as error:
             self.output.error('Failed to fetch overlay list!\n Original Error'
-                              'was:\n%(err)s' % {'err': error})
+                              ' was:\n%(err)s' % {'err': error})
             return False
         self.get_available(dbreload)
         return succeeded


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-07-09 16:18 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-07-09 16:18 UTC (permalink / raw
  To: gentoo-commits

commit:     17fa547f5653b60c67270b1b3fffbc82d20dd09b
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  9 16:17:13 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Jul  9 16:17:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=17fa547f

dbbase.py: Adds use of db module plug-in system

Other changes include code clean up and the disabling of the add_new()
function. Currently the DbBase only supports the XML DBHandler but
more support will be added soon.

 layman/dbbase.py | 143 +++++++++++++++++++++++--------------------------------
 1 file changed, 59 insertions(+), 84 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 3e47384..b6c32bc 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -5,12 +5,13 @@
 #################################################################################
 # File:       dbbase.py
 #
-#             Access to an xml list of overlays
+#             Main handler of overlay database(s).
 #
 # Copyright:
 #             (c) 2005 - 2009 Gunnar Wrobel
 #             (c) 2009        Sebastian Pipping
 #             (c) 2009        Christian Groschupp
+#             (c) 2015        Devan Franchini
 #             Distributed under the terms of the GNU General Public License v2
 #
 # Author(s):
@@ -19,11 +20,11 @@
 #             Christian Groschupp <christian@groschupp.org>
 #             Devan Franchini <twitch153@gentoo.org>
 #
-'''Main handler for overlays.'''
+'''Main handler for overlay database(s).'''
 
 from __future__ import unicode_literals
 
-__version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
+__version__ = "$Id: dbbase.py 273 2015-07-09 11:35:55Z twitch153 $"
 
 #===============================================================================
 #
@@ -34,22 +35,22 @@ __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
 import os
 import os.path
 import sys
-import xml
-import xml.etree.ElementTree as ET # Python 2.5
 
-#from   layman.debug              import OUT
-from   layman.utils              import indent
-from   layman.compatibility      import fileopen
+from   layman.module             import Modules
 from   layman.overlays.overlay   import Overlay
 
 
 #py3.2+
 if sys.hexversion >= 0x30200f0:
     _UNICODE = 'unicode'
+    STR = str
 else:
     _UNICODE = 'UTF-8'
+    STR = basestring
 
 
+MOD_PATH = os.path.join(os.path.dirname(__file__), 'db_modules')
+
 #===============================================================================
 #
 # Class UnknownOverlayException
@@ -65,25 +66,6 @@ class UnknownOverlayException(Exception):
     def __str__(self):
         return UnknownOverlayMessage(self.repo_name)
 
-#===============================================================================
-#
-# Class BrokenOverlayCatalog
-#
-#-------------------------------------------------------------------------------
-
-class BrokenOverlayCatalog(ValueError):
-    def __init__(self, origin, expat_error, hint=None):
-        if hint == None:
-            hint = ''
-        else:
-            hint = '\nHint: %s' % hint
-
-        super(BrokenOverlayCatalog, self).__init__(
-            'XML parsing failed for "%(origin)s" (line %(line)d, column'\
-            '%(column)d)%(hint)s' % {'line': expat_error.lineno,
-                                     'column':expat_error.offset + 1,
-                                     'origin':origin, 'hint':hint})
-
 
 #===============================================================================
 #
@@ -96,29 +78,38 @@ class DbBase(object):
     Handle a list of overlays.
     '''
 
-    def __init__(self, config, paths=None, ignore = 0,
-        ignore_init_read_errors=False, allow_missing=False):
+    def __init__(self, config, paths=None, ignore=0,
+           ignore_init_read_errors=False, allow_missing=False):
 
         self.config = config
+        self.db_types = config['db_type']
         self.ignore = ignore
-        self.paths = paths
+        self.ignore_init_read_errors = ignore_init_read_errors
+        self.mod_ctl = Modules(path=MOD_PATH,
+                               namepath='layman.db_modules',
+                               output=config['output'])
         self.output = config['output']
         self.overlays = {}
-        self.ignore_init_read_errors = ignore_init_read_errors
+        self.paths = paths
+
         path_found = False
 
         self.output.debug('Initializing overlay list handler', 8)
 
+        if isinstance(self.db_types, STR):
+            self.db_types = [x.strip() for x in self.db_types.split(',')]
+
         for path in self.paths:
             if not os.path.exists(path):
                 continue
 
-            self.read_file(path)
+            self.read_db(path)
             path_found = True
 
         if not path_found and not allow_missing:
-            msg = "Warning: an installed db file was not found at: %(path)s"
-            self.output.warn(msg % {'path': str(self.paths)})
+            msg = 'Warning: an installed db file was not found at: %(path)s'\
+                   % {'path': str(self.paths)}
+            self.output.warn(msg)
 
 
     def __eq__(self, other):
@@ -132,21 +123,19 @@ class DbBase(object):
         return not self.__eq__(other)
 
 
-    def read_file(self, path):
+    def _add_from_dict(self, overlays=None):
         '''
-        Read the overlay definition file.
+        Add a new overlay from a list of dictionary values
         '''
-        try:
-            with fileopen(path, 'r') as df:
-                document = df.read()
+        self.output.info('DbBase: add_from_dict()')
 
-        except Exception as error:
-            if not self.ignore_init_read_errors:
-                self.output.error('Failed to read the overlay list at ("'
-                    + path + '")')
-                raise error
+        for overlay in overlays:
+            self.output.debug('Parsing overlay entry', 8)
+            ovl = Overlay(self.config, ovl_dict=overlay,
+                          ignore=self.ignore)
+            self.overlays[ovl.name] = ovl
 
-        self.read(document, origin=path)
+        return
 
 
     def _broken_catalog_hint(self):
@@ -154,31 +143,17 @@ class DbBase(object):
         msg = 'Method "%(name)s.%(func)s" not implemented'\
               % {'name': self.__class__.__name__,
                  'func': this_function_name}
-        raise NotImplementedError(msg)
 
-
-    def read(self, text, origin):
-        '''
-        Read an xml list of overlays (adding to and potentially overwriting
-        existing entries)
-        '''
-        try:
-            document = ET.fromstring(text)
-        except xml.parsers.expat.ExpatError as err:
-            raise BrokenOverlayCatalog(origin, err, self._broken_catalog_hint())
-
-        overlays = document.findall('overlay') + document.findall('repo')
-
-        for overlay in overlays:
-            self.output.debug('Parsing overlay: %s' % overlay, 9)
-            ovl = Overlay(config=self.config, xml=overlay, ignore=self.ignore)
-            self.overlays[ovl.name] = ovl
+        raise NotImplementedError(msg)
 
 
     def add_new(self, xml=None, origin=None, from_dict=None):
         '''
         Reads xml text and dictionary definitions and adds
         them to the db.
+
+        NOTE: Currently being refactored. Will be disabled until fixed.
+        '''
         '''
         if xml is not None:
             self.read(xml, origin)
@@ -187,39 +162,37 @@ class DbBase(object):
             if isinstance(from_dict, dict):
                 from_dict = [from_dict]
             self._add_from_dict(from_dict)
+        '''
 
         return
 
 
-    def _add_from_dict(self, overlays=None):
+    def read_db(self, path):
         '''
-        Add a new overlay from a list of dictionary values
+        Read the overlay database for installed overlay definitions.
         '''
-        self.output.info("DbBase: add_from_dict()")
-        for overlay in overlays:
-            self.output.debug('Parsing overlay entry', 8)
-            ovl = Overlay(self.config, ovl_dict=overlay,
-                    ignore=self.ignore)
-            self.overlays[ovl.name] = ovl
-        return
+        for types in self.db_types:
+            db_ctl = self.mod_ctl.get_class(types)(self.config,
+                     self.overlays,
+                     self.paths,
+                     self.ignore,
+                     self.ignore_init_read_errors)
+
+            db_ctl.read_db(path)
 
 
     def write(self, path):
         '''
         Write the list of overlays to a file.
         '''
-        tree = ET.Element('repositories', version="1.0", encoding=_UNICODE)
-        tree[:] = [e.to_xml() for e in self.overlays.values()]
-        indent(tree)
-        tree = ET.ElementTree(tree)
-        try:
-            with fileopen(path, 'w') as f:
-                 tree.write(f, encoding=_UNICODE)
+        for types in self.db_types:
+            db_ctl = self.mod_ctl.get_class(types)(self.config,
+                     self.overlays,
+                     self.paths,
+                     self.ignore,
+                     self.ignore_init_read_errors)
 
-        except Exception as err:
-            msg = 'Failed to write to local overlays file: %(path)s\nError was'\
-                  ':\n%(err)s' % {'path': path, 'err': err}
-            raise Exception(msg)
+            db_ctl.write(path)
 
 
     def select(self, overlay):
@@ -239,7 +212,8 @@ class DbBase(object):
             raise UnknownOverlayException(overlay)
         return self.overlays[overlay]
 
-    def list(self, repos=None, verbose = False, width = 0):
+
+    def list(self, repos=None, verbose=False, width=0):
         '''
         List all overlays.
         '''
@@ -262,6 +236,7 @@ class DbBase(object):
 
         return result
 
+
     def list_ids(self):
         '''
         Returns a list of the overlay names


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-06-16  3:45 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-06-16  3:45 UTC (permalink / raw
  To: gentoo-commits

commit:     7931ddc64b93574920fdc559927715b6e8b5d258
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 16 03:45:40 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Jun 16 03:45:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=7931ddc6

cli.py: Removes docstring test and provides docstring description

 layman/cli.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index 81b10cd..bb9ea6f 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -108,8 +108,7 @@ class ListPrinter(object):
 
     def short_list(self, overlay):
         '''
-        >>> print(short_list(overlay))
-        wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
+        Returns a list of information regarding the provided overlay parameter.
         '''
         name   = pad(overlay['name'], 25)
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-06-14  4:12 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-06-14  4:12 UTC (permalink / raw
  To: gentoo-commits

commit:     5d35a885435a5e01e9073826dcd6ad5c7a73201b
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 14 04:09:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Jun 14 04:09:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5d35a885

dbbase.py: Code cleanup

Cleans up things including:
    * docstring formatting, and file name in docstring
    * line spacing and formatting to coincide throughout the file
    * error message output
    * etc

 layman/dbbase.py | 99 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 43 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 4c3bf5f..3e47384 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -1,9 +1,9 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 #################################################################################
-# LAYMAN OVERLAY HANDLER
+# LAYMAN DB BASE
 #################################################################################
-# File:       overlay.py
+# File:       dbbase.py
 #
 #             Access to an xml list of overlays
 #
@@ -17,6 +17,7 @@
 #             Gunnar Wrobel <wrobel@gentoo.org>
 #             Sebastian Pipping <sebastian@pipping.org>
 #             Christian Groschupp <christian@groschupp.org>
+#             Devan Franchini <twitch153@gentoo.org>
 #
 '''Main handler for overlays.'''
 
@@ -78,8 +79,10 @@ class BrokenOverlayCatalog(ValueError):
             hint = '\nHint: %s' % hint
 
         super(BrokenOverlayCatalog, self).__init__(
-            'XML parsing failed for "%(origin)s" (line %(line)d, column %(column)d)%(hint)s' % \
-            {'line':expat_error.lineno, 'column':expat_error.offset + 1, 'origin':origin, 'hint':hint})
+            'XML parsing failed for "%(origin)s" (line %(line)d, column'\
+            '%(column)d)%(hint)s' % {'line': expat_error.lineno,
+                                     'column':expat_error.offset + 1,
+                                     'origin':origin, 'hint':hint})
 
 
 #===============================================================================
@@ -89,23 +92,23 @@ class BrokenOverlayCatalog(ValueError):
 #-------------------------------------------------------------------------------
 
 class DbBase(object):
-    ''' Handle a list of overlays.'''
+    '''
+    Handle a list of overlays.
+    '''
 
     def __init__(self, config, paths=None, ignore = 0,
-        ignore_init_read_errors=False, allow_missing=False
-        ):
+        ignore_init_read_errors=False, allow_missing=False):
 
         self.config = config
-        self.paths = paths
         self.ignore = ignore
+        self.paths = paths
         self.output = config['output']
-        self.ignore_init_read_errors = ignore_init_read_errors
-
         self.overlays = {}
+        self.ignore_init_read_errors = ignore_init_read_errors
+        path_found = False
 
         self.output.debug('Initializing overlay list handler', 8)
 
-        path_found = False
         for path in self.paths:
             if not os.path.exists(path):
                 continue
@@ -114,8 +117,8 @@ class DbBase(object):
             path_found = True
 
         if not path_found and not allow_missing:
-            self.output.warn("Warning: an installed db file was not found at: %s"
-                % str(self.paths))
+            msg = "Warning: an installed db file was not found at: %(path)s"
+            self.output.warn(msg % {'path': str(self.paths)})
 
 
     def __eq__(self, other):
@@ -130,8 +133,9 @@ class DbBase(object):
 
 
     def read_file(self, path):
-        '''Read the overlay definition file.'''
-
+        '''
+        Read the overlay definition file.
+        '''
         try:
             with fileopen(path, 'r') as df:
                 document = df.read()
@@ -147,32 +151,33 @@ class DbBase(object):
 
     def _broken_catalog_hint(self):
         this_function_name = sys._getframe().f_code.co_name
-        raise NotImplementedError('Method "%s.%s" not implemented' % \
-                (self.__class__.__name__, this_function_name))
+        msg = 'Method "%(name)s.%(func)s" not implemented'\
+              % {'name': self.__class__.__name__,
+                 'func': this_function_name}
+        raise NotImplementedError(msg)
 
 
     def read(self, text, origin):
         '''
-        Read an xml list of overlays (adding to and potentially overwriting existing entries)
+        Read an xml list of overlays (adding to and potentially overwriting
+        existing entries)
         '''
         try:
             document = ET.fromstring(text)
-        except xml.parsers.expat.ExpatError as error:
-            raise BrokenOverlayCatalog(origin, error, self._broken_catalog_hint())
+        except xml.parsers.expat.ExpatError as err:
+            raise BrokenOverlayCatalog(origin, err, self._broken_catalog_hint())
 
-        overlays = document.findall('overlay') + \
-                document.findall('repo')
+        overlays = document.findall('overlay') + document.findall('repo')
 
         for overlay in overlays:
             self.output.debug('Parsing overlay: %s' % overlay, 9)
-            ovl = Overlay(config=self.config, xml=overlay,
-                    ignore=self.ignore)
+            ovl = Overlay(config=self.config, xml=overlay, ignore=self.ignore)
             self.overlays[ovl.name] = ovl
-        return
 
 
     def add_new(self, xml=None, origin=None, from_dict=None):
-        '''Reads xml text and dictionary definitions and adds
+        '''
+        Reads xml text and dictionary definitions and adds
         them to the db.
         '''
         if xml is not None:
@@ -187,8 +192,9 @@ class DbBase(object):
 
 
     def _add_from_dict(self, overlays=None):
-        """Add a new overlay from a list of dictionary values
-        """
+        '''
+        Add a new overlay from a list of dictionary values
+        '''
         self.output.info("DbBase: add_from_dict()")
         for overlay in overlays:
             self.output.debug('Parsing overlay entry', 8)
@@ -202,7 +208,6 @@ class DbBase(object):
         '''
         Write the list of overlays to a file.
         '''
-
         tree = ET.Element('repositories', version="1.0", encoding=_UNICODE)
         tree[:] = [e.to_xml() for e in self.overlays.values()]
         indent(tree)
@@ -211,20 +216,26 @@ class DbBase(object):
             with fileopen(path, 'w') as f:
                  tree.write(f, encoding=_UNICODE)
 
-        except Exception as error:
-            raise Exception('Failed to write to local overlays file: '
-                            + path + '\nError was:\n' + str(error))
+        except Exception as err:
+            msg = 'Failed to write to local overlays file: %(path)s\nError was'\
+                  ':\n%(err)s' % {'path': path, 'err': err}
+            raise Exception(msg)
+
 
     def select(self, overlay):
         '''
         Select an overlay from the list.
         '''
-        self.output.debug("DbBase.select(), overlay = %s" % overlay, 5)
+        ovl = {'ovl': overlay}
+        msg = 'DbBase.select(), overlay = %(ovl)s' % ovl
+        self.output.debug(msg, 5)
+
         if not overlay in self.overlays.keys():
-            self.output.debug("DbBase.select(), unknown overlay = %s"
-                % overlay, 4)
-            self.output.debug("DbBase.select(), known overlays = %s"
-                % ', '.join(self.overlays.keys()), 4)
+            msg = 'DbBase.select(), unknown overlay = %(ovl)s' % ovl
+            self.output.debug(msg, 4)
+            ovls = {'ovls': ', '.join(self.overlays.keys())}
+            msg = 'DbBase.select(), known overlays = %(ovls)s' % ovls
+            self.output.debug(ovls, 4)
             raise UnknownOverlayException(overlay)
         return self.overlays[overlay]
 
@@ -236,21 +247,23 @@ class DbBase(object):
 
         selection = [overlay for (a, overlay) in self.overlays.items()]
         if repos is not None:
-            selection = [overlay for overlay in selection if overlay.name in repos]
+            selection = [ovl for ovl in selection if ovl.name in repos]
 
         for overlay in selection:
             if verbose:
                 result.append((overlay.get_infostr(), overlay.is_supported(),
                                overlay.is_official()))
             else:
-                result.append((overlay.short_list(width), overlay.is_supported(),
-                               overlay.is_official()))
+                result.append((overlay.short_list(width),
+                               overlay.is_supported(), overlay.is_official()))
 
-        result = sorted(result, key=lambda summary_supported_official: summary_supported_official[0].lower())
+        result = sorted(result, key=lambda summary_supported_official:\
+                                summary_supported_official[0].lower())
 
         return result
 
     def list_ids(self):
-        """returns a list of the overlay names
-        """
+        '''
+        Returns a list of the overlay names
+        '''
         return sorted(self.overlays)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-06-13  4:53 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-06-13  4:53 UTC (permalink / raw
  To: gentoo-commits

commit:     47eedeb3ec092b6916e309a36adb3e9baee4024a
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 13 04:51:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Jun 13 04:51:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=47eedeb3

flocker.py: Adds file mode checking for get_file()

Ensures that the file being returned by get_file() is opened with
the correct mode.

 layman/flocker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/flocker.py b/layman/flocker.py
index aa5f3f8..3b9df64 100644
--- a/layman/flocker.py
+++ b/layman/flocker.py
@@ -73,7 +73,8 @@ class FileLocker(object):
         if mode not in ('r', 'w+'):
             raise LockingException('Invalid mode %(mode)s' % {'mode': mode})
 
-        if path not in self.files or self.files[path].closed:
+        if (path not in self.files or self.files[path].closed or
+            self.files[path].mode != mode):
             self.files[path] = fileopen(path, mode)
 
         f = self.files[path]


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-06-13  2:38 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-06-13  2:38 UTC (permalink / raw
  To: gentoo-commits

commit:     5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 13 02:38:14 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Jun 13 02:38:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5fa31f08

flocker.py: Removes assert for more verbose exception

 layman/flocker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/flocker.py b/layman/flocker.py
index 36a12b8..aa5f3f8 100644
--- a/layman/flocker.py
+++ b/layman/flocker.py
@@ -70,7 +70,8 @@ class FileLocker(object):
 
     def get_file(self, path, mode='r'):
         '''Obtains file object for given path'''
-        assert mode in ('r', 'w+')
+        if mode not in ('r', 'w+'):
+            raise LockingException('Invalid mode %(mode)s' % {'mode': mode})
 
         if path not in self.files or self.files[path].closed:
             self.files[path] = fileopen(path, mode)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-06-13  2:31 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-06-13  2:31 UTC (permalink / raw
  To: gentoo-commits

commit:     7f3945f376304360689cb8cb9c1777ed69ac4367
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 13 02:30:50 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Jun 13 02:30:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=7f3945f3

flocker.py: Adds check to ensure get_file isn't passing a closed io object

 layman/flocker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/flocker.py b/layman/flocker.py
index 21f34c3..36a12b8 100644
--- a/layman/flocker.py
+++ b/layman/flocker.py
@@ -72,7 +72,7 @@ class FileLocker(object):
         '''Obtains file object for given path'''
         assert mode in ('r', 'w+')
 
-        if path not in self.files:
+        if path not in self.files or self.files[path].closed:
             self.files[path] = fileopen(path, mode)
 
         f = self.files[path]


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-05-13 21:32 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-05-13 21:32 UTC (permalink / raw
  To: gentoo-commits

commit:     9edab5141973bd1275117cc1f2b818cf3b36d060
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 21:32:37 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 13 21:32:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=9edab514

api.py: Properly closes fatal error message brackets on line 470

 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 60ac9a8..5a02aab 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -467,7 +467,7 @@ class LaymanAPI(object):
                 #self._error(str(error))
                 fatals.append((ovl,
                     'Failed to select overlay "%(repo)s".\nError was: %(error)s'
-                     % {'repo': ovl, 'err': error))
+                     % {'repo': ovl, 'err': error}))
                 self.output.debug("API.sync(); UnknownOverlayException "
                     "selecting %(repo)s.   continuing to next ovl..."
                     % {'repo': ovl}, 5)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-05-13 21:27 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-05-13 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     8fad7fae53cb2ba0e4dbdfff570d7d5f4872c468
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 21:28:24 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 13 21:28:24 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8fad7fae

api.py: Cleans up error message structure

 layman/api.py | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 12c2368..60ac9a8 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -126,9 +126,8 @@ class LaymanAPI(object):
                 success = self._get_installed_db().delete(
                     self._get_installed_db().select(ovl))
             except Exception as e:
-                self._error(
-                        "Exception caught removing repository '"+ovl+
-                            "':\n"+str(e))
+                self._error('Exception caught removing repository "%(repo)s":\n'
+                            '%(err)s' % {'repo': ovl, 'err': e})
             results.append(success)
             self.get_installed(dbreload=True)
         if False in results:
@@ -160,8 +159,8 @@ class LaymanAPI(object):
                 success = self._get_installed_db().add(
                     self._get_remote_db().select(ovl))
             except Exception as e:
-                self._error("Exception caught installing repository '"+ovl+
-                    "' : "+str(e))
+                self._error('Exception caught installing repository "%(repo)s":'
+                            '\n%(err)s' % {'repo': ovl, 'err': e})
             results.append(success)
             self.get_installed(dbreload=True)
         if (True in results) and update_news:
@@ -202,7 +201,7 @@ class LaymanAPI(object):
                     self._get_installed_db().select(ovl))
             except Exception as e:
                 self._error('Exception caught disabling repository "%(repo)s"'\
-                    ': %(err)s' % ({'repo': ovl, 'err': e}))
+                            ':\n%(err)s' % {'repo': ovl, 'err': e})
             results.append(success)
             self.get_installed(dbreload=True)
         if (True in results) and update_news:
@@ -227,7 +226,7 @@ class LaymanAPI(object):
                     self._get_installed_db().select(ovl))
             except Exception as e:
                 self._error('Exception caught enabling repository "%(repo)s"'\
-                    ': %(err)s' % ({'repo': ovl, 'err': e}))
+                            ':\n%(err)s' % {'repo': ovl, 'err': e})
             results.append(success)
             self.get_installed(dbreload=True)
         if (True in results) and update_news:
@@ -467,18 +466,20 @@ class LaymanAPI(object):
                 #self.output.debug("API.sync(); UnknownOverlayException selecting %s" %ovl, 5)
                 #self._error(str(error))
                 fatals.append((ovl,
-                    'Failed to select overlay "' + ovl + '".\nError was: '
-                    + str(error)))
+                    'Failed to select overlay "%(repo)s".\nError was: %(error)s'
+                     % {'repo': ovl, 'err': error))
                 self.output.debug("API.sync(); UnknownOverlayException "
-                    "selecting %s.   continuing to next ovl..." %ovl, 5)
+                    "selecting %(repo)s.   continuing to next ovl..."
+                    % {'repo': ovl}, 5)
                 continue
 
             try:
                 self.output.debug("API.sync(); try: self._get_remote_db().select(ovl)", 5)
                 ordb = self._get_remote_db().select(ovl)
             except UnknownOverlayException:
-                message = 'Overlay "%s" could not be found in the remote lists.\n' \
-                        'Please check if it has been renamed and re-add if necessary.' % ovl
+                message = 'Overlay "%(repo)s" could not be found in the remote '\
+                        'lists.\nPlease check if it has been renamed and '\
+                        're-add if necessary.' % {'repo': ovl}
                 warnings.append((ovl, message))
                 (diff_type, update_url) = (False, False)
             else:
@@ -516,8 +517,8 @@ class LaymanAPI(object):
                     success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))
             except Exception as error:
                 fatals.append((ovl,
-                    'Failed to sync overlay "' + ovl + '".\nError was: '
-                    + str(error)))
+                    'Failed to sync overlay "%(repo)s".\nError was: %(err)s'
+                    % {'repo': ovl, 'err': error}))
 
         if output_results:
             if success:
@@ -559,8 +560,8 @@ class LaymanAPI(object):
                 'LaymanAPI.fetch_remote_list(); cache updated = %s'
                 % str(dbreload),8)
         except Exception as error:
-            self.output.error('Failed to fetch overlay list!\n Original Error was: '
-                    + str(error))
+            self.output.error('Failed to fetch overlay list!\n Original Error'
+                              'was:\n%(err)s' % {'err': error})
             return False
         self.get_available(dbreload)
         return succeeded


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-05-13 20:38 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-05-13 20:38 UTC (permalink / raw
  To: gentoo-commits

commit:     5087e5f1a7e958eb2b28815453c403572e9e2f1f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 20:39:20 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 13 20:39:20 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5087e5f1

flocker.py: Adds exception raising to relay errors properly

 layman/flocker.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/layman/flocker.py b/layman/flocker.py
index d40925d..21f34c3 100644
--- a/layman/flocker.py
+++ b/layman/flocker.py
@@ -22,6 +22,17 @@ import fcntl
 
 from layman.compatibility import fileopen
 
+class LockingException(Exception):
+    '''
+    Exception class for relay errors properly
+    '''
+    def __init__(self, msg):
+        self.msg = msg
+
+
+    def __str__(self):
+        return repr(self.msg)
+
 
 class FileLocker(object):
 
@@ -39,7 +50,9 @@ class FileLocker(object):
             file_mode = 'w+'
             lock_mode = fcntl.LOCK_EX
 
-        assert path not in self.locked
+        if path in self.locked:
+            raise LockingException('"%(path)s" is already locked.'
+                                    % {'path': path})
 
         self.locked.add(path)
         fcntl.flock(self.get_file(path, file_mode).fileno(), lock_mode)
@@ -47,7 +60,9 @@ class FileLocker(object):
 
     def unlock_file(self, path):
         '''Unlock the file located at path.'''
-        assert path in self.locked
+        if path not in self.locked:
+            raise LockingException('"%(path)s" is not locked, unlocking failed'
+                                    % {'path': path})
 
         fcntl.flock(self.get_file(path).fileno(), fcntl.LOCK_UN)
         self.locked.discard(path)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-05-13 20:05 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-05-13 20:05 UTC (permalink / raw
  To: gentoo-commits

commit:     5c78be3e7b9ab9c7a03e7828f679ce123c5f87ab
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 20:06:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 13 20:06:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5c78be3e

dbbase.py: Reorganizes imports

 layman/dbbase.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 7bfb60f..4c3bf5f 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -30,7 +30,9 @@ __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
 #
 #-------------------------------------------------------------------------------
 
-import sys, os, os.path
+import os
+import os.path
+import sys
 import xml
 import xml.etree.ElementTree as ET # Python 2.5
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-05-13 19:58 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-05-13 19:58 UTC (permalink / raw
  To: gentoo-commits

commit:     f73e60a7df4dfe91bc43fd0bb9cbb481fe9dc294
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 19:59:13 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 13 19:59:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=f73e60a7

flocker.py: Adds file locking utility class

 layman/flocker.py | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/layman/flocker.py b/layman/flocker.py
new file mode 100644
index 0000000..d40925d
--- /dev/null
+++ b/layman/flocker.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# File:       flocker.py
+#
+#             Handles all file locking.
+#
+# Copyright:
+#             (c) 2015 Devan Franchini
+#             Distributed under the terms of the GNU General Public License v2
+#
+# Author(s):
+#             Michał Górny <mgorny@gentoo.org>
+#             Devan Franchini <twitch153@gentoo.org>
+#
+
+#===============================================================================
+#
+# Dependencies
+#
+#-------------------------------------------------------------------------------
+import fcntl
+
+from layman.compatibility import fileopen
+
+
+class FileLocker(object):
+
+    def __init__(self):
+        self.files = {}
+        self.locked = set()
+
+
+    def lock_file(self, path, exclusive=False):
+        '''Lock the file located at path.'''
+        file_mode = 'r'
+        lock_mode = fcntl.LOCK_SH
+
+        if exclusive:
+            file_mode = 'w+'
+            lock_mode = fcntl.LOCK_EX
+
+        assert path not in self.locked
+
+        self.locked.add(path)
+        fcntl.flock(self.get_file(path, file_mode).fileno(), lock_mode)
+
+
+    def unlock_file(self, path):
+        '''Unlock the file located at path.'''
+        assert path in self.locked
+
+        fcntl.flock(self.get_file(path).fileno(), fcntl.LOCK_UN)
+        self.locked.discard(path)
+
+
+    def get_file(self, path, mode='r'):
+        '''Obtains file object for given path'''
+        assert mode in ('r', 'w+')
+
+        if path not in self.files:
+            self.files[path] = fileopen(path, mode)
+
+        f = self.files[path]
+        f.seek(0)
+
+        return f


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-04-22 17:40 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-04-22 17:40 UTC (permalink / raw
  To: gentoo-commits

commit:     46f4adc7bdf67b69d130defbfcec9f623cbfef78
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 22 17:40:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Apr 22 17:40:07 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=46f4adc7

api.py: Adds prompt for user to re-add overlay after unsuccessful URL update

X-Gentoo-Bug: 547388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/547388

 layman/api.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 82436fc..12c2368 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -26,7 +26,7 @@ from layman.remotedb        import RemoteDB
 from layman.overlays.source import require_supported
 #from layman.utils import path, delete_empty_directory
 from layman.compatibility   import encode
-from layman.utils           import verify_overlay_src
+from layman.utils           import get_ans, verify_overlay_src
 from layman.mounter         import Mounter
 
 if sys.hexversion >= 0x30200f0:
@@ -499,8 +499,11 @@ class LaymanAPI(object):
                             warnings.append((ovl, url_msg))
                             update_success = db.update(ordb, available_srcs)
                             if not update_success:
-                                self.output.warn('Failed to update repo...readding', 2)
-                                self.readd_repos(ovl)
+                                msg = 'Failed to update source URL for overlay'\
+                                      '"%(ovl)s". Re-add overlay? [y/n]'\
+                                      % {'ovl': ovl}
+                                if get_ans(msg, color='yellow'):
+                                    self.readd_repos(ovl)
                 except Exception as error:
                     self.output.warn('Failed to perform overlay type or url updates', 2)
                     self.output.warn('    for Overlay: %s' % ovl, 2)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-04-20 17:15 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-04-20 17:15 UTC (permalink / raw
  To: gentoo-commits

commit:     0c3521396aac386705a46f97c70b72785a992395
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 20 17:14:29 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Apr 20 17:14:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=0c352139

updater.py: Corrects "Package" misspelling

X-Gentoo-Bug: 546032
X-Gentoo-Bug-URL: https://bugs.gentoo.org/546032

 layman/updater.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 521f9b3..1959a31 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -58,7 +58,7 @@ class Main(object):
         self.parser.add_argument("-c", "--config",
             help='the path to config file')
         self.parser.add_argument("-R", "--rebuild", action='store_true',
-            help='rebuild the Pacakge Manager config file')
+            help='rebuild the Package Manager config file')
         self.parser.add_argument('--version', action='version',
             version='%(prog)s ' + VERSION)
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-27 23:42 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-27 23:42 UTC (permalink / raw
  To: gentoo-commits

commit:     d1bb8a0ba7e2a906db4e550d653dbabaf2d9a8b5
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 27 23:16:38 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Mar 27 23:40:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d1bb8a0b

version.py: Bumps version

 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index 75feadb..ee73005 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.3.0'
+VERSION = '2.3.1-git'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-26 22:50 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-26 22:50 UTC (permalink / raw
  To: gentoo-commits

commit:     e8f1abce52ccf6812b2b25ec6cd0f4d901302c64
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 26 22:48:39 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Mar 26 22:48:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=e8f1abce

argsparser.py: Adds proper splitting of protocol_order config option

 layman/argsparser.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 44b2ca4..eede806 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -367,6 +367,8 @@ class ArgsParser(BareConfig):
             if self.config.has_option('MAIN', 'protocol_order'):
                 protocol_order = self.config.get('MAIN', 'protocol_order')
             if protocol_order:
+                if not isinstance(protocol_order, list):
+                    protocol_order = [e.strip() for e in protocol_order.split(',')]
                 return protocol_order
 
         if key == 'overlays':


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-26 22:06 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-26 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     ba4a302400a01aa9c524cfe0cb5c6a0af1b0f010
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 26 22:05:54 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Mar 26 22:05:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=ba4a3024

argsparser.py: Fixes default override of protocol_order config option

 layman/argsparser.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index a12b95a..44b2ca4 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -358,7 +358,17 @@ class ArgsParser(BareConfig):
                 storage = self.options[key]
             if storage:
                 return storage
-                
+
+        if key == 'protocol_order':
+            protocol_order = []
+            if (key in self.options.keys()
+                and not self.options[key] is None):
+                protocol_order = self.options[key]
+            if self.config.has_option('MAIN', 'protocol_order'):
+                protocol_order = self.config.get('MAIN', 'protocol_order')
+            if protocol_order:
+                return protocol_order
+
         if key == 'overlays':
             overlays = ''
             if (key in self.options.keys()


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-24 23:08 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-24 23:08 UTC (permalink / raw
  To: gentoo-commits

commit:     85c559a59f15376aa9c68abd0b0f8ca3dfb0923b
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 24 23:05:31 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 24 23:05:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=85c559a5

updater.py: Removes unnecessary else in create_repos_conf()

An else statement which results in a false negative is being removed.

 layman/updater.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 02e85c7..521f9b3 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -199,9 +199,6 @@ class Main(object):
                                   % conf_dir)
                 self.output.error('  "%s"' % e)
                 return None
-        else:
-            msg = str(conf_dir) + ' is a directory.'
-            self.output.error('  create_repos_conf() error: %s\n' % msg)
 
         layman_inst = LaymanAPI(config=self.config)
         overlays = {}


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-24 22:56 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-24 22:56 UTC (permalink / raw
  To: gentoo-commits

commit:     c48ab55121d41869307045a59f691b1faae95e28
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 24 22:54:54 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 24 22:54:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=c48ab551

updater.py: Adds check to ensure repos_conf is not a directory

 layman/updater.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index ccf6c8d..02e85c7 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -182,15 +182,26 @@ class Main(object):
 
     def create_repos_conf(self):
         self.output.info("  Creating layman's repos.conf file")
+
+        if os.path.isdir(self.config['repos_conf']):
+            msg = '  create_repos_conf() error: %s is a directory and will\n'\
+                  '  not be written to.' % self.config['repos_conf']
+            self.output.error(msg)
+            return None
+
         conf_dir = os.path.dirname(self.config['repos_conf'])
 
         if not os.path.isdir(conf_dir):
             try:
                 os.mkdir(conf_dir)
             except OSError as e:
-                self.output.error('  create_repos_conf() error creating %s: ' % conf_dir)
+                self.output.error('  create_repos_conf() error creating %s: '\
+                                  % conf_dir)
                 self.output.error('  "%s"' % e)
                 return None
+        else:
+            msg = str(conf_dir) + ' is a directory.'
+            self.output.error('  create_repos_conf() error: %s\n' % msg)
 
         layman_inst = LaymanAPI(config=self.config)
         overlays = {}


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-24 22:20 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-24 22:20 UTC (permalink / raw
  To: gentoo-commits

commit:     8799e61f02277f75d5b0d28a7c08eed4012f8a77
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 24 22:21:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 24 22:21:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8799e61f

compatibility.py: Adds explanation for binary mode awareness

 layman/compatibility.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/layman/compatibility.py b/layman/compatibility.py
index 67ca3e6..5b3beb1 100644
--- a/layman/compatibility.py
+++ b/layman/compatibility.py
@@ -21,6 +21,8 @@ def encode(text, enc="UTF-8"):
 def fileopen(path, mode='r', enc="UTF-8"):
     """py2, py3 compatibility function"""
     try:
+        # Can cause run-time when trying to encode.
+        # See https://bugs.gentoo.org/542804
         if 'b' in mode:
             f = open(path, mode)
         else:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-24 16:08 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-24 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     708276267e3d68acdaaf81a57b0f43aa132b9cc1
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 24 16:09:01 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 24 16:09:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=70827626

compatibility.py: Adds binary mode aware compatibility to fileopen()

 layman/compatibility.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/layman/compatibility.py b/layman/compatibility.py
index 2ef4d8c..67ca3e6 100644
--- a/layman/compatibility.py
+++ b/layman/compatibility.py
@@ -21,7 +21,10 @@ def encode(text, enc="UTF-8"):
 def fileopen(path, mode='r', enc="UTF-8"):
     """py2, py3 compatibility function"""
     try:
-        f = open(path, mode, encoding=enc)
+        if 'b' in mode:
+            f = open(path, mode)
+        else:
+            f = open(path, mode, encoding=enc)
     except TypeError:
         f = open(path, mode)
     return f


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-07 22:40 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-07 22:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e76ce9635387e56896589c35c7e3ca46a939dd14
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  7 22:34:15 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Mar  7 22:34:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=e76ce963

argsparser.py: Adds "protocol_order" to list of available CLI options

 layman/argsparser.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index b504fa2..a12b95a 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -262,6 +262,18 @@ class ArgsParser(BareConfig):
                               'available number of columns automatically.')
 
         #-----------------------------------------------------------------
+        # Additional Options
+        etc_opts = self.parser.add_argument_group('<Additional options>')
+
+        etc_opts.add_argument('--protocol_order',
+                              nargs = '+',
+                              help = 'Sets the order in which protocols will '
+                              'be handled if they are present. Will only '
+                              'use the provided protocols when installing '
+                              'overlays')
+
+
+        #-----------------------------------------------------------------
         # Debug Options
 
         #self.output.cli_opts(self.parser)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-07 22:40 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-07 22:40 UTC (permalink / raw
  To: gentoo-commits

commit:     81d116ffc5d306998f8a798de567ec97d582d7a3
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  7 22:35:53 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Mar  7 22:35:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=81d116ff

config.py: Adds "protocol_order" to config defaults

 layman/config.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layman/config.py b/layman/config.py
index 4799b91..926b9d5 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -96,6 +96,7 @@ class BareConfig(object):
             'cache'     : '%(storage)s/cache',
             'local_list': '%(storage)s/overlays.xml',
             'installed': '%(storage)s/installed.xml',
+            'protocol_order': [],
             'auto_sync': 'No',
             'check_official': 'Yes',
             'conf_type': 'repos.conf',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-07 22:10 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-07 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     d5f479819a13b1f627d8766b0b376c6151712337
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  7 22:09:02 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Mar  7 22:09:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d5f47981

argsparser.py: Changes "Additional Options" to "Path Options" to reflect arg group

 layman/argsparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 43497a9..b504fa2 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -162,7 +162,7 @@ class ArgsParser(BareConfig):
                              help = 'Update all overlays.')
 
         #-----------------------------------------------------------------
-        # Additional Options
+        # Path Options
 
         path_opts = self.parser.add_argument_group('<Path options>')
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-03-07 22:02 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-03-07 22:02 UTC (permalink / raw
  To: gentoo-commits

commit:     ce18d1bbebe4b0caa814775bf008a77b969753c3
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  7 22:02:46 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Mar  7 22:02:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=ce18d1bb

config.py: Changes default conf_type to "repos.conf"

 layman/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/config.py b/layman/config.py
index cc924f5..4799b91 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -98,7 +98,7 @@ class BareConfig(object):
             'installed': '%(storage)s/installed.xml',
             'auto_sync': 'No',
             'check_official': 'Yes',
-            'conf_type': 'make.conf',
+            'conf_type': 'repos.conf',
             'require_repoconfig': 'Yes',
             'clean_archive': 'yes',
             'make_conf' : '%(storage)s/make.conf',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-21 18:41 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-21 18:41 UTC (permalink / raw
  To: gentoo-commits

commit:     1a55cb1aecddcf0651084aa5f9088d51d1b3f644
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 21 18:41:30 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Feb 21 18:41:30 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1a55cb1a

Layman.py: Due to namespace collisions the file is being renamed to Layman.py

---
 layman/{layman.py => Layman.py} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/layman/layman.py b/layman/Layman.py
similarity index 100%
rename from layman/layman.py
rename to layman/Layman.py


^ permalink raw reply	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-17  5:07 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2015-02-17  5:07 UTC (permalink / raw
  To: gentoo-commits

commit:     ddb28916e73660871ca8a6f41d69d9dd42ab9f0c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 17 05:05:31 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Feb 17 05:06:08 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ddb28916

Move Layman class initialization into a layman sub-file to prevent un-needed imports

setup.py was indirectly causing multiple imports just to get the version.
This minimizes the imports for simple layman imports like obtaining version.

---
 layman/__init__.py                | 45 ---------------------------------------
 layman/{__init__.py => layman.py} |  0
 2 files changed, 45 deletions(-)

diff --git a/layman/__init__.py b/layman/__init__.py
index 3f70381..932dc55 100644
--- a/layman/__init__.py
+++ b/layman/__init__.py
@@ -5,48 +5,3 @@
 on all gentoo repositories and overlays
 """
 
-from __future__ import unicode_literals
-
-import sys
-
-try:
-    from layman.api import LaymanAPI
-    from layman.config import BareConfig
-    from layman.output import Message
-except ImportError:
-    sys.stderr.write("!!! Layman API imports failed.")
-    raise
-
-
-
-class Layman(LaymanAPI):
-    """A complete high level interface capable of performing all
-    overlay repository actions."""
-
-    def __init__(self, stdout=sys.stdout, stdin=sys.stdin, stderr=sys.stderr,
-        config=None, read_configfile=True, quiet=False, quietness=4,
-        verbose=False, nocolor=False, width=0, root=None
-        ):
-        """Input parameters are optional to override the defaults.
-        sets up our LaymanAPI with defaults or passed in values
-        and returns an instance of it"""
-        self.message = Message(out=stdout, err=stderr)
-        self.config = BareConfig(
-                output=self.message,
-                stdout=stdout,
-                stdin=stdin,
-                stderr=stderr,
-                config=config,
-                read_configfile=read_configfile,
-                quiet=quiet,
-                quietness=quietness,
-                verbose=verbose,
-                nocolor=nocolor,
-                width=width,
-                root=root
-            )
-        LaymanAPI.__init__(self, self.config,
-                             report_errors=True,
-                             output=self.config['output']
-                            )
-        return

diff --git a/layman/__init__.py b/layman/layman.py
similarity index 100%
copy from layman/__init__.py
copy to layman/layman.py


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-09 18:25 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-09 18:25 UTC (permalink / raw
  To: gentoo-commits

commit:     1d9c2fe87449cfdd23b3bc45813a77a835513025
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  9 18:25:11 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Feb  9 18:25:11 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1d9c2fe8

updater.py: Adds repos.conf dir creation if it doesn't exist

---
 layman/updater.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/layman/updater.py b/layman/updater.py
index 6fd1281..ccf6c8d 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -182,6 +182,16 @@ class Main(object):
 
     def create_repos_conf(self):
         self.output.info("  Creating layman's repos.conf file")
+        conf_dir = os.path.dirname(self.config['repos_conf'])
+
+        if not os.path.isdir(conf_dir):
+            try:
+                os.mkdir(conf_dir)
+            except OSError as e:
+                self.output.error('  create_repos_conf() error creating %s: ' % conf_dir)
+                self.output.error('  "%s"' % e)
+                return None
+
         layman_inst = LaymanAPI(config=self.config)
         overlays = {}
         for ovl in layman_inst.get_installed():


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-08  4:20 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2015-02-08  4:20 UTC (permalink / raw
  To: gentoo-commits

commit:     6b22ef1131bce5bf63a4a086fcd05449c87a43b2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 04:19:20 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 04:19:20 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6b22ef11

repoconfmanager.py: Pyflakes and whitespace cleanup

---
 layman/repoconfmanager.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/layman/repoconfmanager.py b/layman/repoconfmanager.py
index 8a65b88..e1143ea 100644
--- a/layman/repoconfmanager.py
+++ b/layman/repoconfmanager.py
@@ -16,10 +16,9 @@
 #
 
 import os
-import re
 import sys
 
-from layman.module import Modules, InvalidModuleName
+from layman.module import Modules
 
 if sys.hexversion >= 0x30200f0:
     STR = str
@@ -104,7 +103,7 @@ class RepoConfManager:
                 conf_ok = conf.disable(overlay)
             return conf_ok
         return True
-                                                                                                                                                
+
 
     def enable(self, overlay):
         '''
@@ -123,11 +122,11 @@ class RepoConfManager:
             return conf_ok
         return True
 
-    
+
     def update(self, overlay):
         '''
         Updates the source URL for the specified config type(s).
-    
+
         @param overlay: layman.overlay.Overlay instance.
         @return boolean: represents success or failure.
         '''


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-08  4:20 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2015-02-08  4:20 UTC (permalink / raw
  To: gentoo-commits

commit:     79809ad71c13016178bcd0945ba7c257f224db32
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 04:18:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 04:18:34 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=79809ad7

repoconfmanager.py: Fix conf_type splitting

---
 layman/repoconfmanager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/repoconfmanager.py b/layman/repoconfmanager.py
index 260ae3d..8a65b88 100644
--- a/layman/repoconfmanager.py
+++ b/layman/repoconfmanager.py
@@ -42,7 +42,7 @@ class RepoConfManager:
                                          output=self.output)
 
         if isinstance(self.conf_types, STR):
-            self.conf_types = re.split(',\s+', self.conf_types)
+            self.conf_types = [x.strip() for x in self.conf_types.split(',')]
 
         if not self.conf_types and self.config['require_repoconfig']:
             self.output.error('No Repo configuration type found, but'


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-08  2:58 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-08  2:58 UTC (permalink / raw
  To: gentoo-commits

commit:     03f8a4c5f1ac3d878fae9c228f60c82cf660b5ad
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 02:51:17 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 02:51:17 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=03f8a4c5

updater.py: Adds copying of all installed overlays to make.conf

With the addition of the --rebuild flag for layman-updater behavior
has been added to the create_make_conf () function to add all previously
installed overlays into the make.conf if there are any found.

---
 layman/updater.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index fe3f300..6fd1281 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -169,10 +169,14 @@ class Main(object):
 
     def create_make_conf(self):
         self.output.info("  Creating layman's make.conf file")
+        layman_inst = LaymanAPI(config=self.config)
+        overlays = {}
+        for ovl in layman_inst.get_installed():
+            overlays[ovl] = layman_inst._get_installed_db().select(ovl)
         # create layman's %(storage)s/make.conf
         # so portage won't error
         from layman.config_modules.makeconf.makeconf import ConfigHandler
-        maker = ConfigHandler(self.config, None)
+        maker = ConfigHandler(self.config, overlays)
         maker.write()
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-08  1:57 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2015-02-08  1:57 UTC (permalink / raw
  To: gentoo-commits

commit:     13380e488ad4a458d7d2410bc235c62d61c7a595
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 01:55:58 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 01:55:58 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=13380e48

updater.py: Add a -R, --rebuild option to force a rebuild of the config

---
 layman/updater.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index e3003f9..fe3f300 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -57,6 +57,8 @@ class Main(object):
             help = 'Print the NEW INSTALL help messages.')
         self.parser.add_argument("-c", "--config",
             help='the path to config file')
+        self.parser.add_argument("-R", "--rebuild", action='store_true',
+            help='rebuild the Pacakge Manager config file')
         self.parser.add_argument('--version', action='version',
             version='%(prog)s ' + VERSION)
 
@@ -85,18 +87,18 @@ class Main(object):
 
         if self.args.setup_help:
             self.print_instructions()
-        elif not self.check_is_new():
+        elif not self.check_is_new(self.args.rebuild):
             self.rename_check()
 
 
-    def check_is_new(self):
+    def check_is_new(self, rebuild=False):
         print_instructions = False
         if isinstance(self.config['conf_type'], STR):
             self.config.set_option('conf_type',
                                    self.config['conf_type'].split(','))
         for i in self.config['conf_type']:
             conf = i.replace('.', '_').strip()
-            if conf and not os.access(self.config[conf], os.F_OK):
+            if conf and (rebuild or not os.access(self.config[conf], os.F_OK)):
                 getattr(self, 'create_%(conf)s' % {'conf': conf})()
                 print_instructions = True
         if print_instructions:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-08  0:33 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-08  0:33 UTC (permalink / raw
  To: gentoo-commits

commit:     cdee283930339c175f0070655f650c8c240563e9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 17:24:36 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Feb  7 20:48:38 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=cdee2839

version bump

---
 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index 0ce6d76..75feadb 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.3.0-git'
+VERSION = '2.3.0'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-05  2:56 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-05  2:56 UTC (permalink / raw
  To: gentoo-commits

commit:     04610b2895a7786ca9f31e09f03a7274b7c6cb88
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 02:51:49 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  5 02:53:56 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=04610b28

updater.py: Moves split() and removes split() parameter

X-Gentoo-Bug: 538868
X-Gentoo-Bug-URL: https://bugs.gentoo.org/538868

---
 layman/updater.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 9e7100a..e3003f9 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -93,10 +93,10 @@ class Main(object):
         print_instructions = False
         if isinstance(self.config['conf_type'], STR):
             self.config.set_option('conf_type',
-                                   self.config['conf_type'].strip('\s').split(','))
+                                   self.config['conf_type'].split(','))
         for i in self.config['conf_type']:
-            conf = i.replace('.', '_')
-            if not os.access(self.config[conf], os.F_OK):
+            conf = i.replace('.', '_').strip()
+            if conf and not os.access(self.config[conf], os.F_OK):
                 getattr(self, 'create_%(conf)s' % {'conf': conf})()
                 print_instructions = True
         if print_instructions:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-05  2:31 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-05  2:31 UTC (permalink / raw
  To: gentoo-commits

commit:     c1d7a02f54e2057a23a82fc89fa64d024bf9588f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 02:30:39 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  5 02:30:42 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c1d7a02f

updater.py: Allows more leniency when breaking up conf_type from layman.cfg

X-Gentoo-Bug: 538868
X-Gentoo-Bug-URL: https://bugs.gentoo.org/538868

---
 layman/updater.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 2d22b59..9e7100a 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -93,7 +93,7 @@ class Main(object):
         print_instructions = False
         if isinstance(self.config['conf_type'], STR):
             self.config.set_option('conf_type',
-                                   self.config['conf_type'].split(', '))
+                                   self.config['conf_type'].strip('\s').split(','))
         for i in self.config['conf_type']:
             conf = i.replace('.', '_')
             if not os.access(self.config[conf], os.F_OK):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-05  2:20 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-05  2:20 UTC (permalink / raw
  To: gentoo-commits

commit:     dabd69cf0242df36d155fe21e2fce779c7de313c
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 02:20:22 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  5 02:20:22 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=dabd69cf

updater.py: Fixes flub of incorrectly calling var messages, message

---
 layman/updater.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/updater.py b/layman/updater.py
index 7ccc9bd..2d22b59 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -148,7 +148,7 @@ class Main(object):
             make_conf = '/etc/portage/make.conf'
             if not os.access(make_conf, os.F_OK):
                 make_conf = '/etc/make.conf'
-            message += [
+            messages += [
                 "If this is the very first overlay you add with layman,",
                 "you need to append the following statement to your",
                 "%s file:" % make_conf,


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2015-02-03  2:43 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2015-02-03  2:43 UTC (permalink / raw
  To: gentoo-commits

commit:     854b4944acf466573f4fde14c6bd36807be0b220
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  3 02:43:41 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Feb  3 02:43:41 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=854b4944

updater.py: Modifies print_instructions function to optionally output make.conf information

---
 layman/updater.py | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 874e3c3..7ccc9bd 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -133,9 +133,6 @@ class Main(object):
 
 
     def print_instructions(self):
-        make_conf = '/etc/portage/make.conf'
-        if not os.access(make_conf, os.F_OK):
-            make_conf = '/etc/make.conf'
         messages = [
             "You are now ready to add overlays into your system.",
             "",
@@ -146,19 +143,23 @@ class Main(object):
             "Select an overlay and add it using",
             "",
             "  layman -a overlay-name",
-            "",
-            "If this is the very first overlay you add with layman,",
-            "you need to append the following statement to your",
-            "%s file:" %make_conf,
-            "",
-            "  source /var/lib/layman/make.conf",
-            "",
-            "If you modify the 'storage' parameter in the layman",
-            "configuration file (/etc/layman/layman.cfg) you will",
-            "need to adapt the path given above to the new storage",
-            "directory.",
-            "",
-        ]
+            "",]
+        if 'make.conf' in self.config['conf_type']:
+            make_conf = '/etc/portage/make.conf'
+            if not os.access(make_conf, os.F_OK):
+                make_conf = '/etc/make.conf'
+            message += [
+                "If this is the very first overlay you add with layman,",
+                "you need to append the following statement to your",
+                "%s file:" % make_conf,
+                "",
+                "  source /var/lib/layman/make.conf",
+                "",
+                "If you modify the 'storage' parameter in the layman",
+                "configuration file (/etc/layman/layman.cfg) you will",
+                "need to adapt the path given above to the new storage",
+                "directory.",
+                "",]
 
         for message in messages:
             self.output.info("  " + message)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-12-08  4:15 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-12-08  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     89ba9eb8a684714eab2ee0b526912508ce4296fb
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  8 04:11:29 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Dec  8 04:11:29 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=89ba9eb8

remotedb.py: Changes ssl-fetch kwargs-info level to 5 as default

---
 layman/remotedb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index b866bd7..e6492f4 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -119,7 +119,7 @@ class RemoteDB(DbBase):
             'info':  self.output.info,
             'debug': self.output.debug,
             'error': self.output.error,
-            'kwargs-info': {'level': 2},
+            'kwargs-info': {'level': 5},
             'kwargs-debug': {'level': 2},
             'kwargs-error':{'level': None},
         }


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-12-04 20:46 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-12-04 20:46 UTC (permalink / raw
  To: gentoo-commits

commit:     46ffaeaee872aa71b5e83133ccb3a2a3ea3efc03
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  4 20:41:10 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Dec  4 20:41:10 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=46ffaeae

output.py: Removes check for encoding output strings

In py2.7 when trying to view an overlay info it will cause a runtime
error if the string isn't encoded properly. So output.py will now
indiscriminately encode all string values.

X-Gentoo-Bug: 530064
X-Gentoo-Bug-URL: https://bugs.gentoo.org/530064

---
 layman/output.py | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 21a7d6c..b22d33e 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -133,8 +133,7 @@ class Message(MessageBase):
         """empty debug function, does nothing,
         declared here for compatibility with DebugMessage
         """
-        if type(info) != str:#not in types.StringTypes:
-            info = encode(info)
+        info = encode(info)
 
         if level > self.debug_lev:
             return
@@ -153,8 +152,7 @@ class Message(MessageBase):
 
     def info (self, info, level = INFO_LEVEL):
 
-        if type(info) != str:#not in types.StringTypes:
-            info = encode(info)
+        info = encode(info)
 
         if level > self.info_lev:
             return
@@ -165,8 +163,7 @@ class Message(MessageBase):
 
     def status (self, message, status, info = 'ignored'):
 
-        if type(message) != str:#not in types.StringTypes:
-            message = encode(message)
+        message = encode(message)
 
         lines = message.split('\n')
 
@@ -194,8 +191,7 @@ class Message(MessageBase):
 
     def warn (self, warn, level = WARN_LEVEL):
 
-        if type(warn) != str:#not in types.StringTypes:
-            warn = encode(warn)
+        warn = encode(warn)
 
         if level > self.warn_lev:
             return
@@ -206,8 +202,7 @@ class Message(MessageBase):
 
     def error (self, error, level = None):
 
-        if type(error) != str:#not in types.StringTypes:
-            error = encode(error)
+        error = encode(error)
 
         for i in error.split('\n'):
             # NOTE: Forced flushing ensures that stdout and stderr
@@ -222,8 +217,7 @@ class Message(MessageBase):
 
     def die (self, error):
 
-        if type(error) != str:#not in types.StringTypes:
-            error = encode(error)
+        error = encode(error)
 
         for i in error.split('\n'):
             self.error(self.color_func('red', 'Fatal error: ') + i)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 19:03 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     d8b6b038ca3ac666a8642a142b6fb72d4eb2f4e1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 19:02:00 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 19:02:00 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d8b6b038

maker.py: Initialize correct to False

---
 layman/maker.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layman/maker.py b/layman/maker.py
index 8cf725f..e896530 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -343,6 +343,7 @@ class Interactive(object):
 
         for i in range(1, source_amount + 1):
             sources = []
+            correct = False
             if source_amount > 1:
                 msg = 'Define source[%(i)s]\'s URL: ' % ({'i': str(i)})
                 sources.append(get_input(msg))


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:43 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     eceecd8b3bbef0ec7b19662bb763ed6a4a5cf6cf
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 18:40:50 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:40:50 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=eceecd8b

maker.py: Fix 'xml undefined' error detected by pyflakes

---
 layman/maker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/maker.py b/layman/maker.py
index 3393d1b..8cf725f 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -452,7 +452,7 @@ class Interactive(object):
         '''
         try:
             document = ET.parse(path)
-        except xml.etree.ElementTree.ParseError as error:
+        except ET.ParseError as error:
             msg = 'Interactive.read(); encountered error: %(error)s'\
                 % ({'error': error})
             raise Exception(msg)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:43 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     421b4ac4b2b572653ef9dab7fc5a0f87d5c3bb09
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 18:39:51 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:39:51 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=421b4ac4

maker.py: Skip the protocol verification if it failed to guess one 

---
 layman/maker.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/layman/maker.py b/layman/maker.py
index c7d5139..3393d1b 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -348,9 +348,10 @@ class Interactive(object):
                 sources.append(get_input(msg))
 
                 ovl_type = self.guess_overlay_type(sources[0])
-                msg = 'Is %(type)s the correct overlay type?: '\
-                    % ({'type': ovl_type})
-                correct = get_ans(msg)
+                if ovl_type:
+                    msg = 'Is "%(type)s" the correct overlay type?: '\
+                        % ({'type': ovl_type})
+                    correct = get_ans(msg)
                 while not ovl_type or not correct:
                     msg = 'Please provide overlay type: '
                     ovl_type = self.check_overlay_type(\
@@ -368,9 +369,10 @@ class Interactive(object):
                 sources.append(get_input('Define source URL: '))
 
                 ovl_type = self.guess_overlay_type(sources[0])
-                msg = 'Is %(type)s the correct overlay type?: '\
-                       % ({'type': ovl_type})
-                correct = get_ans(msg)
+                if ovl_type:
+                    msg = 'Is %(type)s the correct overlay type?: '\
+                           % ({'type': ovl_type})
+                    correct = get_ans(msg)
                 while not ovl_type or not correct:
                     msg = 'Please provide overlay type: '
                     ovl_type = self.check_overlay_type(\


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:08 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     b92fd6f487d113adaafaacd151e49988aab7175e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 18:02:19 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:07:21 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b92fd6f4

maker.py: Fix missed get_input() move call

The getattr() call was also missing the first paramater 'self' causing an error.

---
 layman/maker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/maker.py b/layman/maker.py
index fbbe4fd..ef560f1 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -415,7 +415,7 @@ class Interactive(object):
             if component in ('descriptions', 'feeds', 'name', 'owner', 'sources'):
                 getattr(self, 'get_%(comp)s' % ({'comp': component}))()
             else:
-                self.overlay[component] = getattr('get_input')(msg)
+                self.overlay[component] = get_input(msg)
 
 
     def get_overlay_components(self):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:08 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     6dcbae494c1b512973901039b75b5a0c91dcd26a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 18:02:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:07:30 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6dcbae49

maker.py: Whitespace cleanup

---
 layman/maker.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/layman/maker.py b/layman/maker.py
index ef560f1..c7d5139 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -12,10 +12,10 @@
 #             Devan Franchini <twitch153@gentoo.org>
 #
 
-#===============================================================================              
+#===============================================================================
 #
 # Dependencies
-#                                                   
+#
 #-------------------------------------------------------------------------------
 from __future__ import unicode_literals
 
@@ -76,9 +76,9 @@ AUTOCOMPLETE_TEMPLATE = {
                                   '%(tail)s;a=shortlog;h=refs/heads/'\
                                   '%(branch)s',
                       'sources': (
-                     ('https://git.overlays.gentoo.org/gitroot/%(tail)s', 'git', 
+                     ('https://git.overlays.gentoo.org/gitroot/%(tail)s', 'git',
                       '%(branch)s'),
-                     ('git://git.overlays.gentoo.org/%(tail)s', 'git', 
+                     ('git://git.overlays.gentoo.org/%(tail)s', 'git',
                       '%(branch)s'),
                      ('git+ssh://git@git.overlays.gentoo.org/%(tail)s', 'git',
                       '%(branch)s')
@@ -193,7 +193,7 @@ class Interactive(object):
                     self.output.notice('')
                     self.update_required()
                     self.output.notice('')
-                    
+
                 self.get_overlay_components()
                 ovl = Overlay.Overlay(config=self.config, ovl_dict=self.overlay, ignore=1)
                 self.overlays.append((self.overlay['name'], ovl))
@@ -237,7 +237,7 @@ class Interactive(object):
         if 'tar' in type_checks:
             type_checks.remove(type_checks[type_checks.index('tar')])
             type_checks.insert(len(type_checks), '.tar')
-                
+
         if 'bzr' in type_checks:
             type_checks.remove(self.supported_types[type_checks.index('bzr')])
             type_checks.insert(len(type_checks), 'bazaar')
@@ -369,7 +369,7 @@ class Interactive(object):
 
                 ovl_type = self.guess_overlay_type(sources[0])
                 msg = 'Is %(type)s the correct overlay type?: '\
-                       % ({'type': ovl_type})                                                      
+                       % ({'type': ovl_type})
                 correct = get_ans(msg)
                 while not ovl_type or not correct:
                     msg = 'Please provide overlay type: '
@@ -487,7 +487,7 @@ class Interactive(object):
                         TEMPLATE = AUTOCOMPLETE_TEMPLATE[i]
                 else:
                     TEMPLATE = AUTOCOMPLETE_TEMPLATE[i]
- 
+
                 self.overlay['homepage'] = TEMPLATE['homepage'] % attrs
 
                 if i in ('bitbucket') and 'git' in (source[1]):
@@ -545,7 +545,7 @@ class Interactive(object):
     def write(self, destination):
         '''
         Writes overlay file to desired location.
-        
+
         @params destination: path & file to write xml to.
         @rtype bool: reflects success or failure to write xml.
         '''


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:08 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     81f1545f1371931d560492e8b323096d4befc775
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 18 02:40:38 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:07:03 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=81f1545f

remotedb.py: Change for upstream ssl-fetch change

---
 layman/remotedb.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index f0f7ea9..b866bd7 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -57,7 +57,7 @@ class RemoteDB(DbBase):
         self.detached_urls = []
         self.signed_urls = []
         self.proxies = config.proxies
-        
+
         self.urls  = [i.strip()
             for i in config['overlays'].split('\n') if len(i)]
 
@@ -116,9 +116,11 @@ class RemoteDB(DbBase):
         need_gpg = [False, True, True]
         # setup the ssl-fetch output map
         connector_output = {
-            'info':  self.output.debug,
+            'info':  self.output.info,
+            'debug': self.output.debug,
             'error': self.output.error,
             'kwargs-info': {'level': 2},
+            'kwargs-debug': {'level': 2},
             'kwargs-error':{'level': None},
         }
         fetcher = Connector(connector_output, self.proxies, USERAGENT)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-13 18:08 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-11-13 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     d6053350176e659f9793f75e674c5e32773a8b7d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 13 18:00:00 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov 13 18:07:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d6053350

maker.py: Fix use of .keys() causing py3 compatibility issues

Reported by: Scott Fury:
X-Funtoo-Bug: FL-1759
X-Funtoo-Bug-URL: https://bugs.funtoo.org/browse/FL-1759

---
 layman/maker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/maker.py b/layman/maker.py
index 54e15ae..fbbe4fd 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -116,7 +116,7 @@ class Interactive(object):
         self.overlay = {}
         self.overlays = []
         self.overlays_available = self.layman_inst.get_available()
-        self.supported_types = self.layman_inst.supported_types().keys()
+        self.supported_types = list(self.layman_inst.supported_types())
 
 
     def args_parser(self):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-11-02 21:14 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-11-02 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     dfdec124b39f67f77c95dcace8c22b7fad965c27
Author:     W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Tue Oct 21 20:45:59 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 20:50:53 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=dfdec124

layman/db: Ignore an initially-missing installed file

Avoid:

  $ emerge -av app-portage/layman
  $ echo 'source /var/lib/layman/make.conf' >> /etc/portage/make.conf
  $ layman --fetch
  $ layman --list-local

   * Warning: an installed db file was not found at: ['/var/lib/layman/installed.xml']

when that's the expected behavior before you've added any local
repositories.  Instead, interpret the lack of a local file listing
installed repositories as "no repositories installed" and continue
silently on.

---
 layman/db.py     | 1 +
 layman/dbbase.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 4edf465..add8fa1 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -60,6 +60,7 @@ class DB(DbBase):
                           config,
                           paths=[config['installed'], ],
                           ignore=ignore,
+                          allow_missing=True,
                           )
 
         self.repo_conf = RepoConfManager(self.config, self.overlays)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index aff48b8..7bfb60f 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -90,7 +90,7 @@ class DbBase(object):
     ''' Handle a list of overlays.'''
 
     def __init__(self, config, paths=None, ignore = 0,
-        ignore_init_read_errors=False
+        ignore_init_read_errors=False, allow_missing=False
         ):
 
         self.config = config
@@ -111,7 +111,7 @@ class DbBase(object):
             self.read_file(path)
             path_found = True
 
-        if not path_found:
+        if not path_found and not allow_missing:
             self.output.warn("Warning: an installed db file was not found at: %s"
                 % str(self.paths))
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-09-28 22:42 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-09-28 22:42 UTC (permalink / raw
  To: gentoo-commits

commit:     3a30535037f98d6023677bfc70695097b82d9a02
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 28 22:42:27 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Sep 28 22:42:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3a305350

version.py: Updates version to 2.2.1-git

---
 layman/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/version.py b/layman/version.py
index 9ea3b8e..d6f8eaf 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import unicode_literals
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.2.0-git'
+VERSION = '2.2.1-git'
 
 if __name__ == '__main__':
     print(VERSION)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-09-20 17:47 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-09-20 17:47 UTC (permalink / raw
  To: gentoo-commits

commit:     d7102ce5476065b309bc40ca76810b16a2c610e6
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 19 19:44:45 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Sep 20 17:44:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d7102ce5

config.py: Fixes output use in proxies()

This patch was supplied by Maxim Odinintsev (gwynn <AT> devc.net) to properly
use layman's output from it's private _options variable.

X-Gentoo-Bug: 523258
X-Gentoo-Bug-URL: https://bugs.gentoo.org/523258

---
 layman/config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/config.py b/layman/config.py
index 4fbff5d..3e13899 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -294,7 +294,8 @@ class BareConfig(object):
             elif os.getenv(proxy):
                 proxies[proxy.split('_')[0]] = os.getenv(proxy)
         if self.config and proxies == {}:
-            self.output.debug("Warning: unable to determine proxies.", 6)
+            self._options['output'].debug("Warning: unable to determine prox" +
+                                          "ies.", 6)
 
         return proxies
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-09-19 18:13 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-09-19 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     5a578e55ba2cf6d99abedc2103e432631fccd2db
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 16 18:24:24 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Sep 16 18:24:24 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5a578e55

argparser.py: Fixes default override of storage config option

---
 layman/argsparser.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index aa8c291..9c29b47 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -323,6 +323,20 @@ class ArgsParser(BareConfig):
 
     def __getitem__(self, key):
 
+        if key == 'storage':
+            storage = ''
+            if (key in self.options.keys()
+                and not self.options[key] is None):
+                storage = self.options[key]
+            if self.config.has_option('MAIN', 'storage'):
+                storage = self.config.get('MAIN', 'storage')
+            # Set the value to the command line value if and only
+            # if it isn't the same as the default.
+            if self.options[key] != self.defaults[key]:
+                storage = self.options[key]
+            if storage:
+                return storage
+                
         if key == 'overlays':
             overlays = ''
             if (key in self.options.keys()


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-09-19 18:13 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-09-19 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     6f8ff85d752f7cbadb9c41e21f43775c902fada7
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 18 23:23:57 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Sep 18 23:23:57 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6f8ff85d

argparser.py: Fixes override of overlay_defs config option

---
 layman/argsparser.py | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 9c29b47..6aeda44 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -277,7 +277,7 @@ class ArgsParser(BareConfig):
         self.options = self.parser.parse_args()
         self.options = vars(self.options)
         # Applying interpolation of values
-        for v in ['configdir', 'config', 'overlay_defs']:
+        for v in ['configdir', 'config']:
             self.options[v] = self.options[v] % self.options
             self.defaults[v] = self.options[v]
 
@@ -302,11 +302,6 @@ class ArgsParser(BareConfig):
             self.defaults['config'] = self.defaults['config'] \
                 % {'configdir': self.defaults['configdir']}
 
-        if self.options['overlay_defs'] is not None:
-            self.defaults['overlay_defs'] = self.options['overlay_defs']
-            self.output.debug('ARGSPARSER: Got overlay_defs location at ' + \
-                self.defaults['overlay_defs'], 8)
-
         self._options['setup_help'] = self.options['setup_help']
 
         # Now parse the config file
@@ -314,6 +309,21 @@ class ArgsParser(BareConfig):
             self.defaults['config'], 8)
         self.read_config(self.defaults)
 
+
+        # Handle the overlay_defs option:
+        if ('%(configdir)s' in self.options['overlay_defs']
+            and self.config.has_option('MAIN', 'overlay_defs')):
+            # If it hasn't been interpolated then it's not being set as a
+            # command line argument. So we first try to set it to the config
+            # value.
+            self.options['overlay_defs'] = self.config.get('MAIN',
+                                                           'overlay_defs')
+        elif self.defaults['overlay_defs'] == self.options['overlay_defs']:
+            # If it isn't a command line argument and no config option then
+            # set it to the default.
+            self.defaults['overlay_defs'] = self.defaults['overlay_defs'] % self.options
+            self.options['overlay_defs'] = self.defaults['overlay_defs']
+
         # handle quietness
         if self.options['quiet']:
             self.set_option('quiet', True)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-28 22:54 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-08-28 22:54 UTC (permalink / raw
  To: gentoo-commits

commit:     d956bd5e5dae18172e0398bbd112fe43785d8041
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 22:48:09 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Aug 28 22:51:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d956bd5e

Fix bug 521348, results from operations were not tracked correctly

Overlay.update() returned a single boolean, while the repo_conf.update() returned a list.
Those results were not added to the overlay result.
Also the warnings are printed after the successes, so re-word the update warning message so it is not confusing.

---
 layman/api.py | 2 +-
 layman/db.py  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index b62e8f5..60bcbe0 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -429,7 +429,7 @@ class LaymanAPI(object):
                   '\n'\
                   'as correct location%(plural)s.\n'\
                   '\n'\
-                  'Repo: "%(repo_name)s" will be updated...' %\
+                  'Repo: "%(repo_name)s" was automatically updated...' %\
                   ({
                      'repo_name':odb.name,
                      'current_src':current_src,

diff --git a/layman/db.py b/layman/db.py
index 57f12e2..b874fe8 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -288,15 +288,16 @@ class DB(DbBase):
     def update(self, overlay, available_srcs):
         '''
         Updates the overlay source via the available source(s).
-        
+
         @params overlay: layman.overlay.Overlay object.
         @params available_srcs: set of available source URLs.
         '''
 
         source, result = self.overlays[overlay.name].update(self.config['storage'],
                                                     available_srcs)
+        result = [result]
         self.overlays[overlay.name].sources = source
-        self.repo_conf.update(self.overlays[overlay.name])
+        result.extend(self.repo_conf.update(self.overlays[overlay.name]))
         self.write(self.path)
 
         if False in result:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-28 22:01 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-08-28 22:01 UTC (permalink / raw
  To: gentoo-commits

commit:     8293c7223f748dab6a1fd1faade3b3ea6183ce86
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 17:43:22 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 21:59:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8293c722

updater.py: Adds repos.conf module plug-in

In order to allow users to migrate/incorporate their config file to
a repos.conf config file, the repos.conf plug-in has been added when
creating the repos.conf to write all overlays to the config file.

---
 layman/updater.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index aa5f82e..874e3c3 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -175,7 +175,13 @@ class Main(object):
 
     def create_repos_conf(self):
         self.output.info("  Creating layman's repos.conf file")
-        # create layman's %(repos_conf)
-        # so layman won't error.
-        with fileopen(self.config['repos_conf'], 'w') as repos_conf:
-            repos_conf.write('')
+        layman_inst = LaymanAPI(config=self.config)
+        overlays = {}
+        for ovl in layman_inst.get_installed():
+            overlays[ovl] = layman_inst._get_installed_db().select(ovl)
+        # create layman's %(repos_conf) so layman
+        # can write the overlays to it.
+        open(self.config['repos_conf'], 'w').close()
+        from layman.config_modules.reposconf.reposconf import ConfigHandler
+        repos_conf = ConfigHandler(self.config, overlays)
+        repos_conf.write()


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-28 22:01 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-08-28 22:01 UTC (permalink / raw
  To: gentoo-commits

commit:     5551efcfc8f97e5cd5053f128cb596d6aa1066b5
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 17:31:11 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 17:31:11 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5551efcf

updater.py: Adds proper import for make.conf module

To reflect the modular config type plug-ins, we needed to properly
import the module to write to the make.conf config.

---
 layman/updater.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index e6d3596..aa5f82e 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -168,8 +168,8 @@ class Main(object):
         self.output.info("  Creating layman's make.conf file")
         # create layman's %(storage)s/make.conf
         # so portage won't error
-        from layman.makeconf import MakeConf
-        maker = MakeConf(self.config, None)
+        from layman.config_modules.makeconf.makeconf import ConfigHandler
+        maker = ConfigHandler(self.config, None)
         maker.write()
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     44d1c523c8d42ec8e33391ea0b33e1d19b3a5140
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 14:14:22 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 14:14:22 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=44d1c523

api.py: Fix an indent error preventing syncing

This correctly fixes commit: 964bb33df4a75
Subject: api.py: Fixes lack of syncing overlays
Author: Devan Franchini <twitch153 <AT> gentoo.org> (Sat 16 Aug 2014 09:00:47 PM PDT)

and original commit: 754cc935e1484
Suubject: Fix errors in overlay updates.
Author: Brian Dolbec <dolsen <AT> gentoo.org> (Sat 26 Jul 2014 04:38:14 PM PDT)

---
 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index e56d5e8..b62e8f5 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -505,7 +505,7 @@ class LaymanAPI(object):
                     self.output.warn('Failed to perform overlay type or url updates', 2)
                     self.output.warn('    for Overlay: %s' % ovl, 2)
                     self.output.warn('    Error was: %s' % str(error))
-                pass
+                    continue
 
             try:
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  2014-08-17  4:01 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     964bb33df4a7514db472a788d9e4c543767c9eb2
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 04:00:47 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 04:00:47 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=964bb33d

api.py: Fixes lack of syncing overlays

---
 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index cff89ed..e56d5e8 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -505,7 +505,7 @@ class LaymanAPI(object):
                     self.output.warn('Failed to perform overlay type or url updates', 2)
                     self.output.warn('    for Overlay: %s' % ovl, 2)
                     self.output.warn('    Error was: %s' % str(error))
-                continue
+                pass
 
             try:
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  2014-08-15 23:16 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     98f1e9b388ab7b10d09f9773144a7aa1e6788616
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 15 23:16:05 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 23:16:05 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=98f1e9b3

config.py: Adds squashfs_* config opts

---
 layman/config.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/layman/config.py b/layman/config.py
index 91c179e..adfd2de 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -123,6 +123,7 @@ class BareConfig(object):
             'g-common_command': path([self.root, EPREFIX,'/usr/bin/g-common']),
             'g-sorcery_command': path([self.root, EPREFIX,'/usr/bin/g-sorcery']),
             'mercurial_command': path([self.root, EPREFIX,'/usr/bin/hg']),
+            'squashfs_command': path([self.root, EPREFIX,'/usr/bin/unsquashfs']),
             'rsync_command': path([self.root, EPREFIX,'/usr/bin/rsync']),
             'svn_command': path([self.root, EPREFIX,'/usr/bin/svn']),
             'tar_command': path([self.root, EPREFIX,'/bin/tar']),
@@ -138,6 +139,8 @@ class BareConfig(object):
             'mercurial_addopts' : '',
             'mercurial_syncopts' : '',
             'rsync_syncopts' : '',
+            'squashfs_addopts': '',
+            'squashfs_syncopts': '',
             'svn_addopts' : '',
             'svn_syncopts' : '',
             'g-common_generateopts' : '',
@@ -150,6 +153,7 @@ class BareConfig(object):
             'git_postsync' : '',
             'mercurial_postsync' : '',
             'rsync_postsync' : '',
+            'squashfs_postsync': '',
             'svn_postsync' : '',
             'tar_postsync' : '',
             'g-common_postsync' : '',


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  2014-08-16 22:46 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     7a04ac7c25076069cc4c0e6e771b55b1ab8016ec
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 16 22:46:41 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Aug 16 22:46:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=7a04ac7c

mounter.py: Renames "repo" var to "repos", _check_selection()

---
 layman/mounter.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/mounter.py b/layman/mounter.py
index f041a9a..092a04f 100644
--- a/layman/mounter.py
+++ b/layman/mounter.py
@@ -120,7 +120,7 @@ class Mounter(object):
 
         @rtype tuple
         '''
-        if 'ALL' in repo:
+        if 'ALL' in repos:
             repos = sorted(self.mountables)
         elif isinstance(repos, STR):
             repos = [repos]


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  2014-08-15 22:33 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     d8a60befbaf4867f80ae7e0c7fe94c78fea5a5d9
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 15 20:55:33 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 22:20:49 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d8a60bef

repoconfmanager.py: Adds plug-in module controller

---
 layman/repoconfmanager.py | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/layman/repoconfmanager.py b/layman/repoconfmanager.py
index cb7c3c5..260ae3d 100644
--- a/layman/repoconfmanager.py
+++ b/layman/repoconfmanager.py
@@ -15,17 +15,19 @@
 #             Devan Franchini <twitch153@gentoo.org>
 #
 
+import os
 import re
 import sys
 
-import layman.reposconf as reposconf
-import layman.makeconf  as makeconf
+from layman.module import Modules, InvalidModuleName
 
 if sys.hexversion >= 0x30200f0:
     STR = str
 else:
     STR = basestring
 
+MOD_PATH = path = os.path.join(os.path.dirname(__file__), 'config_modules')
+
 class RepoConfManager:
 
     def __init__(self, config, overlays):
@@ -35,11 +37,9 @@ class RepoConfManager:
         self.conf_types = config['conf_type']
         self.output = config['output']
         self.overlays = overlays
-
-        self.modules = {
-        'make.conf':  (makeconf,  'ConfigHandler'),
-        'repos.conf': (reposconf, 'ConfigHandler')
-        }
+        self.module_controller = Modules(path=MOD_PATH,
+                                         namepath='layman.config_modules',
+                                         output=self.output)
 
         if isinstance(self.conf_types, STR):
             self.conf_types = re.split(',\s+', self.conf_types)
@@ -59,8 +59,9 @@ class RepoConfManager:
         if self.config['require_repoconfig']:
             results = []
             for types in self.conf_types:
-                conf = getattr(self.modules[types][0],
-                    self.modules[types][1])(self.config, self.overlays)
+                types = types.replace('.', '')
+                conf = self.module_controller.get_class(types)\
+                                  (self.config, self.overlays)
                 conf_ok = conf.add(overlay)
                 results.append(conf_ok)
             return results
@@ -78,8 +79,9 @@ class RepoConfManager:
         if self.config['require_repoconfig']:
             results = []
             for types in self.conf_types:
-                conf = getattr(self.modules[types][0],
-                    self.modules[types][1])(self.config, self.overlays)
+                types = types.replace('.', '')
+                conf = self.module_controller.get_class(types)\
+                                  (self.config, self.overlays)
                 conf_ok = conf.delete(overlay)
                 results.append(conf_ok)
             return results
@@ -96,8 +98,9 @@ class RepoConfManager:
         '''
         if self.config['require_repoconfig']:
             for types in self.conf_types:
-                conf = getattr(self.modules[types][0],
-                    self.modules[types][1])(self.config, self.overlays)
+                types = types.replace('.', '')
+                conf = self.module_controller.get_class(types)\
+                                  (self.config, self.overlays)
                 conf_ok = conf.disable(overlay)
             return conf_ok
         return True
@@ -113,8 +116,9 @@ class RepoConfManager:
         '''
         if self.config['require_repoconfig']:
             for types in self.conf_types:
-                conf = getattr(self.modules[types][0],
-                    self.modules[types][1])(self.config, self.overlays)
+                types = types.replace('.', '')
+                conf = self.module_controller.get_class(types)\
+                                  (self.config, self.overlays)
                 conf_ok = conf.enable(overlay)
             return conf_ok
         return True
@@ -130,8 +134,9 @@ class RepoConfManager:
         if self.config['require_repoconfig']:
             results = []
             for types in self.conf_types:
-                conf = getattr(self.modules[types][0],
-                    self.modules[types][1])(self.config, self.overlays)
+                types = types.replace('.', '')
+                conf = self.module_controller.get_class(types)\
+                                  (self.config, self.overlays)
                 conf_ok = conf.update(overlay)
                 results.append(conf_ok)
             return results


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     754cc935e1484b580e1bcbabb4210ffc4084efc6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 26 23:38:14 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Aug 16 17:58:49 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=754cc935

Fix errors in overlay updates.

Original problem reported in #gentoo-overlays by user quinso.

---
 layman/api.py | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index bb63d8d..cff89ed 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -409,9 +409,8 @@ class LaymanAPI(object):
         current_src = odb.sources[0].src
         (available_srcs, valid) = verify_overlay_src(current_src,
             set(e.src for e in ordb.sources))
-            
+
         if ordb and odb and not valid:
-            update_url = True
             if len(available_srcs) == 1:
                 plural = ''
                 candidates = '  %s' % tuple(available_srcs)[0]
@@ -437,8 +436,8 @@ class LaymanAPI(object):
                      'candidates':candidates,
                      'plural':plural,
                   })
-            return True, msg
-        return False, ''
+            return True, msg, available_srcs
+        return False, '', available_srcs
 
     def sync(self, repos, output_results=True, update_news=False):
         """syncs the specified repo(s) specified by repos
@@ -486,22 +485,29 @@ class LaymanAPI(object):
                 self.output.debug("API.sync(); else: self._get_remote_db().select(ovl)", 5)
 
                 (diff_type, type_msg) = self._verify_overlay_type(odb, ordb)
-                (update_url, url_msg) = self._verify_overlay_source(odb, ordb)
+                (update_url, url_msg, available_srcs) = self._verify_overlay_source(odb, ordb)
+
+                try:
+                    if diff_type:
+                        self.output.debug("API.sync(); starting API.readd_repos(ovl)", 5)
+                        warnings.append((ovl, type_msg))
+                        self.readd_repos(ovl)
+                        success.append((ovl, 'Successfully readded overlay "' + ovl + '".'))
+                    else:
+                        if update_url:
+                            self.output.debug("API.sync() starting db.update(ovl)", 5)
+                            warnings.append((ovl, url_msg))
+                            update_success = db.update(ordb, available_srcs)
+                            if not update_success:
+                                self.output.warn('Failed to update repo...readding', 2)
+                                self.readd_repos(ovl)
+                except Exception as error:
+                    self.output.warn('Failed to perform overlay type or url updates', 2)
+                    self.output.warn('    for Overlay: %s' % ovl, 2)
+                    self.output.warn('    Error was: %s' % str(error))
+                continue
 
             try:
-                if diff_type:
-                    self.output.debug("API.sync(); starting API.readd_repos(ovl)", 5)
-                    warnings.append((ovl, type_msg))
-                    self.readd_repos(ovl)
-                    success.append((ovl, 'Successfully readded overlay "' + ovl + '".'))
-                else:
-                    if update_url:
-                        self.output.debug("API.sync() starting db.update(ovl)", 5)
-                        warnings.append((ovl, url_msg))
-                        update_success = db.update(ordb, available_srcs)
-                        if not update_success:
-                            self.output.warn('Failed to update repo...readding', 2)
-                            self.readd_repos(ovl)
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)
                     db.sync(ovl)
                     success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-19  1:49 Devan Franchini
  2014-08-15 23:27 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     0ee15b6d6b6fcbd5a83e346098d4aaab5a898bf4
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 15 23:26:43 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 23:26:43 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0ee15b6d

cli.py: Modifies print_shortlist info unpacking

---
 layman/cli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/cli.py b/layman/cli.py
index bb84081..47824b8 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -63,7 +63,7 @@ class ListPrinter(object):
             self.print_overlay(summary, supported, official, complain)
 
     def print_shortlist(self, info, complain):
-        for summary, official, supported in info:
+        for summary, supported, official in info:
             self.print_overlay(summary, supported, official, complain)
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-17 20:55 Devan Franchini
  2014-08-19  1:49 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-17 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     da7cf19e4f546505f22ace5f96d739720d9607b6
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 20:55:18 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 20:55:18 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=da7cf19e

updater.py: Adds list conversion for str conf_type

---
 layman/updater.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/layman/updater.py b/layman/updater.py
index e0ffbd8..e6d3596 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
 
 from sys import stderr
 import os
+import sys
 import argparse
 
 from layman.config import OptionConfig
@@ -12,6 +13,10 @@ from layman.api import LaymanAPI
 from layman.version import VERSION
 from layman.compatibility import fileopen
 
+if sys.hexversion >= 0x30200f0:
+    STR = str
+else:
+    STR = basestring
 
 def rename_db(config, newname, output):
     """small upgrade function to handle the name change
@@ -86,6 +91,9 @@ class Main(object):
 
     def check_is_new(self):
         print_instructions = False
+        if isinstance(self.config['conf_type'], STR):
+            self.config.set_option('conf_type',
+                                   self.config['conf_type'].split(', '))
         for i in self.config['conf_type']:
             conf = i.replace('.', '_')
             if not os.access(self.config[conf], os.F_OK):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-17 14:15 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-08-17 14:15 UTC (permalink / raw
  To: gentoo-commits

commit:     44d1c523c8d42ec8e33391ea0b33e1d19b3a5140
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 14:14:22 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug 17 14:14:22 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=44d1c523

api.py: Fix an indent error preventing syncing

This correctly fixes commit: 964bb33df4a75
Subject: api.py: Fixes lack of syncing overlays
Author: Devan Franchini <twitch153 <AT> gentoo.org> (Sat 16 Aug 2014 09:00:47 PM PDT)

and original commit: 754cc935e1484
Suubject: Fix errors in overlay updates.
Author: Brian Dolbec <dolsen <AT> gentoo.org> (Sat 26 Jul 2014 04:38:14 PM PDT)

---
 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index e56d5e8..b62e8f5 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -505,7 +505,7 @@ class LaymanAPI(object):
                     self.output.warn('Failed to perform overlay type or url updates', 2)
                     self.output.warn('    for Overlay: %s' % ovl, 2)
                     self.output.warn('    Error was: %s' % str(error))
-                pass
+                    continue
 
             try:
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-16 18:06 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-08-16 18:06 UTC (permalink / raw
  To: gentoo-commits

commit:     754cc935e1484b580e1bcbabb4210ffc4084efc6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 26 23:38:14 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug 16 17:58:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=754cc935

Fix errors in overlay updates.

Original problem reported in #gentoo-overlays by user quinso.

---
 layman/api.py | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index bb63d8d..cff89ed 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -409,9 +409,8 @@ class LaymanAPI(object):
         current_src = odb.sources[0].src
         (available_srcs, valid) = verify_overlay_src(current_src,
             set(e.src for e in ordb.sources))
-            
+
         if ordb and odb and not valid:
-            update_url = True
             if len(available_srcs) == 1:
                 plural = ''
                 candidates = '  %s' % tuple(available_srcs)[0]
@@ -437,8 +436,8 @@ class LaymanAPI(object):
                      'candidates':candidates,
                      'plural':plural,
                   })
-            return True, msg
-        return False, ''
+            return True, msg, available_srcs
+        return False, '', available_srcs
 
     def sync(self, repos, output_results=True, update_news=False):
         """syncs the specified repo(s) specified by repos
@@ -486,22 +485,29 @@ class LaymanAPI(object):
                 self.output.debug("API.sync(); else: self._get_remote_db().select(ovl)", 5)
 
                 (diff_type, type_msg) = self._verify_overlay_type(odb, ordb)
-                (update_url, url_msg) = self._verify_overlay_source(odb, ordb)
+                (update_url, url_msg, available_srcs) = self._verify_overlay_source(odb, ordb)
+
+                try:
+                    if diff_type:
+                        self.output.debug("API.sync(); starting API.readd_repos(ovl)", 5)
+                        warnings.append((ovl, type_msg))
+                        self.readd_repos(ovl)
+                        success.append((ovl, 'Successfully readded overlay "' + ovl + '".'))
+                    else:
+                        if update_url:
+                            self.output.debug("API.sync() starting db.update(ovl)", 5)
+                            warnings.append((ovl, url_msg))
+                            update_success = db.update(ordb, available_srcs)
+                            if not update_success:
+                                self.output.warn('Failed to update repo...readding', 2)
+                                self.readd_repos(ovl)
+                except Exception as error:
+                    self.output.warn('Failed to perform overlay type or url updates', 2)
+                    self.output.warn('    for Overlay: %s' % ovl, 2)
+                    self.output.warn('    Error was: %s' % str(error))
+                continue
 
             try:
-                if diff_type:
-                    self.output.debug("API.sync(); starting API.readd_repos(ovl)", 5)
-                    warnings.append((ovl, type_msg))
-                    self.readd_repos(ovl)
-                    success.append((ovl, 'Successfully readded overlay "' + ovl + '".'))
-                else:
-                    if update_url:
-                        self.output.debug("API.sync() starting db.update(ovl)", 5)
-                        warnings.append((ovl, url_msg))
-                        update_success = db.update(ordb, available_srcs)
-                        if not update_success:
-                            self.output.warn('Failed to update repo...readding', 2)
-                            self.readd_repos(ovl)
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)
                     db.sync(ovl)
                     success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-08-15 23:59 Devan Franchini
  2014-08-19  1:49 ` Devan Franchini
  0 siblings, 1 reply; 246+ messages in thread
From: Devan Franchini @ 2014-08-15 23:59 UTC (permalink / raw
  To: gentoo-commits

commit:     586a89a52c6ff564016780718fc07518dcea05fc
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 15 23:59:46 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 23:59:46 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=586a89a5

api.py: Modifies supported_types() module checking

---
 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index b3f33f6..bb63d8d 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -626,7 +626,7 @@ class LaymanAPI(object):
         with boolean values"""
         here = os.path.dirname(os.path.realpath(__file__))
         modpath = os.path.join('overlays', 'modules')
-        modules = os.path.listdir(os.path.join(here, modpath))
+        modules = os.listdir(os.path.join(here, modpath))
 
         cmds = [x for x in self.config.keys() if '_command' in x]
         supported = {}


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-06-16  3:40 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f7896d0585a82f73cb20fb0d5a6e7ea7e50c77b3
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 23 22:07:07 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f7896d05

api.py: incorporates db.update() in api.sync()

---
 layman/api.py | 83 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 31 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index b5b6a2a..413f8d0 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -342,6 +342,49 @@ class LaymanAPI(object):
             return True, msg
         return False, ''
 
+    def _verify_overlay_source(self, odb, ordb)
+        """
+        Verifies the overlay source url against the source url(s)
+        reported by the remote database.
+
+        @param odb: local database of overlay information.
+        @param ordb: remote database of overlay information.
+        @rtype (boolean, msg)
+        """
+        current_src = odb.sources[0].src
+        (available_srcs, valid) = verify_overlay_src(current_src,
+            set(e.src for e in ordb.sources))
+            
+        if ordb and odb and not valid:
+            update_url = True
+            if len(available_srcs) == 1:
+                plural = ''
+                candidates = '  %s' % tuple(available_srcs)[0]
+            else:
+                plural = 's'
+                candidates = '\n'.join(('  %d. %s' % (ovl + 1, v)) \
+                    for ovl, v in enumerate(available_srcs))
+            msg = 'The source of the overlay "%(repo_name)s" seems to have changed.\n'\
+                  'You currently sync from\n'\
+                  '\n'\
+                  '  %(current_src)s\n'
+                  '\n'\
+                  'while the remote lists report\n'\
+                  '\n'\
+                  '%(candidates)s\n'\
+                  '\n'\
+                  'as correct location%(plural)s.\n'\
+                  '\n'\
+                  'Repo: "%(repo_name)s" will be updated...' %\
+                  ({
+                     'repo_name':odb.name,
+                     'current_src':current_src,
+                     'candidates':candidates,
+                     'plural':plural,
+                  })
+            return True, msg
+        return False, ''
+
     def sync(self, repos, output_results=True, update_news=False):
         """syncs the specified repo(s) specified by repos
 
@@ -360,6 +403,7 @@ class LaymanAPI(object):
 
         self.output.debug("API.sync(); starting ovl loop", 5)
         for ovl in repos:
+            update_url = False
             self.output.debug("API.sync(); starting ovl = %s" %ovl, 5)
             try:
                 #self.output.debug("API.sync(); selecting %s, db = %s" % (ovl, str(db)), 5)
@@ -384,39 +428,9 @@ class LaymanAPI(object):
                 warnings.append((ovl, message))
             else:
                 self.output.debug("API.sync(); else: self._get_remote_db().select(ovl)", 5)
-                current_src = odb.sources[0].src
-                (available_srcs, valid) = verify_overlay_src(current_src, 
-                                            set(e.src for e in ordb.sources))
 
                 (diff_type, type_msg) = self._verify_overlay_type(odb, ordb)
-
-                if ordb and odb and not valid:
-                    if len(available_srcs) == 1:
-                        plural = ''
-                        candidates = '  %s' % tuple(available_srcs)[0]
-                    else:
-                        plural = 's'
-                        candidates = '\n'.join(('  %d. %s' % (ovl + 1, v)) \
-                         for ovl, v in enumerate(available_srcs))
-
-                    warnings.append((ovl,
-                        'The source of the overlay "%(repo_name)s" seems to have changed.\n'
-                        'You currently sync from\n'
-                        '\n'
-                        '  %(current_src)s\n'
-                        '\n'
-                        'while the remote lists report\n'
-                        '\n'
-                        '%(candidates)s\n'
-                        '\n'
-                        'as correct location%(plural)s.\n'
-                        'Please consider removing and re-adding the overlay.' %
-                        {
-                            'repo_name':ovl,
-                            'current_src':current_src,
-                            'candidates':candidates,
-                            'plural':plural,
-                            }))
+                (update_url, url_msg) = self._verify_overlay_source(odb, ordb)
 
             try:
                 if diff_type:
@@ -425,6 +439,13 @@ class LaymanAPI(object):
                     self.readd_repos(ovl)
                     success.append((ovl, 'Successfully readded overlay "' + ovl + '".'))
                 else:
+                    if update_url:
+                        self.output.debug("API.sync() starting db.update(ovl)", 5)
+                        warnings.append((ovl, url_msg))
+                        update_success = db.update(ordb, available_srcs)
+                        if not update_success:
+                            self.output.warn('Failed to update repo...readding', 2)
+                            self.readd_repos(ovl)
                     self.output.debug("API.sync(); starting db.sync(ovl)", 5)
                     db.sync(ovl)
                     success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-06-16  3:40 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:40 UTC (permalink / raw
  To: gentoo-commits

commit:     4c5e1f9c86d074d2b220adf3fcf892a06c23256f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 06:58:20 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:50 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4c5e1f9c

api.py: fixes success assignment in delete_repos()

---
 layman/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 413f8d0..041b737 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -118,7 +118,7 @@ class LaymanAPI(object):
                 continue
             success = False
             try:
-                self._get_installed_db().delete(
+                success = self._get_installed_db().delete(
                     self._get_installed_db().select(ovl))
             except Exception as e:
                 self._error(


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-06-16  3:40 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f8132d4a8c8bf44ed90bef88c35eb9565e6a4a4d
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  1 22:23:50 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:50 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f8132d4a

config.py: moves EPREFIX constant to top of file

---
 layman/config.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 9d2bc7f..31dc0ac 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -27,7 +27,6 @@ from __future__ import unicode_literals
 __version__ = "0.2"
 
 
-
 import sys
 import os
 
@@ -41,6 +40,13 @@ except:
 from layman.output import Message
 from layman.utils import path
 
+# establish the eprefix, initially set so eprefixify can
+# set it on install
+EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
+# check and set it if it wasn't
+if "GENTOO_PORTAGE_EPREFIX" in EPREFIX:
+    EPREFIX = ''
+
 def read_layman_config(config=None, defaults=None, output=None):
     """reads the config file defined in defaults['config']
     and updates the config
@@ -66,14 +72,6 @@ def read_layman_config(config=None, defaults=None, output=None):
                 overlays.update(["file://" + _path])
         config.set('MAIN', 'overlays', '\n'.join(overlays))
 
-# establish the eprefix, initially set so eprefixify can
-# set it on install
-EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
-
-# check and set it if it wasn't
-if "GENTOO_PORTAGE_EPREFIX" in EPREFIX:
-    EPREFIX = ''
-
 
 class BareConfig(object):
     '''Handles the configuration only.'''


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
@ 2014-06-16  3:37 Brian Dolbec
  2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     095db013be3d0ab6c5ad4dec14d56cd0facaa192
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  5 14:52:06 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Jun 14 22:06:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=095db013

reposconf.py: Adds overlay priority value

---
 layman/reposconf.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layman/reposconf.py b/layman/reposconf.py
index 3216591..a7a0166 100644
--- a/layman/reposconf.py
+++ b/layman/reposconf.py
@@ -78,6 +78,7 @@ class ConfigHandler:
         @return boolean: reflects a successful/failed write to the config file.
         '''
         self.repo_conf.add_section(overlay.name)
+        self.repo_conf.set(overlay.name, 'priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, 'location', path((self.storage, overlay.name)))
         self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
         self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
@ 2014-06-16  3:37 Brian Dolbec
  2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     f1e023c68411ac7319e163c66a41fcaf55193e1f
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 07:09:28 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:50 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f1e023c6

api.py: fixes byte string output for update_news()

---
 layman/api.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/layman/api.py b/layman/api.py
index 041b737..d9d3eb1 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -639,6 +639,8 @@ class LaymanAPI(object):
                     # because it may be different than layman's name for it
                     repo_names = []
                     for repo in repos:
+                        if isinstance(repo, bytes):
+                            repo = repo.decode('UTF-8')
                         ovl = self._get_installed_db().select(repo)
                         ovl_path = os.path.join(ovl.config['storage'], repo)
                         name = portdb.getRepositoryName(ovl_path)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
@ 2014-06-16  3:37 Brian Dolbec
  2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     ccad04bd179ea25be90283bbcee74628ecce47a5
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 23 21:59:10 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ccad04bd

db.py: adds update() function

---
 layman/db.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/layman/db.py b/layman/db.py
index c4e322e..fa28e06 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -222,6 +222,23 @@ class DB(DbBase):
             return False
         return True
 
+
+    def update(self, overlay, available_srcs):
+        '''
+        Updates the overlay source via the available source(s).
+        
+        @params overlay: layman.overlay.Overlay object.
+        @params available_srcs: set of available source URLs.
+        '''
+
+        source, result = self.overlays[overlay.name].update(self.config['storage'],
+                                                    available_srcs)
+        self.overlays[overlay.name].sources = source
+        self.repo_conf.update(self.overlays[overlay.name])
+        self.write(self.path)
+
+        return result
+
     def sync(self, overlay_name):
         '''Synchronize the given overlay.'''
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
@ 2014-06-16  3:37 Brian Dolbec
  2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2014-06-16  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     e66be21d91f4f5264e1933a03271c4eca5f14d31
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 07:32:48 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e66be21d

{argsparser, cli}.py: adds --readd cli option

---
 layman/argsparser.py | 11 +++++++++--
 layman/cli.py        | 18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index aa1cde3..f868cca 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -40,9 +40,9 @@ from layman.version import VERSION
 
 
 _USAGE = """
-  layman (-a|-d|-s|-i) (OVERLAY|ALL)
+  layman (-a|-d|-r|-s|-i) (OVERLAY|ALL)
   # it also supports multiple actions
-  layman (-a|-d|-s|-i) (OVERLAY|ALL) [ [(-a|-d|-s|-i) (OVERLAY)] ...]
+  layman (-a|-d|-r|-s|-i) (OVERLAY|ALL) [ [(-a|-d|-r|-s|-i) (OVERLAY)] ...]
   layman -f [-o URL]
   layman (-l|-L|-S)"""
 
@@ -144,6 +144,13 @@ class ArgsParser(BareConfig):
                              'ing order of the overlays in the PORTDIR_OVERLAY varia'
                              'ble.')
 
+        actions.add_argument('-r',
+                             '--readd',
+                             action = 'append',
+                             help = 'Remove and re-add the given overlay from the cached'
+                             ' remote list to your locally installed overlays... Specify'
+                             ' "ALL" to re-add all local overlays.')
+
         actions.add_argument('-s',
                              '--sync',
                              action = 'append',

diff --git a/layman/cli.py b/layman/cli.py
index 159b413..f0dc181 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -134,7 +134,6 @@ class Main(object):
 
     def __init__(self, config):
         self.config = config
-        #print "config.keys()", config.keys()
         self.output = config['output']
         self.api = LaymanAPI(config,
                              report_errors=False,
@@ -145,6 +144,7 @@ class Main(object):
                         ('sync',       'Sync'),
                         ('info',       'Info'),
                         ('sync_all',   'Sync'),
+                        ('readd',      'Readd'),
                         ('delete',     'Delete'),
                         ('list',       'ListRemote'),
                         ('list_local', 'ListLocal'),]
@@ -251,6 +251,22 @@ class Main(object):
         return result
 
 
+    def Readd(self):
+        '''Readds the selected overlay(s).
+        '''
+        self.output.info('Reinstalling overlay(s),...', 2)
+        selection = decode_selection(self.config['readd'])
+        if ALL_KEYWORD in selection:
+            selection = self.api.get_installed()
+        self.output.debug('Reinstalling selected overlay(s)', 6)
+        result = self.api.readd_repos(selection, update_news=True)
+        if result:
+            self.output.info('Successfully reinstalled overlay(s) ' +
+                ', '.join((x.decode('UTF-8') if isinstance(x, bytes) else x) for x in selection)
+                + '.', 2)
+        self.output.notice('')
+        return result
+
 
     def Sync(self):
         ''' Syncs the selected overlays.


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-05-07 22:18 Devan Franchini
  0 siblings, 0 replies; 246+ messages in thread
From: Devan Franchini @ 2014-05-07 22:18 UTC (permalink / raw
  To: gentoo-commits

commit:     908a64e8598ca8a65fdb1879ed18e69a0d801249
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May  7 22:17:23 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May  7 22:17:23 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=908a64e8

layman/{config, constants, output}.py: Adds notice level.

The -q flag setting was being ignored by output.notice() calls.
Adding note_level to the output.notice() function makes it so
that the output will be quieted, if desired.

X-Gentoo-Bug: 457726
X-Gentoo-Bug-URL: https://bugs.gentoo.org/457726

---
 layman/config.py    |  1 +
 layman/constants.py |  1 +
 layman/output.py    | 19 ++++++++++++++++---
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 576ed05..bf33f50 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -228,6 +228,7 @@ class BareConfig(object):
     def _set_quietness(self, value):
             self._options['output'].set_info_level(value)
             self._options['output'].set_warn_level(value)
+            self._options['output'].set_note_level(value)
 
     def __getitem__(self, key):
         return self._get_(key)

diff --git a/layman/constants.py b/layman/constants.py
index 6f53de3..9a2af40 100644
--- a/layman/constants.py
+++ b/layman/constants.py
@@ -48,6 +48,7 @@ NOT_SUPPORTED_MSG = '*** You are lacking the necessary tools' +\
 OFF = 0
 WARN_LEVEL = 4
 INFO_LEVEL = 4
+NOTE_LEVEL = 4
 DEBUG_LEVEL = 4
 DEBUG_VERBOSITY = 2
 

diff --git a/layman/output.py b/layman/output.py
index b48531a..48b44a1 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -12,7 +12,7 @@ __version__ = "0.1"
 
 import sys
 
-from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, DEBUG_LEVEL, OFF
+from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, NOTE_LEVEL, DEBUG_LEVEL, OFF
 from layman.compatibility import encode
 
 
@@ -25,6 +25,7 @@ class MessageBase(object):
                  err = sys.stderr,
                  info_level = INFO_LEVEL,
                  warn_level = WARN_LEVEL,
+                 note_level = NOTE_LEVEL,
                  col = True,
                  error_callback=None
                  ):
@@ -46,6 +47,9 @@ class MessageBase(object):
         # The higher the level the more information you will get
         self.info_lev = info_level
 
+        # The higher the level the more information you will get
+        self.note_lev = note_level
+
         # Should the output be colored?
         self.color_func = None
         self.set_colorize(col)
@@ -81,6 +85,10 @@ class MessageBase(object):
         self.warn_lev = warn_level
 
 
+    def set_note_level(self, note_level = NOTE_LEVEL):
+        self.note_lev = note_level
+
+
     def set_debug_level(self, debugging_level = DEBUG_LEVEL):
         self.debug_lev = debugging_level
 
@@ -103,12 +111,13 @@ class Message(MessageBase):
                  err = sys.stderr,
                  info_level = INFO_LEVEL,
                  warn_level = WARN_LEVEL,
+                 note_level = NOTE_LEVEL,
                  col = True,
                  error_callback = None
                 ):
 
         MessageBase.__init__(self, out, err, info_level, warn_level,
-            col, error_callback)
+            note_level, col, error_callback)
 
 
     ## Output Functions
@@ -127,7 +136,11 @@ class Message(MessageBase):
             print  >> self.std_out, self.color_func('yellow', 'DEBUG: ') + i
 
 
-    def notice (self, note):
+    def notice (self, note, level = NOTE_LEVEL):
+
+        if level > self.note_lev:
+            return
+
         print >> self.std_out, note
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2014-03-10  3:18 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2014-03-10  3:18 UTC (permalink / raw
  To: gentoo-commits

commit:     898fcf8d2a0a8c207984b708642e0bae217a5317
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 10 03:13:49 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Mar 10 03:17:53 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=898fcf8d

remotedb.py: Fix a couple debug noise level settings,

Fix some long lines, parameter spacing.

---
 layman/remotedb.py | 53 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index fbd4200..98dffbb 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -95,7 +95,8 @@ class RemoteDB(DbBase):
         if GPG_ENABLED:
             self.get_gpg_urls()
         else:
-            self.output.debug('RemoteDB.__init__(), NOT GPG_ENABLED, bypassing...', 2)
+            self.output.debug('RemoteDB.__init__(), NOT GPG_ENABLED, '
+                'bypassing...', 2)
 
         # add up the lists to load for display, etc.
         # unsigned overlay lists
@@ -105,9 +106,13 @@ class RemoteDB(DbBase):
         # single file signed, compressed, clearsigned
         paths.extend([self.filepath(i) + '.xml' for i in self.signed_urls])
 
-        self.output.debug('RemoteDB.__init__(), url lists= \nself.urls: %s\nself.detached_urls: %s\nself.signed_urls: %s' % (str(self.urls), str(self.detached_urls), str(self.signed_urls)), 2)
+        self.output.debug('RemoteDB.__init__(), url lists= \nself.urls: '
+            '%s\nself.detached_urls: %s\nself.signed_urls: %s'
+            % (str(self.urls), str(self.detached_urls), str(self.signed_urls)),
+            2)
 
-        self.output.debug('RemoteDB.__init__(), paths to load = %s' %str(paths), 2)
+        self.output.debug('RemoteDB.__init__(), paths to load = %s' %str(paths),
+            2)
 
         if config['nocheck']:
             ignore = 2
@@ -167,7 +172,7 @@ class RemoteDB(DbBase):
         url_lists = [self.urls, self.detached_urls, self.signed_urls]
         need_gpg = [False, True, True]
         for index in range(0, 3):
-            self.output.debug("RemoteDB.cache() index = %s" %str(index),2)
+            self.output.debug("RemoteDB.cache() index = %s" %str(index), 2)
             urls = url_lists[index]
             if need_gpg[index] and len(urls) and self.gpg is None:
                 #initialize our gpg instance
@@ -176,7 +181,7 @@ class RemoteDB(DbBase):
             for url in urls:
                 sig = ''
                 self.output.debug("RemoteDB.cache() url = %s is a tuple=%s"
-                    %(str(url), str(isinstance(url, tuple))),2)
+                    %(str(url), str(isinstance(url, tuple))), 2)
                 filepath, mpath, tpath, sig = self._paths(url)
                 if 'file://' in url:
                     success, olist, timestamp = self._fetch_file(
@@ -191,15 +196,17 @@ class RemoteDB(DbBase):
                     #succeeded = False
                     continue
 
-                self.output.debug("RemoteDB.cache() len(olist) = %s" %str(len(olist)),2)
+                self.output.debug("RemoteDB.cache() len(olist) = %s"
+                    % str(len(olist)), 2)
                 # GPG handling
                 if need_gpg[index]:
                     olist, verified = self.verify_gpg(url, sig, olist)
                     if not verified:
                         self.output.debug("RemoteDB.cache() gpg returned "
-                            "verified = %s" %str(verified),2)
+                            "verified = %s" %str(verified), 2)
                         succeeded = False
-                        filename = os.path.join(self.config['storage'], "Failed-to-verify-sig")
+                        filename = os.path.join(self.config['storage'],
+                                                "Failed-to-verify-sig")
                         self.write_cache(olist, filename)
                         continue
 
@@ -214,13 +221,13 @@ class RemoteDB(DbBase):
                 has_updates = max(has_updates,
                     self.write_cache(olist, mpath, tpath, timestamp))
 
-            self.output.debug("RemoteDB.cache() self.urls:  has_updates, succeeded"
-                " %s, %s" % (str(has_updates), str(succeeded)), 4)
+            self.output.debug("RemoteDB.cache() self.urls:  has_updates, "
+                "succeeded %s, %s" % (str(has_updates), str(succeeded)), 4)
         return has_updates, succeeded
 
 
     def _paths(self, url):
-        self.output.debug("RemoteDB._paths(), url is tuple %s" % str(url),2)
+        self.output.debug("RemoteDB._paths(), url is tuple %s" % str(url), 2)
         if isinstance(url, tuple):
             filepath = self.filepath(url[0])
             sig = filepath + '.sig'
@@ -292,8 +299,10 @@ class RemoteDB(DbBase):
             quieter = 1
             self.output.info('Fetching new list... %s' % url, 4 + quieter)
             if url_timestamp is not None:
-                self.output.info('Last-modified: %s' % url_timestamp, 4 + quieter)
-            self.output.debug('RemoteDB._fetch_url(), olist type = %s' %str(type(olist)),2)
+                self.output.info('Last-modified: %s' % url_timestamp,
+                    4 + quieter)
+            self.output.debug('RemoteDB._fetch_url(), olist type = %s'
+                % str(type(olist)),2)
 
             return (True, olist, url_timestamp)
 
@@ -314,7 +323,8 @@ class RemoteDB(DbBase):
 
         if not self.check_path([mpath]):
             return (False, '', '')
-        self.output.debug('RemoteDB._fetch_url(); headers = %s' %str(headers))
+        self.output.debug('RemoteDB._fetch_url(); headers = %s'
+            % str(headers), 2)
         self.output.debug('RemoteDB._fetch_url(); connecting to opener', 2)
         try:
             connection = requests.get(
@@ -334,7 +344,7 @@ class RemoteDB(DbBase):
             # py2, py3 compatibility, since only py2 returns keys as lower()
         headers = dict((x.lower(), x) for x in list(connection.headers))
         self.output.info('HEADERS = %s' %str(connection.headers), 4)
-        self.output.debug('Status_code = %i' % connection.status_code)
+        self.output.debug('Status_code = %i' % connection.status_code, 2)
         if connection.status_code in [304]:
             self.output.info('Remote list already up to date: %s'
                 % url, 4)
@@ -379,8 +389,9 @@ class RemoteDB(DbBase):
         try:
             self.read(olist, origin=url)
         except Exception, error:
-            self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n" % url,2)
-            self.output.debug(olist,2)
+            self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n"
+                % url,2)
+            self.output.debug(olist, 2)
             raise IOError('Failed to parse the overlays list fetched fr'
                           'om ' + url + '\nThis means that the download'
                           'ed file is somehow corrupt or there was a pr'
@@ -434,7 +445,7 @@ class RemoteDB(DbBase):
             olist = gpg_result.output
         # verify and report
         self.output.debug("gpg_result, verified=%s, len(olist)=%s"
-            % (gpg_result.verified[0], str(len(olist))),1)
+            % (gpg_result.verified[0], str(len(olist))), 1)
         if gpg_result.verified[0]:
             self.output.info("GPG verification succeeded for gpg-signed url.", 4)
             self.output.info('\tSignature result:' + str(gpg_result.verified), 4)
@@ -446,7 +457,7 @@ class RemoteDB(DbBase):
 
 
     def dl_sig(self, url, sig):
-        self.output.debug("RemoteDB.dl_sig() url=%s, sig=%s" % (url, sig),2)
+        self.output.debug("RemoteDB.dl_sig() url=%s, sig=%s" % (url, sig), 2)
         success, newsig, timestamp = self._fetch_url(url, sig)
         if success:
             success = self.write_cache(newsig, sig)
@@ -454,13 +465,13 @@ class RemoteDB(DbBase):
 
 
     def init_gpg(self):
-        self.output.debug("RemoteDB.init_gpg(), initializing",2)
+        self.output.debug("RemoteDB.init_gpg(), initializing", 2)
         if not self.gpg_config:
             self.gpg_config = GPGConfig()
 
         if not self.gpg:
             self.gpg = GPG(self.gpg_config)
-        self.output.debug("RemoteDB.init_gpg(), initialized :D",2)
+        self.output.debug("RemoteDB.init_gpg(), initialized :D", 2)
 
     def get_gpg_urls(self):
         '''Extend paths with gpg signed url listings from the config


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2013-12-29  2:30 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2013-12-29  2:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ae66303721ccd3d42d181f4042db94f731fbce97
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 29 02:29:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Dec 29 02:29:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ae663037

Indent fix.

---
 layman/remotedb.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index d623242..fbd4200 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -234,15 +234,15 @@ class RemoteDB(DbBase):
 
     @staticmethod
     def _create_storage(mpath):
-            # Create our storage directory if it is missing
-            if not os.path.exists(os.path.dirname(mpath)):
-                try:
-                    os.makedirs(os.path.dirname(mpath))
-                except OSError, error:
-                    raise OSError('Failed to create layman storage direct'
-                                  + 'ory ' + os.path.dirname(mpath) + '\n'
-                                  + 'Error was:' + str(error))
-            return
+        # Create our storage directory if it is missing
+        if not os.path.exists(os.path.dirname(mpath)):
+            try:
+                os.makedirs(os.path.dirname(mpath))
+            except OSError, error:
+                raise OSError('Failed to create layman storage directory ' +
+                              os.path.dirname(mpath) + '\n' +
+                              'Error was:' + str(error))
+        return
 
 
     def filepath(self, url):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2013-08-18 14:48 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2013-08-18 14:48 UTC (permalink / raw
  To: gentoo-commits

commit:     3168bb034ecb82785143a0e23e4b3ac91cf76508
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 18 14:07:48 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug 18 14:07:48 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3168bb03

reduce indent level

---
 layman/config.py | 137 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 70 insertions(+), 67 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 44a419d..9586835 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -93,74 +93,77 @@ class BareConfig(object):
             self.root = root
 
         self._defaults = {
-                    'configdir': path([self.root, EPREFIX,'/etc/layman']),
-                    'config'    : '%(configdir)s/layman.cfg',
-                    'storage'   : path([self.root, EPREFIX,'/var/lib/layman']),
-                    'cache'     : '%(storage)s/cache',
-                    'local_list': '%(storage)s/overlays.xml',
-                    'installed': '%(storage)s/installed.xml',
-                    'make_conf' : '%(storage)s/make.conf',
-                    'nocheck'   : 'yes',
-                    'http_proxy'     : '',
-                    'https_proxy'     : '',
-                    'umask'     : '0022',
-                    'news_reporter': 'portage',
-                    'custom_news_pkg': '',
-                    'gpg_detached_lists': 'https://api.gentoo.org/overlays/repositories.xml https://api.gentoo.org/overlays/repositories.xml.asc',
-                    'gpg_signed_lists': '',
-                    'overlays'  :
-                    'https://api.gentoo.org/overlays/repositories.xml',
-                    'overlay_defs': '%(configdir)s/overlays',
-                    'bzr_command': path([self.root, EPREFIX,'/usr/bin/bzr']),
-                    'cvs_command': path([self.root, EPREFIX,'/usr/bin/cvs']),
-                    'darcs_command': path([self.root, EPREFIX,'/usr/bin/darcs']),
-                    'git_command': path([self.root, EPREFIX,'/usr/bin/git']),
-                    'g-common_command': path([self.root, EPREFIX,'/usr/bin/g-common']),
-                    'mercurial_command': path([self.root, EPREFIX,'/usr/bin/hg']),
-                    'rsync_command': path([self.root, EPREFIX,'/usr/bin/rsync']),
-                    'svn_command': path([self.root, EPREFIX,'/usr/bin/svn']),
-                    'tar_command': path([self.root, EPREFIX,'/bin/tar']),
-                    't/f_options': ['nocheck'],
-                    'bzr_addopts' : '',
-                    'bzr_syncopts' : '',
-                    'cvs_addopts' : '',
-                    'cvs_syncopts' : '',
-                    'darcs_addopts' : '',
-                    'darcs_syncopts' : '',
-                    'git_addopts' : '',
-                    'git_syncopts' : '',
-                    'mercurial_addopts' : '',
-                    'mercurial_syncopts' : '',
-                    'rsync_syncopts' : '',
-                    'svn_addopts' : '',
-                    'svn_syncopts' : '',
-                    'g-common_generateopts' : '',
-                    'g-common_syncopts' : '',
-                    'bzr_postsync' : '',
-                    'cvs_postsync' : '',
-                    'darcs_postsync' : '',
-                    'git_postsync' : '',
-                    'mercurial_postsync' : '',
-                    'rsync_postsync' : '',
-                    'svn_postsync' : '',
-                    'tar_postsync' : '',
-                    'g-common_postsync' : '',
-                    'git_user': 'layman',
-                    'git_email': 'layman@localhost',
-                    }
+            'configdir': path([self.root, EPREFIX,'/etc/layman']),
+            'config'    : '%(configdir)s/layman.cfg',
+            'storage'   : path([self.root, EPREFIX,'/var/lib/layman']),
+            'cache'     : '%(storage)s/cache',
+            'local_list': '%(storage)s/overlays.xml',
+            'installed': '%(storage)s/installed.xml',
+            'make_conf' : '%(storage)s/make.conf',
+            'repos_conf': '/etc/portage/repos.conf/layman.conf',
+            'conf_module': ['make_conf', 'repos_conf'],
+            'nocheck'   : 'yes',
+            'http_proxy'     : '',
+            'https_proxy'     : '',
+            'umask'     : '0022',
+            'news_reporter': 'portage',
+            'custom_news_pkg': '',
+            'gpg_detached_lists':
+                'https://api.gentoo.org/overlays/repositories.xml https://api.gentoo.org/overlays/repositories.xml.asc',
+            'gpg_signed_lists': '',
+            'overlays'  :
+                'https://api.gentoo.org/overlays/repositories.xml',
+            'overlay_defs': '%(configdir)s/overlays',
+            'bzr_command': path([self.root, EPREFIX,'/usr/bin/bzr']),
+            'cvs_command': path([self.root, EPREFIX,'/usr/bin/cvs']),
+            'darcs_command': path([self.root, EPREFIX,'/usr/bin/darcs']),
+            'git_command': path([self.root, EPREFIX,'/usr/bin/git']),
+            'g-common_command': path([self.root, EPREFIX,'/usr/bin/g-common']),
+            'mercurial_command': path([self.root, EPREFIX,'/usr/bin/hg']),
+            'rsync_command': path([self.root, EPREFIX,'/usr/bin/rsync']),
+            'svn_command': path([self.root, EPREFIX,'/usr/bin/svn']),
+            'tar_command': path([self.root, EPREFIX,'/bin/tar']),
+            't/f_options': ['nocheck'],
+            'bzr_addopts' : '',
+            'bzr_syncopts' : '',
+            'cvs_addopts' : '',
+            'cvs_syncopts' : '',
+            'darcs_addopts' : '',
+            'darcs_syncopts' : '',
+            'git_addopts' : '',
+            'git_syncopts' : '',
+            'mercurial_addopts' : '',
+            'mercurial_syncopts' : '',
+            'rsync_syncopts' : '',
+            'svn_addopts' : '',
+            'svn_syncopts' : '',
+            'g-common_generateopts' : '',
+            'g-common_syncopts' : '',
+            'bzr_postsync' : '',
+            'cvs_postsync' : '',
+            'darcs_postsync' : '',
+            'git_postsync' : '',
+            'mercurial_postsync' : '',
+            'rsync_postsync' : '',
+            'svn_postsync' : '',
+            'tar_postsync' : '',
+            'g-common_postsync' : '',
+            'git_user': 'layman',
+            'git_email': 'layman@localhost',
+            }
         self._options = {
-                    'config': config if config else self._defaults['config'],
-                    'stdout': stdout if stdout else sys.stdout,
-                    'stdin': stdin if stdin else sys.stdin,
-                    'stderr': stderr if stderr else sys.stderr,
-                    'output': output if output else Message(),
-                    'quietness': quietness,
-                    'nocolor': nocolor,
-                    'width': width,
-                    'verbose': verbose,
-                    'quiet': quiet,
-                    'custom_news_func': None,
-                    }
+            'config': config if config else self._defaults['config'],
+            'stdout': stdout if stdout else sys.stdout,
+            'stdin': stdin if stdin else sys.stdin,
+            'stderr': stderr if stderr else sys.stderr,
+            'output': output if output else Message(),
+            'quietness': quietness,
+            'nocolor': nocolor,
+            'width': width,
+            'verbose': verbose,
+            'quiet': quiet,
+            'custom_news_func': None,
+            }
         self._set_quietness(quietness)
         self.config = None
         if read_configfile:


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2013-07-29  1:46 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2013-07-29  1:46 UTC (permalink / raw
  To: gentoo-commits

commit:     2ea5d6470df7eebe35b17b898eabb58df2fa8b5c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 01:40:32 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jul 29 01:44:54 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2ea5d647

Add cli options to both layman-updater and layman to print the setup help messages.

---
 layman/argsparser.py |  8 ++++++++
 layman/cli.py        |  7 +++++++
 layman/updater.py    | 15 ++++++++++-----
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 3afc3ea..3e3d6f6 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -82,6 +82,12 @@ class ArgsParser(BareConfig):
             usage   = _USAGE,
             version = VERSION)
 
+        self.parser.add_option('-H',
+                        '--setup_help',
+                        action = 'store_true',
+                        help = 'Print the NEW INSTALL help messages.')
+
+
         #-----------------------------------------------------------------
         # Main Options
 
@@ -283,6 +289,8 @@ class ArgsParser(BareConfig):
             self.output.debug('ARGSPARSER: Got overlay_defs location at ' + \
                 self.defaults['overlay_defs'], 8)
 
+        self._options['setup_help'] = self.options.__dict__['setup_help']
+
         # Now parse the config file
         self.output.debug('ARGSPARSER: Reading config file at ' + \
             self.defaults['config'], 8)

diff --git a/layman/cli.py b/layman/cli.py
index 25c6f9a..a5d2799 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -149,6 +149,13 @@ class Main(object):
             " %s" % str(self.config.keys()), 6)
         # blank newline  -- no " *"
         self.output.notice('')
+
+        # check for and handle setup-help option
+        if self.config.get_option('setup_help'):
+            from layman.updater import Main as Updater
+            updater = Updater(config=self.config, output=self.output)
+            updater.print_instructions()
+
         # Make fetching the overlay list a default action
         if not 'nofetch' in self.config.keys():
             # Actions that implicitely call the fetch operation before

diff --git a/layman/updater.py b/layman/updater.py
index b9b72bc..f7d91e6 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -36,20 +36,23 @@ def rename_db(config, newname, output):
 
 class Main(object):
 
-    def __init__(self, root=None):
+    def __init__(self, root=None, config=None, output=None):
         self.parser = None
-        self.output = None
-        self.config = None
+        self.output = output
+        self.config = config
         self.args = None
         self.root = root
 
     def args_parser(self):
         self.parser = argparse.ArgumentParser(prog='layman-updater',
             description="Layman's update script")
+        self.parser.add_argument("-H", '--setup_help', action='store_true',
+            help = 'Print the NEW INSTALL help messages.')
         self.parser.add_argument("-c", "--config",
             help='the path to config file')
         self.parser.add_argument('--version', action='version',
             version='%(prog)s ' + VERSION)
+
         self.args = self.parser.parse_args()
 
     def __call__(self):
@@ -64,7 +67,7 @@ class Main(object):
         # fix the config path
         defaults = self.config.get_defaults()
         defaults['config'] = defaults['config'] \
-                % {'configdir': defaults['configdir']}
+            % {'configdir': defaults['configdir']}
         self.config.update_defaults({'config': defaults['config']})
 
         self.config.read_config(defaults)
@@ -73,7 +76,9 @@ class Main(object):
 
         self.output = layman_inst.output
 
-        if not self.check_is_new():
+        if self.args.setup_help:
+            self.print_instructions()
+        elif not self.check_is_new():
             self.rename_check()
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2013-01-11 18:29 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2013-01-11 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     fe8a30ff199edb5892ee5001c6f2476beee7377a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 18:28:29 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 11 18:28:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fe8a30ff

fix bug 451398 doctest failure

---
 layman/db.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 8dc968e..6530147 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -87,6 +87,7 @@ class DB(DbBase):
         >>> from layman.config import OptionConfig
         >>> myoptions = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
+        ...           'local_list': here + '/tests/testfiles/overlays.xml',
         ...           'make_conf' : write2,
         ...           'nocheck'    : 'yes',
         ...           'storage'   : tmpdir}
@@ -167,6 +168,7 @@ class DB(DbBase):
         >>> from layman.config import OptionConfig
         >>> myoptions = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
+        ...           'local_list': here + '/tests/testfiles/overlays.xml',
         ...           'make_conf' : write2,
         ...           'nocheck'    : 'yes',
         ...           'storage'   : tmpdir}


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-12-16 18:13 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-12-16 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     9bd33443c9971d9c91e369348a5dafdf5b5ec377
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 16 18:11:49 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Dec 16 18:11:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9bd33443

pyflakes cleanup

---
 layman/utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index 7cfdaef..ab9904f 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -214,5 +214,5 @@ def create_overlay_dict(**kwargs):
 #-------------------------------------------------------------------------------
 
 if __name__ == '__main__':
-    import doctest, sys
+    import doctest
     doctest.testmod(sys.modules[__name__])


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-28  4:14 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-28  4:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e1583b89f0bef9b9b821ecbd71761c8ddf99143f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 28 04:14:11 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Nov 28 04:14:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e1583b89

missed one rename from config to self.config

---
 layman/remotedb.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index f8aea16..cbe35b9 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -415,7 +415,7 @@ class RemoteDB(DbBase):
             self.detached_urls.append((u[0], u[1]))
 
         self.signed_urls = [i.strip()
-            for i in config['gpg_signed_lists'].split('\n') if len(i)]
+            for i in self.config['gpg_signed_lists'].split('\n') if len(i)]
 
 
 if __name__ == '__main__':


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-28  4:02 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-28  4:02 UTC (permalink / raw
  To: gentoo-commits

commit:     58a50b8ab5290b93631f6e20609936d426b360b8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 28 04:01:11 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Nov 28 04:01:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=58a50b8a

properly detect and enable gpg signed list support.  prevents a build failure if pygpg is not installed.

---
 layman/remotedb.py |   52 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/layman/remotedb.py b/layman/remotedb.py
index 851b89b..f8aea16 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -31,14 +31,22 @@ import sys
 import urllib2
 import hashlib
 
-from pygpg.config import GPGConfig
-from pygpg.gpg import GPG
+
+GPG_ENABLED = False
+try:
+    from pygpg.config import GPGConfig
+    from pygpg.gpg import GPG
+    GPG_ENABLED = True
+except ImportError:
+    pass
+
 
 from   layman.utils             import encoder
 from   layman.dbbase            import DbBase
 from   layman.version           import VERSION
 from layman.compatibility       import fileopen
 
+
 class RemoteDB(DbBase):
     '''Handles fetching the remote overlay list.'''
 
@@ -46,6 +54,8 @@ class RemoteDB(DbBase):
 
         self.config = config
         self.output = config['output']
+        self.detached_urls = []
+        self.signed_urls = []
 
         self.proxies = {}
 
@@ -62,20 +72,10 @@ class RemoteDB(DbBase):
         self.urls  = [i.strip()
             for i in config['overlays'].split('\n') if len(i)]
 
-        #pair up the list url and detached sig url
-        d_urls = [i.strip()
-            for i in config['gpg_detached_lists'].split('\n') if len(i)]
-        self.detached_urls = []
-        #for index in range(0, len(d_urls), 2):
-        #    self.detached_urls.append((d_urls[index], d_urls[index+1]))
-        for i in d_urls:
-            u = i.split()
-            self.detached_urls.append((u[0], u[1]))
-
-        self.signed_urls = [i.strip()
-            for i in config['gpg_signed_lists'].split('\n') if len(i)]
-
-        self.output.debug('RemoteDB.__init__(), url lists= \nself.urls: %s\nself.detached_urls: %s\nself.signed_urls: %s' % (str(self.urls), str(self.detached_urls), str(self.signed_urls)), 2)
+        if GPG_ENABLED:
+            self.get_gpg_urls()
+        else:
+            self.output.debug('RemoteDB.__init__(), NOT GPG_ENABLED, bypassing...', 2)
 
         # add up the lists to load for display, etc.
         # unsigned overlay lists
@@ -85,6 +85,8 @@ class RemoteDB(DbBase):
         # single file signed, compressed, clearsigned
         paths.extend([self.filepath(i) + '.xml' for i in self.signed_urls])
 
+        self.output.debug('RemoteDB.__init__(), url lists= \nself.urls: %s\nself.detached_urls: %s\nself.signed_urls: %s' % (str(self.urls), str(self.detached_urls), str(self.signed_urls)), 2)
+
         self.output.debug('RemoteDB.__init__(), paths to load = %s' %str(paths), 2)
 
         if config['nocheck']:
@@ -397,6 +399,24 @@ class RemoteDB(DbBase):
             self.gpg = GPG(self.gpg_config)
         self.output.debug("RemoteDB.init_gpg(), initialized :D",2)
 
+    def get_gpg_urls(self):
+        '''Extend paths with gpg signed url listings from the config
+
+        @param paths: list or urls to fetch
+        '''
+        #pair up the list url and detached sig url
+        d_urls = [i.strip()
+            for i in self.config['gpg_detached_lists'].split('\n') if len(i)]
+
+        #for index in range(0, len(d_urls), 2):
+        #    self.detached_urls.append((d_urls[index], d_urls[index+1]))
+        for i in d_urls:
+            u = i.split()
+            self.detached_urls.append((u[0], u[1]))
+
+        self.signed_urls = [i.strip()
+            for i in config['gpg_signed_lists'].split('\n') if len(i)]
+
 
 if __name__ == '__main__':
     import doctest


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-28  4:02 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-28  4:02 UTC (permalink / raw
  To: gentoo-commits

commit:     175648c0fad6b9bdeaf7cd6c47b67f53c7d5dcb0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 28 04:00:07 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Nov 28 04:00:07 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=175648c0

add a raise statement to be able to properly trace the import failure.  Thank you floppym.

---
 layman/__init__.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/__init__.py b/layman/__init__.py
index ce51804..7a6bff5 100644
--- a/layman/__init__.py
+++ b/layman/__init__.py
@@ -12,7 +12,8 @@ try:
     from layman.config import BareConfig
     from layman.output import Message
 except ImportError:
-    sys.stderr.write("!!! Layman API import failed.")
+    sys.stderr.write("!!! Layman API imports failed.")
+    raise
 
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-18 22:15 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-18 22:15 UTC (permalink / raw
  To: gentoo-commits

commit:     79c6f8fd75d87831023d0785f4f24ca490cc92af
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 18 19:08:26 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Nov 18 19:08:26 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=79c6f8fd

add auto detection for make.conf location

---
 layman/updater.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index ba9a1b8..b9b72bc 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -113,6 +113,9 @@ class Main(object):
 
 
     def print_instructions(self):
+        make_conf = '/etc/portage/make.conf'
+        if not os.access(make_conf, os.F_OK):
+            make_conf = '/etc/make.conf'
         messages = [
             "You are now ready to add overlays into your system.",
             "",
@@ -126,7 +129,7 @@ class Main(object):
             "",
             "If this is the very first overlay you add with layman,",
             "you need to append the following statement to your",
-            "/etc/portage/make.conf file:",
+            "%s file:" %make_conf,
             "",
             "  source /var/lib/layman/make.conf",
             "",


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-18 22:15 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-18 22:15 UTC (permalink / raw
  To: gentoo-commits

commit:     8c9b38354eec85108a018d1e129d1ffd0bc3e974
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 18 19:09:04 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Nov 18 19:09:04 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8c9b3835

pyflakes cleanup

---
 layman/output.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index c90fccc..b48531a 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -10,7 +10,7 @@
 __version__ = "0.1"
 
 
-import sys, types
+import sys
 
 from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, DEBUG_LEVEL, OFF
 from layman.compatibility import encode


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-18 22:15 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-18 22:15 UTC (permalink / raw
  To: gentoo-commits

commit:     60f1fa4b722a79cf86c6a0940a9df218d57787b3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 18 19:06:42 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Nov 18 19:06:42 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=60f1fa4b

remove the mispaelled duplicate file after syncronizing any changes

---
 layman/compatability.py |   45 ---------------------------------------------
 layman/compatibility.py |   21 +++++++++++++++++++--
 2 files changed, 19 insertions(+), 47 deletions(-)

diff --git a/layman/compatability.py b/layman/compatability.py
deleted file mode 100644
index ea7149e..0000000
--- a/layman/compatability.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-""" Copyright 2005 - 2008 Gunnar Wrobel
-              2011 - Brian Dolbec
- Distributed under the terms of the GNU General Public License v2
-"""
-
-import sys, types
-
-
-def encode(text, enc="UTF-8"):
-    """py2, py compatibility function"""
-    if hasattr(text, 'decode'):
-        return text.decode(enc)
-    return str(text)
-
-
-def fileopen(path, mode, enc="UTF-8"):
-    """py2, py3 compatibility function"""
-    try:
-        f = open(path, mode, encoding=enc)
-    except TypeError:
-        f = open(path, mode)
-    return f
-
-
-def cmp_to_key(mycmp):
-    'Convert a cmp= function into a key= function'
-    class K(object):
-        def __init__(self, obj, *args):
-            self.obj = obj
-        def __lt__(self, other):
-            return mycmp(self.obj, other.obj) < 0
-        def __gt__(self, other):
-            return mycmp(self.obj, other.obj) > 0
-        def __eq__(self, other):
-            return mycmp(self.obj, other.obj) == 0
-        def __le__(self, other):
-            return mycmp(self.obj, other.obj) <= 0
-        def __ge__(self, other):
-            return mycmp(self.obj, other.obj) >= 0
-        def __ne__(self, other):
-            return mycmp(self.obj, other.obj) != 0
-    return K

diff --git a/layman/compatibility.py b/layman/compatibility.py
index b71a8af..e6206db 100644
--- a/layman/compatibility.py
+++ b/layman/compatibility.py
@@ -6,8 +6,6 @@
  Distributed under the terms of the GNU General Public License v2
 """
 
-import sys, types
-
 
 def encode(text, enc="UTF-8"):
     """py2, py3 compatibility function"""
@@ -27,3 +25,22 @@ def fileopen(path, mode='r', enc="UTF-8"):
         f = open(path, mode)
     return f
 
+
+def cmp_to_key(mycmp):
+    'Convert a cmp= function into a key= function'
+    class K(object):
+        def __init__(self, obj, *args):
+            self.obj = obj
+        def __lt__(self, other):
+            return mycmp(self.obj, other.obj) < 0
+        def __gt__(self, other):
+            return mycmp(self.obj, other.obj) > 0
+        def __eq__(self, other):
+            return mycmp(self.obj, other.obj) == 0
+        def __le__(self, other):
+            return mycmp(self.obj, other.obj) <= 0
+        def __ge__(self, other):
+            return mycmp(self.obj, other.obj) >= 0
+        def __ne__(self, other):
+            return mycmp(self.obj, other.obj) != 0
+    return K


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-11-01  4:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-11-01  4:00 UTC (permalink / raw
  To: gentoo-commits

commit:     51ac7357314ff1a3648420e92f26f2d393be0277
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  1 03:59:39 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Nov  1 03:59:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=51ac7357

fix a bug in layman-updater to use MakeConf class to create a proper make.conf file.
Fix a comment path in MakeConf.

---
 layman/makeconf.py |    2 +-
 layman/updater.py  |   11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/layman/makeconf.py b/layman/makeconf.py
index 5f18b63..9740072 100644
--- a/layman/makeconf.py
+++ b/layman/makeconf.py
@@ -281,7 +281,7 @@ class MakeConf:
 
     def content(self):
         '''
-        Returns the content of the /var/layman/make.conf file.
+        Returns the content of the /var/lib/layman/make.conf file.
         '''
         try:
             make_conf = codecs.open(self.path, 'r', 'utf-8')

diff --git a/layman/updater.py b/layman/updater.py
index 1108ea3..ba9a1b8 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -145,12 +145,9 @@ class Main(object):
         self.output.info("  Creating layman's make.conf file")
         # create layman's %(storage)s/make.conf
         # so portage won't error
-        try:
-            make_conf = fileopen(self.config['make_conf'], mode="w")
-            make_conf.write("# Layman's make.conf\n\n")
-            make_conf.close()
-        except Exception, error:
-            self.output.error("  layman-updater: Error creating make.conf:")
-            self.output.error("  %s" % error)
+        from layman.makeconf import MakeConf
+        maker = MakeConf(self.config, None)
+        maker.write()
+
 
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-30  8:30 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-30  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     a2d4aef01ea7e2a850eb31df42b81681c6961d00
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 30 08:29:38 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Oct 30 08:29:38 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a2d4aef0

revert error introduced in commit 92a545dc6b64bbebfa9bc4c3788f1ae3db058788

---
 layman/config.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 3c57497..1f5bc34 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -166,7 +166,7 @@ class BareConfig(object):
                 # fix the config path
                 defaults['config'] = defaults['config'] \
                     % {'configdir': defaults['configdir']}
-            self.read_config(self.config, defaults, output=self.output)
+            self.read_config(defaults)
 
 
     def read_config(self, defaults):


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-17  6:21 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-17  6:21 UTC (permalink / raw
  To: gentoo-commits

commit:     8d66d64d26b80c336661beb03e5b3c0dfe491c50
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 17 06:21:03 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct 17 06:21:03 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8d66d64d

update the make.conf path to the correct one.

---
 layman/makeconf.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/layman/makeconf.py b/layman/makeconf.py
index 7eca2cd..5f18b63 100644
--- a/layman/makeconf.py
+++ b/layman/makeconf.py
@@ -5,7 +5,7 @@
 #################################################################################
 # File:       makeconf.py
 #
-#             Handles modifications to /etc/make.conf
+#             Handles modifications to /var/layman/make.conf
 #
 # Copyright:
 #             (c) 2005 - 2009 Gunnar Wrobel
@@ -29,7 +29,7 @@ from layman.utils import path
 
 class MakeConf:
     '''
-    Handles modifications to /etc/make.conf
+    Handles modifications to /var/layman/make.conf
 
     Check that an add/remove cycle does not modify the make.conf:
 
@@ -152,7 +152,7 @@ class MakeConf:
 
     def read(self, raise_error=False):
         '''
-        Read the list of registered overlays from /etc/make.conf.
+        Read the list of registered overlays from /var/layman/make.conf.
 
         >>> here = os.path.dirname(os.path.realpath(__file__))
         >>> config = {'installed' :
@@ -211,7 +211,7 @@ class MakeConf:
 
     def write(self):
         '''
-        Write the list of registered overlays to /etc/make.conf.
+        Write the list of registered overlays to /var/layman/make.conf.
 
         >>> import tempfile
         >>> tmpdir = tempfile.mkdtemp(prefix="laymantmp_")
@@ -281,7 +281,7 @@ class MakeConf:
 
     def content(self):
         '''
-        Returns the content of the /etc/make.conf file.
+        Returns the content of the /var/layman/make.conf file.
         '''
         try:
             make_conf = codecs.open(self.path, 'r', 'utf-8')


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-17  6:21 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-17  6:21 UTC (permalink / raw
  To: gentoo-commits

commit:     c1d3b0799e7fa4effd62372545f7a4a962f31bac
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 17 06:18:57 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct 17 06:18:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c1d3b079

fix typo reported by kurly in http://forums.gentoo.org/viewtopic-t-939646.html.

---
 layman/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index b716ea0..25c6f9a 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -195,7 +195,7 @@ class Main(object):
         self.output.debug('Checking for action errors', 4)
         if action_errors:
             for action, _errors in action_errors:
-                self.output.warn("CLI: Errors occured processing action"
+                self.output.warn("CLI: Errors occurred processing action"
                     " %s" % action)
                 for _error in _errors:
                     self.output.error(_error)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-13 22:20 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-13 22:20 UTC (permalink / raw
  To: gentoo-commits

commit:     4896f9a6e5d8b09187ffd0a000dbae3bdbcabd30
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 13 19:02:10 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Oct 13 20:26:51 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4896f9a6

commit missed compatibility file for py3, py2 functioning.

---
 layman/compatability.py |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/layman/compatability.py b/layman/compatability.py
new file mode 100644
index 0000000..ea7149e
--- /dev/null
+++ b/layman/compatability.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+""" Copyright 2005 - 2008 Gunnar Wrobel
+              2011 - Brian Dolbec
+ Distributed under the terms of the GNU General Public License v2
+"""
+
+import sys, types
+
+
+def encode(text, enc="UTF-8"):
+    """py2, py compatibility function"""
+    if hasattr(text, 'decode'):
+        return text.decode(enc)
+    return str(text)
+
+
+def fileopen(path, mode, enc="UTF-8"):
+    """py2, py3 compatibility function"""
+    try:
+        f = open(path, mode, encoding=enc)
+    except TypeError:
+        f = open(path, mode)
+    return f
+
+
+def cmp_to_key(mycmp):
+    'Convert a cmp= function into a key= function'
+    class K(object):
+        def __init__(self, obj, *args):
+            self.obj = obj
+        def __lt__(self, other):
+            return mycmp(self.obj, other.obj) < 0
+        def __gt__(self, other):
+            return mycmp(self.obj, other.obj) > 0
+        def __eq__(self, other):
+            return mycmp(self.obj, other.obj) == 0
+        def __le__(self, other):
+            return mycmp(self.obj, other.obj) <= 0
+        def __ge__(self, other):
+            return mycmp(self.obj, other.obj) >= 0
+        def __ne__(self, other):
+            return mycmp(self.obj, other.obj) != 0
+    return K


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-13 22:20 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-13 22:20 UTC (permalink / raw
  To: gentoo-commits

commit:     6330ab24c38a054247ed712df4f9e64927644145
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 13 19:58:00 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Oct 13 22:07:20 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6330ab24

move elog, einfo messages into updater and print them only if relavent.
indent ouput for better display.

---
 layman/updater.py |   83 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/layman/updater.py b/layman/updater.py
index 48fad10..1ee7345 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -8,26 +8,27 @@ import argparse
 from layman.config import OptionConfig
 from layman.api import LaymanAPI
 from layman.version import VERSION
+from layman.compatibility import fileopen
 
 
 def rename_db(config, newname, output):
     """small upgrade function to handle the name change
     for the installed xml file"""
     if os.access(config['local_list'], os.F_OK):
-        output.info("Automatic db rename, old name was..: %s"
+        output.info("  Automatic db rename, old name was..: %s"
             % config['local_list'],2)
         try:
             os.rename(config['local_list'], newname)
-            output.info("Automatic db rename, new "
+            output.info("  Automatic db rename, new "
                 "name is...: %s" %newname, 2)
             output.notice('')
             return
         except OSError, err:
-            output.error("Automatic db rename failed:\n%s" %str(err))
+            output.error("  Automatic db rename failed:\n%s" %str(err))
     else:
-        output.info("Automatic db rename, failed access to: %s"
+        output.info("  Automatic db rename, failed access to: %s"
             % config['local_list'],2)
-    output.die("Please check that /etc/layman.cfg is up"
+    output.die("  Please check that /etc/layman.cfg is up"
             " to date\nThen try running layman again.\n"
             "You may need to rename the old 'local_list' config setting"
             " to\nthe new 'installed' config setting's filename.\n")
@@ -43,7 +44,7 @@ class Main(object):
 
     def args_parser(self):
         self.parser = argparse.ArgumentParser(prog='layman-updater',
-            description="Layman's DB update script")
+            description="Layman's update script")
         self.parser.add_argument("-c", "--config",
             help='the path to config file')
         self.parser.add_argument('--version', action='version',
@@ -65,7 +66,16 @@ class Main(object):
 
         self.output = layman_inst.output
 
-        self.rename_check()
+        if not self.check_is_new():
+            self.rename_check()
+
+
+    def check_is_new(self):
+        if not os.access(self.config['make_conf'], os.F_OK):
+            self.create_make_conf()
+            self.print_instructions()
+            return True
+        return False
 
 
     def rename_check(self):
@@ -76,17 +86,64 @@ class Main(object):
         # check and handle the name change
         if not os.access(newname, os.F_OK):
             if os.access(self.config['local_list'], os.F_OK):
-                self.output.info("Layman automatic db rename utility, "
+                self.output.info("  Layman automatic db rename utility, "
                     "performing update", 2)
                 rename_db(self.config, newname, self.output)
         elif os.access(newname, os.F_OK) and \
             os.access(self.config['local_list'], os.F_OK):
-            self.output.error("Automatic db rename failed: "
+            self.output.error("  Automatic db rename failed: "
                 "Both old and new files exist")
-            self.output.error("Old file: %s still exists"
+            self.output.error(" Old file: %s still exists"
                 % self.config['local_list'])
-            self.output.error("New file: %s already exists" % newname)
+            self.output.error("  New file: %s already exists" % newname)
+        elif os.access(newname, os.F_OK):
+            self.output.info("  Automatic db rename: "
+                "db already updated: %s" % newname)
         else:
-            self.output.info("Automatic db rename "
-                "already updated: %s" % newname)
+            self.output.info("  Automatic db rename: "
+                "nothing to update")
         return
+
+
+    def print_instructions(self):
+        messages = [
+            "You are now ready to add overlays into your system.",
+            "",
+            "  layman -L",
+            "",
+            "will display a list of available overlays.",
+            "",
+            "Select an overlay and add it using",
+            "",
+            "  layman -a overlay-name",
+            "",
+            "If this is the very first overlay you add with layman,",
+            "you need to append the following statement to your",
+            "/etc/make.conf file:",
+            "",
+            "  source /var/lib/layman/make.conf",
+            "",
+            "If you modify the 'storage' parameter in the layman",
+            "configuration file (/etc/layman/layman.cfg) you will",
+            "need to adapt the path given above to the new storage",
+            "directory.",
+            "",
+        ]
+
+        for message in messages:
+            self.output.info("  " + message)
+
+
+    def create_make_conf(self):
+        self.output.info("  Creating layman's make.conf file")
+        # create layman's %(storage)s/make.conf
+        # so portage won't error
+        try:
+            make_conf = fileopen(self.config['make_conf'], mode="w")
+            make_conf.write("# Layman's make.conf\n\n")
+            make_conf.close()
+        except Exception, error:
+            self.output.error("  layman-updater: Error creating make.conf:")
+            self.output.error("  %s" % error)
+
+


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-08  5:37 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-08  5:37 UTC (permalink / raw
  To: gentoo-commits

commit:     25da05250a60d1bae9a03eadb8db4eb744cc4ae0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  8 05:37:00 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Oct  8 05:37:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=25da0525

Update doctest data for config changes.

---
 layman/argsparser.py |    2 +-
 layman/config.py     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index c8f3828..12898b8 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -64,7 +64,7 @@ class ArgsParser(BareConfig):
         >>> a['overlays']
         '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'overlay_defs', 'overlays', 'proxy', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'custom_news_pkg', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_email', 'git_postsync', 'git_syncopts', 'git_user', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'news_reporter', 'nocheck', 'overlay_defs', 'overlays', 'proxy', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'width']
                 '''
 
         BareConfig.__init__(self, stdout=stdout, stderr=stderr, stdin=stdin)

diff --git a/layman/config.py b/layman/config.py
index 8ac3ebf..56cb6f3 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -79,7 +79,7 @@ class BareConfig(object):
         >>> a['overlays']
         'http://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'custom_news_func', 'custom_news_pkg', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_email', 'git_postsync', 'git_syncopts', 'git_user', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'news_reporter', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
         >>> a.get_option('nocheck')
         True
         '''
@@ -269,7 +269,7 @@ class OptionConfig(BareConfig):
         >>> a["configdir"]
         '/etc/test-dir'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'custom_news_func', 'custom_news_pkg', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_email', 'git_postsync', 'git_syncopts', 'git_user', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'news_reporter', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
         """
         BareConfig.__init__(self)
 


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-07 23:40 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-07 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     0ad65cb126dfe1b41b559675a9b571e5e2d277ef
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  7 20:18:45 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Oct  7 20:18:45 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0ad65cb1

fix a typo.

---
 layman/db.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 0215a2f..354481c 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -75,7 +75,7 @@ class DB(DbBase):
 
 
     def rename_db(self):
-        """small upgarde function to handle the name change
+        """small upgrade function to handle the name change
         for the installed xml file"""
         if os.access(self.config['local_list'], os.F_OK):
             self.output.info("Automatic db rename, old name was: %s"


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-10-07 23:40 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-10-07 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     2bc0b7478a14a9bf95a2e3728ed5a5f8d755e9b1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  7 23:36:49 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Oct  7 23:36:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2bc0b747

fix an "Invalid repoID" assertion error when it does not get a valid repoID in the news reporting.

---
 layman/api.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 72258d4..8dda224 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -556,7 +556,9 @@ class LaymanAPI(object):
                     for repo in repos:
                         ovl = self._get_installed_db().select(repo)
                         ovl_path = os.path.join(ovl.config['storage'], repo)
-                        repo_names.append(portdb.getRepositoryName(ovl_path))
+                        name = portdb.getRepositoryName(ovl_path)
+                        if name:
+                            repo_names.append(name)
                     self.output.debug("LaymanAPI: update_news(); repo_names = "
                         + str(repo_names), 4)
                     news_counts = count_unread_news(portdb, vardb, repo_names)


^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-06-07  4:49 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-06-07  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     4ec06a0babf271b1664d1850ebcd75a05d4e3599
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  7 04:47:40 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun  7 04:47:40 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4ec06a0b

fix a missed update from the old OUT variable usage.

---
 layman/utils.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index 9ffdda0..7cfdaef 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -34,7 +34,7 @@ import sys
 import locale
 import codecs
 
-from layman.debug import OUT
+from layman.output import Message
 
 
 #===============================================================================
@@ -163,7 +163,11 @@ def path(path_elements):
 
     return pathname
 
-def delete_empty_directory(mdir, output=OUT):
+def delete_empty_directory(mdir, output=None):
+    # test for a usable output parameter,
+    # and make it usable if not
+    if output is None:
+        output = Message()
     if os.path.exists(mdir) and not os.listdir(mdir):
         # Check for sufficient privileges
         if os.access(mdir, os.W_OK):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-06-07  4:49 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-06-07  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     15fd9944117dcc90f0f297aac4f6fcbb7d9e2f95
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  7 04:41:02 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun  7 04:41:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=15fd9944

set some sane defaults for stdout, stderr, stdin.

---
 layman/__init__.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/__init__.py b/layman/__init__.py
index 9eeff49..aa4a159 100644
--- a/layman/__init__.py
+++ b/layman/__init__.py
@@ -5,12 +5,13 @@
 on all gentoo repositories and overlays
 """
 
+import sys
+
 try:
     from layman.api import LaymanAPI
     from layman.config import BareConfig
     from layman.output import Message
 except ImportError:
-    import sys
     sys.stderr.write("!!! Layman API import failed.")
 
 
@@ -19,7 +20,7 @@ class Layman(LaymanAPI):
     """A complete high level interface capable of performing all
     overlay repository actions."""
 
-    def __init__(self, stdout=None, stdin=None, stderr=None,
+    def __init__(self, stdout=sys.stdout, stdin=sys.stdin, stderr=sys.stderr,
         config=None, read_configfile=True, quiet=False, quietness=4,
         verbose=False, nocolor=False, width=0
         ):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-06-07  4:49 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-06-07  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     afb17b0a5bef67fa51e92373fd5043ac27f4c8f2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  7 04:42:27 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun  7 04:42:27 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=afb17b0a

Tighten up the code to prevent exceptions and tracebacks if stdout and stderr are not of the file type.

---
 layman/output.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 2fbeaaf..c90fccc 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -29,10 +29,16 @@ class MessageBase(object):
                  error_callback=None
                  ):
         # Where should the error output go? This can also be a file
-        self.error_out = err
+        if isinstance(err, file):
+            self.error_out = err
+        else:
+            raise Exception("MessageBase: input parameter 'err' must be of type: file")
 
         # Where should the normal output go? This can also be a file
-        self.std_out = out
+        if isinstance(out, file):
+            self.std_out = out
+        else:
+            raise Exception("MessageBase: input parameter 'out' must be of type: file")
 
         # The higher the level the more information you will get
         self.warn_lev = warn_level
@@ -187,10 +193,10 @@ class Message(MessageBase):
             # NOTE: Forced flushing ensures that stdout and stderr
             # stay in nice order.  This is a workaround for calls like
             # "layman -L |& less".
-            sys.stdout.flush()
+            self.std_out.flush()
             self.error_out.flush()
             print >> self.std_out, " %s %s" % (self.color_func('red', '*'), i)
-            sys.stdout.flush()
+            self.std_out.flush()
         self.do_error_callback(error)
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-04-14  2:14 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-04-14  2:14 UTC (permalink / raw
  To: gentoo-commits

commit:     9ec59c4d881960ce0e1f7c2fdc55bad471a8d7b7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 14 02:13:42 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 14 02:13:42 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9ec59c4d

fix the BareConfig not str sub'ing %(configdir)s before calling read_config().  indent fix in read_config().

---
 layman/config.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 0541d92..8430221 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -151,13 +151,18 @@ class BareConfig(object):
         self._set_quietness(quietness)
         self.config = None
         if read_configfile:
-            self.read_config(self.get_defaults())
+            defaults = self.get_defaults()
+            if "%(configdir)s" in defaults['config']:
+                # fix the config path
+                defaults['config'] = defaults['config'] \
+                    % {'configdir': defaults['configdir']}
+            self.read_config(defaults)
 
 
     def read_config(self, defaults):
-            self.config = ConfigParser.ConfigParser(defaults)
-            self.config.add_section('MAIN')
-            read_layman_config(self.config, defaults)
+        self.config = ConfigParser.ConfigParser(defaults)
+        self.config.add_section('MAIN')
+        read_layman_config(self.config, defaults)
 
 
     def keys(self):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-04-09 19:47 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-04-09 19:47 UTC (permalink / raw
  To: gentoo-commits

commit:     b7b7df1489d582443462d88dfa0ce86a35caf4af
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  9 19:45:38 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Apr  9 19:45:38 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b7b7df14

fix news debug statement.

---
 layman/api.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 7b3111f..72258d4 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -557,7 +557,8 @@ class LaymanAPI(object):
                         ovl = self._get_installed_db().select(repo)
                         ovl_path = os.path.join(ovl.config['storage'], repo)
                         repo_names.append(portdb.getRepositoryName(ovl_path))
-                    self.output.debug("LaymanAPI: update_news(); repo_names =", repo_names, 4)
+                    self.output.debug("LaymanAPI: update_news(); repo_names = "
+                        + str(repo_names), 4)
                     news_counts = count_unread_news(portdb, vardb, repo_names)
                     display_news_notifications(news_counts)
                 except ImportError:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-04-01 21:54 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-04-01 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     4e781a58ea922911d09287e95b0c666216212e4a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  1 21:52:58 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Apr  1 21:52:58 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4e781a58

fix news exception for py2.5 comaptability.

---
 layman/api.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 2f6c183..7b3111f 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -582,7 +582,7 @@ class LaymanAPI(object):
             elif self.config['news_reporter'] == 'pkgcore':
                 # pkgcore is not yet capable
                 return
-        except Exception as err:
+        except Exception, err:
             msg = "update_news() failed running %s news reporter function\n" +\
                   "Error was; %s"
             self._error(msg % (self.config['news_reporter'], err))



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-03-26  3:43 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-03-26  3:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7a74871ab63f3b36d7d2377a5af5b0cfc1a2ee29
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 03:40:11 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Mar 26 03:40:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=7a74871a

fix bug 408897 for when profiles/repo_name is not the same as the layman overlay name.

---
 layman/api.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 3f33a42..2f6c183 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -550,7 +550,15 @@ class LaymanAPI(object):
                         display_news_notifications
                     portdb = db[root]["porttree"].dbapi
                     vardb = db[root]["vartree"].dbapi
-                    news_counts = count_unread_news(portdb, vardb, repos)
+                    # get the actual repo_name from portage
+                    # because it may be different than layman's name for it
+                    repo_names = []
+                    for repo in repos:
+                        ovl = self._get_installed_db().select(repo)
+                        ovl_path = os.path.join(ovl.config['storage'], repo)
+                        repo_names.append(portdb.getRepositoryName(ovl_path))
+                    self.output.debug("LaymanAPI: update_news(); repo_names =", repo_names, 4)
+                    news_counts = count_unread_news(portdb, vardb, repo_names)
                     display_news_notifications(news_counts)
                 except ImportError:
                     # deprecated funtionality, remove when the above method



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2012-03-04 15:36 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2012-03-04 15:36 UTC (permalink / raw
  To: gentoo-commits

commit:     216ffc02a31cc4ee5c01c836def8d497ee5c5764
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  4 15:36:02 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar  4 15:36:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=216ffc02

change to only wrap the '*' with the color, not the spaces around it.

---
 layman/output.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 7b42b81..2fbeaaf 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -134,7 +134,7 @@ class Message(MessageBase):
             return
 
         for i in info.split('\n'):
-            print  >> self.std_out, self.color_func('green', ' * ') + i
+            print  >> self.std_out, " %s %s" % (self.color_func('green', '*'),i)
 
 
     def status (self, message, status, info = 'ignored'):
@@ -148,7 +148,7 @@ class Message(MessageBase):
             return
 
         for i in lines[0:-1]:
-            print >> self.std_out, self.color_func('green', ' * ') + i
+            print >> self.std_out, " %s %s" % (self.color_func('green', '*'),i)
 
         i = lines[-1]
 
@@ -162,8 +162,8 @@ class Message(MessageBase):
         else:
             result = '[' + self.color_func('yellow', info) + ']'
 
-        print >> self.color_func('green', ' * ') + i + ' ' + \
-            '.' * (58 - len(i)) + ' ' + result
+        print >> " %s %s %s %S" % (self.color_func('green', '*'), i,
+            ('.' * (58 - len(i))), result)
 
 
     def warn (self, warn, level = WARN_LEVEL):
@@ -175,7 +175,7 @@ class Message(MessageBase):
             return
 
         for i in warn.split('\n'):
-            print  >> self.std_out, self.color_func('yellow', ' * ') + i
+            print >> self.std_out, " %s %s" % (self.color_func('yellow', '*'),i)
 
 
     def error (self, error):
@@ -189,7 +189,7 @@ class Message(MessageBase):
             # "layman -L |& less".
             sys.stdout.flush()
             self.error_out.flush()
-            print >> self.std_out, self.color_func('red', ' * ') + i
+            print >> self.std_out, " %s %s" % (self.color_func('red', '*'), i)
             sys.stdout.flush()
         self.do_error_callback(error)
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-12-27  2:20 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-12-27  2:20 UTC (permalink / raw
  To: gentoo-commits

commit:     46444286c8d70797964dc80dd70e42a0f2d35723
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 27 02:18:10 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 27 02:18:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=46444286

improve the usage to include an example of multiple actions.

---
 layman/argsparser.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index e1703ac..c8f3828 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -40,6 +40,8 @@ from layman.version import VERSION
 
 _USAGE = """
   layman (-a|-d|-s|-i) (OVERLAY|ALL)
+  # it also supports multiple actions
+  layman (-a|-d|-s|-i) (OVERLAY|ALL) [ [(-a|-d|-s|-i) (OVERLAY)] ...]
   layman -f [-o URL]
   layman (-l|-L|-S)"""
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-10-27  4:42 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-10-27  4:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ad38a35a994b32ea65df5395d78a9ffabe9773e4
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Oct 27 04:42:21 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Oct 27 04:42:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ad38a35a

update portage news reporting to use the new public api functions.

---
 layman/api.py |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index cbf70e6..4ff62dd 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -544,18 +544,32 @@ class LaymanAPI(object):
     def update_news(self, repos=None):
         try:
             if self.config['news_reporter'] == 'portage':
-                from _emerge.actions import (display_news_notification,
-                    load_emerge_config)
-                settings, trees, mtimedb = load_emerge_config()
-                display_news_notification(trees[settings["ROOT"]]["root_config"],
-                    {"news_repos": repos})
+                try:
+                    from portage import db, root
+                    from portage.news import count_unread_news, \
+                        display_news_notifications
+                    portdb = db[root]["porttree"].dbapi
+                    vardb = db[root]["vartree"].dbapi
+                    news_counts = count_unread_news(portdb, vardb, repos)
+                    display_news_notifications(news_counts)
+                except ImportError:
+                    # deprecated funtionality, remove when the above method
+                    # is available in all portage versions
+                    self.output.info("New portage news functionality not "
+                        "available, using fallback method", 5)
+                    from _emerge.actions import (display_news_notification,
+                        load_emerge_config)
+                    settings, trees, mtimedb = load_emerge_config()
+                    display_news_notification(
+                        trees[settings["ROOT"]]["root_config"], {})
             elif self.config['news_reporter'] == 'custom':
                 self.config['custom_news_func'](repos)
             elif self.config['news_reporter'] == 'pkgcore':
                 return
-        except:
-            self._error("update_news() failed running %s news reporter function"
-                % self.config['news_reporter'])
+        except Exception as err:
+            msg = "update_news() failed running %s news reporter function\n" +\
+                  "Error was; %s"
+            self._error(msg % (self.config['news_reporter'], err))
         return
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-10-26 23:19 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-10-26 23:19 UTC (permalink / raw
  To: gentoo-commits

commit:     9a74747e60f08a6f303d36d45ad9bb2ba828af42
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Oct 26 23:17:06 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct 26 23:17:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9a74747e

add news reporting capability when adding/syncing overlays. Bug 388233

---
 layman/api.py    |   36 +++++++++++++++++++++++++++++++-----
 layman/cli.py    |    4 ++--
 layman/config.py |    2 ++
 3 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 3005c3f..cbf70e6 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -32,8 +32,6 @@ UNKNOWN_REPO_ID = "Repo ID '%s' " + \
 class LaymanAPI(object):
     """class to hold and run a layman instance for use by API consumer apps, guis, etc.
     """
-    ## hell, even the current cli should probably be converted to use this one.
-    ## It is a near duplicate of the actions classes.
 
     def __init__(self, config=None, report_errors=False, output=None):
         """
@@ -126,12 +124,12 @@ class LaymanAPI(object):
         return True
 
 
-    def add_repos(self, repos):
+    def add_repos(self, repos, update_news=False):
         """installs the seleted repo id
 
         @type repos: list of strings or string
         @param repos: ['repo-id', ...] or 'repo-id'
-        @param output: method to handle output if desired
+        @param update_news: bool, defaults to False
         @rtype dict
         """
         repos = self._check_repo_type(repos, "add_repo")
@@ -154,6 +152,9 @@ class LaymanAPI(object):
                     "' : "+str(e))
             results.append(success)
             self.get_installed(dbreload=True)
+        if (True in results) and update_news:
+            self.update_news(repos)
+
         if False in results:
             return False
         return True
@@ -287,11 +288,13 @@ class LaymanAPI(object):
             return self._get_remote_db().list(verbose=verbose, width=width)
 
 
-    def sync(self, repos, output_results=True):
+    def sync(self, repos, output_results=True, update_news=False):
         """syncs the specified repo(s) specified by repos
 
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
+        @param output_results: bool, defaults to True
+        @param update_news: bool, defaults to False
         @rtype bool or {'repo-id': bool,...}
         """
         self.output.debug("API.sync(); repos to sync = %s" % ', '.join(repos), 5)
@@ -387,6 +390,9 @@ class LaymanAPI(object):
 
         self.sync_results = (success, warnings, fatals)
 
+        if update_news:
+            self.update_news(repos)
+
         return fatals == []
 
 
@@ -522,6 +528,7 @@ class LaymanAPI(object):
             return messages
         return []
 
+
     def supported_types(self):
         """returns a dictionary of all repository types,
         with boolean values"""
@@ -534,6 +541,25 @@ class LaymanAPI(object):
         return supported
 
 
+    def update_news(self, repos=None):
+        try:
+            if self.config['news_reporter'] == 'portage':
+                from _emerge.actions import (display_news_notification,
+                    load_emerge_config)
+                settings, trees, mtimedb = load_emerge_config()
+                display_news_notification(trees[settings["ROOT"]]["root_config"],
+                    {"news_repos": repos})
+            elif self.config['news_reporter'] == 'custom':
+                self.config['custom_news_func'](repos)
+            elif self.config['news_reporter'] == 'pkgcore':
+                return
+        except:
+            self._error("update_news() failed running %s news reporter function"
+                % self.config['news_reporter'])
+        return
+
+
+
 def create_fd():
     """creates file descriptor pairs an opens them ready for
     use in place of stdin, stdout, stderr.

diff --git a/layman/cli.py b/layman/cli.py
index 95ec858..b716ea0 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -230,7 +230,7 @@ class Main(object):
         if 'ALL' in selection:
             selection = self.api.get_available()
         self.output.debug('Adding selected overlays', 6)
-        result = self.api.add_repos(selection)
+        result = self.api.add_repos(selection, update_news=True)
         if result:
             self.output.info('Successfully added overlay(s) '+\
                 ', '.join(selection) +'.', 2)
@@ -249,7 +249,7 @@ class Main(object):
         if self.config['sync_all'] or 'ALL' in selection:
             selection = self.api.get_installed()
         self.output.debug('Updating selected overlays', 6)
-        result = self.api.sync(selection)
+        result = self.api.sync(selection, update_news=True)
         # blank newline  -- no " *"
         self.output.notice('')
         return result

diff --git a/layman/config.py b/layman/config.py
index 2af4069..c245853 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -95,6 +95,7 @@ class BareConfig(object):
                     'nocheck'   : 'yes',
                     'proxy'     : '',
                     'umask'     : '0022',
+                    'news_reporter': 'portage',
                     'overlays'  :
                     'http://www.gentoo.org/proj/en/overlays/repositories.xml',
                     'overlay_defs': '%(configdir)s/overlays',
@@ -144,6 +145,7 @@ class BareConfig(object):
                     'width': width,
                     'verbose': verbose,
                     'quiet': quiet,
+                    'custom_news_func': None,
                     }
         self._set_quietness(quietness)
         self.config = None



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-10-14  3:14 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-10-14  3:14 UTC (permalink / raw
  To: gentoo-commits

commit:     bce27850d7e2d86e1b8046be8eb1d51c83dbdd2c
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Fri Oct 14 03:11:30 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Oct 14 03:11:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bce27850

fix an encode error regression in python 2 introduced in the py2, py3 compatibility changes.

---
 layman/db.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index cca257b..0215a2f 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -27,6 +27,7 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
 #-------------------------------------------------------------------------------
 
 import os, os.path
+import sys
 import urllib2
 import hashlib
 
@@ -414,11 +415,12 @@ class RemoteDB(DbBase):
                                   'oblem with the webserver. Check the content '
                                   'of the file. Error was:\n' + str(error))
 
+                # the folowing is neded for py3 only
+                if sys.hexversion >= 0x3000000 and hasattr(olist, 'decode'):
+                    olist = olist.decode("UTF-8")
                 # Ok, now we can overwrite the old cache
                 try:
                     out_file = fileopen(mpath, 'w')
-                    if hasattr(olist, 'decode'):
-                        olist = olist.decode("UTF-8")
                     out_file.write(olist)
                     out_file.close()
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-09-24  6:07 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-09-24  6:07 UTC (permalink / raw
  To: gentoo-commits

commit:     658f794a3a7675bba9d746d1a17ee0e0a95ee400
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Sep 19 04:31:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 19 04:31:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=658f794a

fix unknown variable

---
 layman/dbbase.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index a31ced9..ccd5806 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -86,6 +86,7 @@ class DbBase(object):
         self.paths = paths
         self.ignore = ignore
         self.output = config['output']
+        self.ignore_init_read_errors = ignore_init_read_errors
 
         self.overlays = {}
 
@@ -116,7 +117,7 @@ class DbBase(object):
             document = open(path, 'r').read()
 
         except Exception, error:
-            if not ignore_init_read_errors:
+            if not self.ignore_init_read_errors:
                 self.output.error('Failed to read the overlay list at ("'
                     + path + '")')
                 raise error



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-25  3:33 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-25  3:33 UTC (permalink / raw
  To: gentoo-commits

commit:     de32dea6179e96cb5b7fa1088134a41f4e78fa9b
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Aug 25 03:33:03 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Aug 25 03:33:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=de32dea6

fix a missed conversion to using the Message class

---
 layman/argsparser.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 1cb71b3..e1703ac 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -241,7 +241,7 @@ class ArgsParser(BareConfig):
         # Parse the command line first since we need to get the config
         # file option.
         if len(args) == 1:
-            print   >> self.std_out, 'Usage:%s' % _USAGE
+            self.output.notice('Usage:%s' % _USAGE)
             sys.exit(0)
 
         (self.options, remain_args) = self.parser.parse_args(args)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-21  7:53 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-21  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     b2b7b5899a6f61a6545a5b91c5fe8691f4d29cbe
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug 21 07:32:42 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug 21 07:50:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b2b7b589

continue establishing a proper high level interface.

---
 layman/__init__.py |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/layman/__init__.py b/layman/__init__.py
index e27488a..9eeff49 100644
--- a/layman/__init__.py
+++ b/layman/__init__.py
@@ -5,10 +5,18 @@
 on all gentoo repositories and overlays
 """
 
+try:
+    from layman.api import LaymanAPI
+    from layman.config import BareConfig
+    from layman.output import Message
+except ImportError:
+    import sys
+    sys.stderr.write("!!! Layman API import failed.")
 
 
-class Layman(object):
-    """High level interface capable of performing all
+
+class Layman(LaymanAPI):
+    """A complete high level interface capable of performing all
     overlay repository actions."""
 
     def __init__(self, stdout=None, stdin=None, stderr=None,
@@ -18,30 +26,22 @@ class Layman(object):
         """Input parameters are optional to override the defaults.
         sets up our LaymanAPI with defaults or passed in values
         and returns an instance of it"""
-        import sys
-        try:
-            from layman.api import LaymanAPI
-            from layman.config import BareConfig
-            from layman.output import Message
-        except ImportError:
-            sys.stderr.write("!!! Layman API import failed.")
-            return None
-        self.message = Message()
+        self.message = Message(out=stdout, err=stderr)
         self.config = BareConfig(
-                output=message,
-                stdout=None,
-                stdin=None,
-                stderr=None,
-                config=None,
-                read_configfile=True,
-                quiet=False,
-                quietness=4,
-                verbose=False,
-                nocolor=False,
-                width=0
+                output=self.message,
+                stdout=stdout,
+                stdin=stdin,
+                stderr=stderr,
+                config=config,
+                read_configfile=read_configfile,
+                quiet=quiet,
+                quietness=quietness,
+                verbose=verbose,
+                nocolor=nocolor,
+                width=width
             )
-        self.layman = LaymanAPI(self.config,
+        LaymanAPI.__init__(self, self.config,
                              report_errors=True,
-                             output=config['output']
+                             output=self.config['output']
                             )
-        return _layman
+        return



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-21  7:53 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-21  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     623337f3b461c15f22805f1c55c86f911763183f
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug 21 07:03:25 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug 21 07:37:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=623337f3

set some options to the ones passed in that were previously missed.

---
 layman/config.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 9d212e2..ff4bdd2 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -138,12 +138,13 @@ class BareConfig(object):
                     'stdin': stdin if stdin else sys.stdin,
                     'stderr': stderr if stderr else sys.stderr,
                     'output': output if output else Message(),
-                    'quietness': 4,
-                    'nocolor': False,
-                    'width': 0,
-                    'verbose': False,
-                    'quiet': False,
+                    'quietness': quietness,
+                    'nocolor': nocolor,
+                    'width': width,
+                    'verbose': verbose,
+                    'quiet': quiet,
                     }
+        self._set_quietness(quietness)
         self.config = None
         if read_configfile:
             self.read_config(self.get_defaults())



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-21  7:53 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-21  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     2c9df94436e25e45f0324929ebdbf33a1aa1a2d5
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug 21 07:35:18 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug 21 07:50:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2c9df944

pass the input parameters to MessageBase

---
 layman/output.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index c900a31..37da0c5 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -100,7 +100,8 @@ class Message(MessageBase):
                  error_callback = None
                 ):
 
-        MessageBase.__init__(self)
+        MessageBase.__init__(self, out, err, info_level, warn_level,
+            col, error_callback)
 
 
     ## Output Functions



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-20 17:06 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-20 17:06 UTC (permalink / raw
  To: gentoo-commits

commit:     f1ac6fc5b697632d4db04265bc0c0ec6554e6855
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Aug 20 01:08:43 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug 20 01:08:43 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f1ac6fc5

fix success reporting identified in bug 379779.  Improve and change error output from info(), warn() to error().

---
 layman/api.py |    4 ++--
 layman/db.py  |   21 +++++++++++++++------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index cfd9a68..7894c56 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -441,7 +441,7 @@ class LaymanAPI(object):
         """
 
         try:
-            dbreload = self._get_remote_db().cache()
+            dbreload, succeeded = self._get_remote_db().cache()
             self.output.debug(
                 'LaymanAPI.fetch_remote_list(); cache updated = %s'
                 % str(dbreload),8)
@@ -450,7 +450,7 @@ class LaymanAPI(object):
                     + str(error))
             return False
         self.get_available(dbreload)
-        return True
+        return succeeded
 
 
     def get_available(self, dbreload=False):

diff --git a/layman/db.py b/layman/db.py
index bd58cd6..08af0f6 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -288,7 +288,7 @@ class RemoteDB(DbBase):
         >>> config.set_option('quietness', 3)
         >>> a = RemoteDB(config)
         >>> a.cache()
-        True
+        (True, True)
         >>> b = open(a.filepath(config['overlays'])+'.xml')
         >>> b.readlines()[24]
         '      A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n'
@@ -300,6 +300,8 @@ class RemoteDB(DbBase):
         [u'wrobel', u'wrobel-stable']
         '''
         has_updates = False
+        # succeeded reset when a failure is detected
+        succeeded = True
         for url in self.urls:
 
             filepath = self.filepath(url)
@@ -334,12 +336,17 @@ class RemoteDB(DbBase):
                         % url, 4)
                     self.output.info('Last-modified: %s' % timestamp, 4)
                 else:
-                    self.output.info('RemoteDB.cache(); HTTPError was:\n %s'
-                        % str(e))
+                    self.output.error('RemoteDB.cache(); HTTPError was:\n'
+                        'url: %s\n%s'
+                        % (url, str(e)))
+                    succeeded = False
                 continue
             except IOError, error:
-                self.output.warn('RemoteDB.cache(); Failed to update the overlay list from: '
-                         + url + '\nIOError was:\n' + str(error))
+                self.output.error('RemoteDB.cache(); Failed to update the '
+                    'overlay list from: %s\nIOError was:%s\n'
+                    % (url, str(error)))
+                succeeded = False
+                continue
             else:
                 if url.startswith('file://'):
                     quieter = 1
@@ -387,7 +394,9 @@ class RemoteDB(DbBase):
                 except Exception, error:
                     raise IOError('Failed to temporarily cache overlays list in'
                                   ' ' + mpath + '\nError was:\n' + str(error))
-        return has_updates
+        self.output.debug("RemoteDB.cache() returning:  has_updates, succeeded"
+            " %s, %s" % (str(has_updates), str(succeeded)), 4)
+        return has_updates, succeeded
 
 
     def filepath(self, url):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-20 17:06 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-20 17:06 UTC (permalink / raw
  To: gentoo-commits

commit:     e78113321c0627291c176930e0493867e9cafc1d
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Aug 13 15:01:49 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug 13 15:01:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e7811332

remove some dead ERROR constants

---
 layman/api.py |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index f48e11f..cfd9a68 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -23,10 +23,6 @@ from layman.db import DB, RemoteDB
 from layman.overlays.source import require_supported
 #from layman.utils import path, delete_empty_directory
 
-# give them some values for now, these are from the packagekit backend
-# TODO  establish some proper errors for the api.
-ERROR_REPO_NOT_FOUND = -1
-ERROR_INTERNAL_ERROR = -2
 UNKNOWN_REPO_ID = "Repo ID '%s' " + \
         "is not listed in the current available overlays list"
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-11  3:24 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-11  3:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e9742ba56ea23e9d61505a41e9a5cdda60bbfc99
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Aug  9 23:44:32 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Aug  9 23:44:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e9742ba5

Revert "migrate to print()" to restore py-2.5 compatibility.

This reverts commit e14906b88ec2da99dba82d565d88ed5ca1d40099.

Conflicts:

	layman/api.py
	layman/cli.py
	layman/dbbase.py
	layman/output.py

---
 layman/api.py        |   12 ++++------
 layman/argsparser.py |    2 +-
 layman/cli.py        |   18 ++++++--------
 layman/dbbase.py     |    6 +---
 layman/debug.py      |   59 +++++++++++++++++++++++--------------------------
 layman/output.py     |   17 ++++++-------
 layman/version.py    |    4 +--
 7 files changed, 53 insertions(+), 65 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 69baddd..80b927f 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -13,8 +13,6 @@
 #              Brian Dolbec <dol-sen@sourceforge.net>
 #
 
-from __future__ import print_function
-
 from sys import stderr
 import os
 
@@ -256,10 +254,10 @@ class LaymanAPI(object):
                 continue
             try:
                 overlay = db.select(ovl)
-                #print("overlay = ", ovl)
-                #print("!!!", overlay)
-            except UnknownOverlayException as error:
-                #print("ERRORS", str(error))
+                #print "overlay = ", ovl
+                #print "!!!", overlay
+            except UnknownOverlayException, error:
+                #print "ERRORS", str(error)
                 self._error(error)
                 result[ovl] = ('', False, False)
             else:
@@ -505,7 +503,7 @@ class LaymanAPI(object):
         self._error_messages.append(message)
         self.output.debug("API._error(); _error_messages = %s" % str(self._error_messages), 4)
         if self.report_errors:
-            print(message, file=self.config['stderr'])
+            print >>self.config['stderr'], message
 
 
     def get_errors(self):

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 93f11d6..af95901 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -242,7 +242,7 @@ class ArgsParser(BareConfig):
         # Parse the command line first since we need to get the config
         # file option.
         if len(args) == 1:
-            print('Usage:%s' % _USAGE)
+            print   >> self.std_out, 'Usage:%s' % _USAGE
             sys.exit(0)
 
         (self.options, remain_args) = self.parser.parse_args(args)

diff --git a/layman/cli.py b/layman/cli.py
index fde52c3..53d81c6 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -19,8 +19,6 @@
 #
 ''' Provides the command line actions that can be performed by layman.'''
 
-from __future__ import print_function
-
 __version__ = "$Id: cli.py 2011-01-15 23:52 PST Brian Dolbec$"
 
 
@@ -50,12 +48,12 @@ class ListPrinter(object):
             self.my_lister = self.short_list
 
     def print_shortdict(self, info, complain):
-        #print("ListPrinter.print_shortdict()",info, "\n\n")
+        #print "ListPrinter.print_shortdict()",info, "\n\n"
         overlays = sorted(info)
-        #print("ids =======>", overlays, "\n")
+        #print "ids =======>", overlays, "\n"
         for ovl in overlays:
             overlay = info[ovl]
-            #print("overlay =", overlay)
+            #print "overlay =", overlay
             summary, supported, official = overlay
             self.print_overlay(summary, supported, official, complain)
 
@@ -66,10 +64,10 @@ class ListPrinter(object):
 
     def print_fulldict(self, info, complain):
         ids = sorted(info)
-        #print("ids =======>", ids, "\n")
+        #print "ids =======>", ids, "\n"
         for ovl in ids:
             overlay = info[ovl]
-            #print(overlay)
+            #print overlay
             self.print_overlay(self.my_lister(overlay),
                                overlay['supported'],
                                overlay['official'],
@@ -105,7 +103,7 @@ class ListPrinter(object):
 
     def short_list(self, overlay):
         '''
-        >>> print(short_list(overlay))
+        >>> print short_list(overlay)
         wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
         '''
         name   = pad(overlay['name'], 25)
@@ -131,7 +129,7 @@ class Main(object):
 
     def __init__(self, config):
         self.config = config
-        #print("config.keys()", config.keys())
+        #print "config.keys()", config.keys()
         self.output = config['output']
         self.api = LaymanAPI(config,
                              report_errors=False,
@@ -311,7 +309,7 @@ class Main(object):
     def ListLocal(self):
         ''' Lists the local overlays.
         '''
-        #print("ListLocal()")
+        #print "ListLocal()"
         self.output.debug('Printing installed overlays.', 6)
         list_printer = ListPrinter(self.config)
 

diff --git a/layman/dbbase.py b/layman/dbbase.py
index dfe6ec8..8eafbf7 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -20,8 +20,6 @@
 #
 '''Main handler for overlays.'''
 
-from __future__ import print_function
-
 __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
 
 #===============================================================================
@@ -257,7 +255,7 @@ class DbBase(object):
         >>> config = {'output': output, 'svn_command': '/usr/bin/svn', 'rsync_command':'/usr/bin/rsync'}
         >>> a = DbBase(config, [here + '/tests/testfiles/global-overlays.xml', ])
         >>> for i in a.list(verbose=True):
-        ...     print(i[0])
+        ...     print i[0]
         wrobel
         ~~~~~~
         Source  : https://overlays.gentoo.org/svn/dev/wrobel
@@ -280,7 +278,7 @@ class DbBase(object):
         <BLANKLINE>
 
         >>> for i in a.list(verbose=False, width=80):
-        ...     print(i[0])
+        ...     print i[0]
         wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
         wrobel-stable             [Rsync     ] (rsync://gunnarwrobel.de/wrobel-stable)
         '''

diff --git a/layman/debug.py b/layman/debug.py
index ab04f40..f5c247b 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -6,8 +6,6 @@
 # Copyright 2005 - 2008 Gunnar Wrobel
 # Distributed under the terms of the GNU General Public License v2
 
-from __future__ import print_function
-
 __version__ = "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $"
 
 #################################################################################
@@ -103,7 +101,7 @@ class DebugMessage(Message):
 
     def cli_opts(self, parser):
 
-        #print("Parsing debug opts")
+        #print "Parsing debug opts"
 
         group = OptionGroup(parser,
                             '<Debugging options>',
@@ -329,11 +327,11 @@ class DebugMessage(Message):
             if lines > 0:
                 for j in range(lines):
                     ## Print line with continuation marker
-                    print(ls + '// ' + x[0:60] + ' \\', file=self.debug_out)
+                    print >> self.debug_out, ls + '// ' + x[0:60] + ' \\'
                     ## Remove printed characters from output
                     x = x[60:]
             ## Print final line
-            print(ls + '// ' + x, file=self.debug_out)
+            print >> self.debug_out, ls + '// ' + x
 
         if self.debug_vrb == 1:
             # Top line indicates class and method
@@ -342,61 +340,60 @@ class DebugMessage(Message):
                 c += 'Class: ' + str(callerobject.__class__.__name__) + ' | '
             if callermethod:
                 c += 'Method: ' + str(callermethod)
-            print('// ' + c, file=self.debug_out)
+            print >> self.debug_out, '// ' + c
             # Selected variables follow
             if callerlocals:
                 for i,j in callerlocals.items():
-                    print('// ' + self.maybe_color('turquoise',
-                        str(i)) + ':' + str(j), file=self.debug_out)
+                    print >> self.debug_out, '// '                              \
+                          + self.maybe_color('turquoise', str(i)) + ':' + str(j)
             # Finally the message
-            print(self.maybe_color('yellow', message), file=self.debug_out)
+            print >> self.debug_out, self.maybe_color('yellow', message)
             return
 
         if self.debug_vrb == 3:
-            print(ls + '/////////////////////////////////' + \
-                  '////////////////////////////////', file=self.debug_out)
+            print >> self.debug_out, ls + '/////////////////////////////////' + \
+                  '////////////////////////////////'
 
             # General information about what is being debugged
             #(module name or similar)
-            print(ls + '// ' + self.debug_env, file=self.debug_out)
-        print(ls + '//-----------------------------------' + \
-              '----------------------------', file=self.debug_out)
+            print >> self.debug_out, ls + '// ' + self.debug_env
+        print >> self.debug_out, ls + '//-----------------------------------' + \
+              '----------------------------'
 
         ## If the caller is a class print the name here
         if callerobject:
-            print(ls + '// Object Class: ' +
-                str(callerobject.__class__.__name__), file=self.debug_out)
+            print >> self.debug_out, ls +                                       \
+                  '// Object Class: ' + str(callerobject.__class__.__name__)
 
         ## If the method has been extracted print it here
         if callermethod:
-            print(ls + '// ' + self.maybe_color('green', 'Method: ')
-                + str(callermethod), file=self.debug_out)
+            print >> self.debug_out, ls + '// '                                 \
+                  + self.maybe_color('green', 'Method: ') + str(callermethod)
             if self.debug_vrb == 3:
-                print(ls + '//---------------------------' + \
-                    '------------------------------------', file=self.debug_out)
+                print >> self.debug_out, ls + '//---------------------------' + \
+                      '------------------------------------'
 
         ## Print the information on all available local variables
         if callerlocals:
             if self.debug_vrb == 3:
-                print(ls + '//', file=self.debug_out)
-                print(ls + '// VALUES ', file=self.debug_out)
+                print >> self.debug_out, ls + '//'
+                print >> self.debug_out, ls + '// VALUES '
             for i,j in callerlocals.items():
-                print(ls + '// ------------------> '         \
-                      + self.maybe_color('turquoise', str(i)) + ':',
-                      file=self.debug_out)
+                print >> self.debug_out, ls + '// ------------------> '         \
+                      + self.maybe_color('turquoise', str(i)) + ':'
                 breaklines(str(j))
             if self.debug_vrb == 3:
-                print(ls + '//------------------------------'\
-                      '---------------------------------', file=self.debug_out)
+                print >> self.debug_out, ls + '//------------------------------'\
+                      '---------------------------------'
 
         # Finally print the message
         breaklines(self.maybe_color('yellow', message))
 
         if self.debug_vrb == 3:
-            print(ls + '//-------------------------------' + \
-                  '--------------------------------', file=self.debug_out)
-            print(ls + '/////////////////////////////////' + \
-                  '////////////////////////////////', file=self.debug_out)
+            print >> self.debug_out, ls + '//-------------------------------' + \
+                  '--------------------------------'
+            print >> self.debug_out, ls + '/////////////////////////////////' + \
+                  '////////////////////////////////'
 
 ## gloabal message handler
 OUT = Message('layman')

diff --git a/layman/output.py b/layman/output.py
index 3e82305..c900a31 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -6,7 +6,6 @@
  Distributed under the terms of the GNU General Public License v2
 """
 
-from __future__ import print_function
 
 __version__ = "0.1"
 
@@ -117,11 +116,11 @@ class Message(MessageBase):
             return
 
         for i in info.split('\n'):
-            print(self.color_func('yellow', 'DEBUG: ') + i, file=self.std_out)
+            print  >> self.std_out, self.color_func('yellow', 'DEBUG: ') + i
 
 
     def notice (self, note):
-        print(note, file=self.std_out)
+        print >> self.std_out, note
 
 
     def info (self, info, level = INFO_LEVEL):
@@ -133,7 +132,7 @@ class Message(MessageBase):
             return
 
         for i in info.split('\n'):
-            print(self.color_func('green', ' * ') + i, file=self.std_out)
+            print  >> self.std_out, self.color_func('green', ' * ') + i
 
 
     def status (self, message, status, info = 'ignored'):
@@ -147,7 +146,7 @@ class Message(MessageBase):
             return
 
         for i in lines[0:-1]:
-            print(self.color_func('green', ' * ') + i, file=self.std_out)
+            print >> self.std_out, self.color_func('green', ' * ') + i
 
         i = lines[-1]
 
@@ -161,8 +160,8 @@ class Message(MessageBase):
         else:
             result = '[' + self.color_func('yellow', info) + ']'
 
-        print(self.color_func('green', ' * ') + i + ' ' + \
-            '.' * (58 - len(i)) + ' ' + result, file=self.std_out)
+        print >> self.color_func('green', ' * ') + i + ' ' + \
+            '.' * (58 - len(i)) + ' ' + result
 
 
     def warn (self, warn, level = WARN_LEVEL):
@@ -174,7 +173,7 @@ class Message(MessageBase):
             return
 
         for i in warn.split('\n'):
-            print(self.color_func('yellow', ' * ') + i, file=self.std_out)
+            print  >> self.std_out, self.color_func('yellow', ' * ') + i
 
 
     def error (self, error):
@@ -188,7 +187,7 @@ class Message(MessageBase):
             # "layman -L |& less".
             sys.stdout.flush()
             self.error_out.flush()
-            print(self.color_func('red', ' * ') + i, file=self.std_out)
+            print >> self.std_out, self.color_func('red', ' * ') + i
             sys.stdout.flush()
         self.do_error_callback(error)
 

diff --git a/layman/version.py b/layman/version.py
index 6fadd2a..90c7412 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -19,12 +19,10 @@
 #             Brian Dolbec <brian.dolbec@gmail.com>
 #
 
-from __future__ import print_function
-
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
 VERSION = '2.0.0-git'
 
 if __name__ == '__main__':
-    print(VERSION)
+    print VERSION



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-11  3:24 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-11  3:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e0f12ac23154baf04f4c82146501450103a8b12a
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Aug  9 15:05:32 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Aug  9 15:05:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e0f12ac2

make EPREFIX test code eprefixy proof

---
 layman/config.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 1187f78..9d212e2 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -61,7 +61,7 @@ def read_layman_config(config=None, defaults=None):
 EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
 
 # check and set it if it wasn't
-if EPREFIX == "@GENTOO_PORTAGE_EPREFIX@":
+if "GENTOO_PORTAGE_EPREFIX" in EPREFIX:
     EPREFIX = ''
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-11  3:24 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-11  3:24 UTC (permalink / raw
  To: gentoo-commits

commit:     ee2ba4c60fb555f406b23aa3daf1c8fe5f35022d
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Aug 10 01:04:21 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Aug 10 01:04:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ee2ba4c6

add the gentoolkit encoding bugfix

---
 layman/utils.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index eedc5d7..6f144be 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -64,7 +64,16 @@ def get_encoding(output):
             and output.encoding != None:
         return output.encoding
     else:
-        return locale.getpreferredencoding()
+        encoding = locale.getpreferredencoding()
+        # Make sure that python knows the encoding. Bug 350156
+        try:
+            # We don't care about what is returned, we just want to
+            # verify that we can find a codec.
+            codecs.lookup(encoding)
+        except LookupError:
+            # Python does not know the encoding, so use utf-8.
+            encoding = 'utf_8'
+        return encoding
 
 
 def pad(string, length):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-11  3:24 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-11  3:24 UTC (permalink / raw
  To: gentoo-commits

commit:     c939e9b3cfd433dbcc589c5f335d18d16018a1aa
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Aug 11 02:37:26 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Aug 11 02:37:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c939e9b3

HTTPError in 2.5 does not have getcode(). use error.code

---
 layman/db.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index d9a558e..bd58cd6 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -329,7 +329,7 @@ class RemoteDB(DbBase):
                 else:
                     timestamp = None
             except urllib2.HTTPError, e:
-                if e.getcode() == 304:
+                if e.code == 304:
                     self.output.info('Remote list already up to date: %s'
                         % url, 4)
                     self.output.info('Last-modified: %s' % timestamp, 4)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-09  2:46 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-09  2:46 UTC (permalink / raw
  To: gentoo-commits

commit:     bcac468262240fb1043b60f71af837aeaa7de981
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Aug  9 02:45:49 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Aug  9 02:45:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bcac4682

reset version to git

---
 layman/version.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/version.py b/layman/version.py
index b16a250..6fadd2a 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -24,7 +24,7 @@ from __future__ import print_function
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.0.0_rc1'
+VERSION = '2.0.0-git'
 
 if __name__ == '__main__':
     print(VERSION)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07 21:21 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     b2ee5463687471c42b87831f77de3322ec83e1f9
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 21:20:02 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 21:20:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b2ee5463

fix bug 378097. unofficial installed overlays not printing (due to nocheck=no option).  Add some additional debug output

---
 layman/api.py |    2 ++
 layman/cli.py |    6 +++---
 layman/db.py  |    1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index e85f5ee..69baddd 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -479,6 +479,8 @@ class LaymanAPI(object):
         """returns the list of installed overlays"""
         if not self._installed_db or dbreload:
             self._installed_db = DB(self.config)
+        self.output.debug("API._get_installed_db; len(installed) = %s, %s"
+            %(len(self._installed_db.list_ids()), self._installed_db.list_ids()), 5)
         return self._installed_db
 
 

diff --git a/layman/cli.py b/layman/cli.py
index 396cadc..fde52c3 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -60,7 +60,6 @@ class ListPrinter(object):
             self.print_overlay(summary, supported, official, complain)
 
     def print_shortlist(self, info, complain):
-        #print("ListPrinter.print_shortlist()",info)
         for summary, supported, official in info:
             self.print_overlay(summary, supported, official, complain)
 
@@ -316,12 +315,13 @@ class Main(object):
         self.output.debug('Printing installed overlays.', 6)
         list_printer = ListPrinter(self.config)
 
-        _complain = self.config['nocheck'] or self.config['verbose']
         #
         # fast way
         info = self.api.get_info_list(verbose=self.config['verbose'],
                                       width=list_printer.width)
-        list_printer.print_shortlist(info, complain=_complain)
+        #self.output.debug('CLI: ListLocal() info = %s' % len(info), 4)
+        #self.output.debug('\n'.join([ str(x) for x in info]), 4)
+        list_printer.print_shortlist(info, complain=True)
         #
         # slow way
         #info = self.api.get_all_info(self.api.get_installed(), local=True)

diff --git a/layman/db.py b/layman/db.py
index 64b54ce..05da83d 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -50,6 +50,7 @@ class DB(DbBase):
         self.output = config['output']
 
         self.path = config['local_list']
+        self.output.debug("DB.__init__(): config['local_list'] = %s" % self.path, 3)
 
         if config['nocheck']:
             ignore = 2



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07  7:12 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07  7:12 UTC (permalink / raw
  To: gentoo-commits

commit:     8f850f20af9c1b6360500b36ffada70e07ce45e9
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 07:05:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 07:05:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8f850f20

tidy up some task spacing, eliminate a duped error output, comment out some debug output.

---
 layman/api.py |    6 +++---
 layman/cli.py |   12 +++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index c04dfe6..e85f5ee 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -309,12 +309,12 @@ class LaymanAPI(object):
         for ovl in repos:
             self.output.debug("API.sync(); starting ovl = %s" %ovl, 5)
             try:
-                self.output.debug("API.sync(); selecting %s, db = %s" % (ovl, str(db)), 5)
+                #self.output.debug("API.sync(); selecting %s, db = %s" % (ovl, str(db)), 5)
                 odb = db.select(ovl)
                 self.output.debug("API.sync(); %s now selected" %ovl, 5)
             except UnknownOverlayException as error:
-                self.output.debug("API.sync(); UnknownOverlayException selecting %s" %ovl, 5)
-                self._error(str(error))
+                #self.output.debug("API.sync(); UnknownOverlayException selecting %s" %ovl, 5)
+                #self._error(str(error))
                 fatals.append((ovl,
                     'Failed to select overlay "' + ovl + '".\nError was: '
                     + str(error)))

diff --git a/layman/cli.py b/layman/cli.py
index 5c1b0a6..396cadc 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -150,6 +150,8 @@ class Main(object):
     def __call__(self):
         self.output.debug("CLI.__call__(): self.config.keys()"
             " %s" % str(self.config.keys()), 6)
+        # blank newline  -- no " *"
+        self.output.notice('')
         # Make fetching the overlay list a default action
         if not 'nofetch' in self.config.keys():
             # Actions that implicitely call the fetch operation before
@@ -196,11 +198,11 @@ class Main(object):
         self.output.debug('Checking for action errors', 4)
         if action_errors:
             for action, _errors in action_errors:
-                self.output.notice("\n")
                 self.output.warn("CLI: Errors occured processing action"
                     " %s" % action)
                 for _error in _errors:
                     self.output.error(_error)
+                self.output.notice("")
 
         # Reset umask
         os.umask(old_umask)
@@ -214,7 +216,7 @@ class Main(object):
     def Fetch(self):
         ''' Fetches the overlay listing.
         '''
-        self.output.info("\nFetching remote list,...", 2)
+        self.output.info("Fetching remote list,...", 2)
         result = self.api.fetch_remote_list()
         if result:
             self.output.info('Fetch Ok', 2)
@@ -226,7 +228,7 @@ class Main(object):
     def Add(self):
         ''' Adds the selected overlays.
         '''
-        self.output.info("\nAdding overlay,...", 2)
+        self.output.info("Adding overlay,...", 2)
         selection = decode_selection(self.config['add'])
         if 'ALL' in selection:
             selection = self.api.get_available()
@@ -244,7 +246,7 @@ class Main(object):
     def Sync(self):
         ''' Syncs the selected overlays.
         '''
-        self.output.info("\nSyncing selected overlays,...", 2)
+        self.output.info("Syncing selected overlays,...", 2)
         # Note api.sync() defaults to printing results
         selection = decode_selection(self.config['sync'])
         if self.config['sync_all'] or 'ALL' in selection:
@@ -259,7 +261,7 @@ class Main(object):
     def Delete(self):
         ''' Deletes the selected overlays.
         '''
-        self.output.info('\nDeleting selected overlays,...', 2)
+        self.output.info('Deleting selected overlays,...', 2)
         selection = decode_selection(self.config['delete'])
         if 'ALL' in selection:
             selection = self.api.get_installed()



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07  7:12 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07  7:12 UTC (permalink / raw
  To: gentoo-commits

commit:     009d0632ae496197807d520df380017dca664543
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 06:39:34 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 06:39:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=009d0632

clean out some dead commented out code. add a blank line after each action task for spacing tasks.

---
 layman/cli.py |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index 9690e54..5c1b0a6 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -218,10 +218,8 @@ class Main(object):
         result = self.api.fetch_remote_list()
         if result:
             self.output.info('Fetch Ok', 2)
-        #else:
-        #    errors = self.api.get_errors()
-        #    self.output.warn('Download failed.\nError was: '
-        #                     + str('\n'.join(errors)), 2)
+        # blank newline  -- no " *"
+        self.output.notice('')
         return result
 
 
@@ -237,10 +235,8 @@ class Main(object):
         if result:
             self.output.info('Successfully added overlay(s) '+\
                 ', '.join(selection) +'.', 2)
-        #else:
-        #    errors = self.api.get_errors()
-        #    self.output.warn('Failed to add overlay(s).\nError was: '
-        #                     + str('\n'.join(errors)), 2)
+        # blank newline  -- no " *"
+        self.output.notice('')
         return result
 
 
@@ -254,7 +250,10 @@ class Main(object):
         if self.config['sync_all'] or 'ALL' in selection:
             selection = self.api.get_installed()
         self.output.debug('Updating selected overlays', 6)
-        return self.api.sync(selection)
+        result = self.api.sync(selection)
+        # blank newline  -- no " *"
+        self.output.notice('')
+        return result
 
 
     def Delete(self):
@@ -268,10 +267,8 @@ class Main(object):
         if result:
             self.output.info('Successfully deleted overlay(s) ' +\
                 ', '.join(selection) + '.', 2)
-        #else:
-        #    errors = self.api.get_errors()
-        #    self.output.warn('Failed to delete overlay(s).\nError was: '
-        #                     + str('\n'.join(errors)), 2)
+        # blank newline  -- no " *"
+        self.output.notice('')
         return result
 
 
@@ -288,6 +285,8 @@ class Main(object):
         info = self.api.get_info_str(selection, local=False,
             verbose=True, width=list_printer.width)
         list_printer.print_shortdict(info, complain=_complain)
+        # blank newline  -- no " *"
+        self.output.notice('')
         return info != {}
 
 
@@ -302,6 +301,8 @@ class Main(object):
         info = self.api.get_info_list(local=False,
             verbose=self.config['verbose'], width=list_printer.width)
         list_printer.print_shortlist(info, complain=_complain)
+        # blank newline  -- no " *"
+        self.output.notice('')
 
         return info != {}
 
@@ -324,6 +325,8 @@ class Main(object):
         #info = self.api.get_all_info(self.api.get_installed(), local=True)
         #list_printer.print_fulldict(info, complain=_complain)
 
+        # blank newline  -- no " *"
+        self.output.notice('')
         return info != {}
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07  7:12 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07  7:12 UTC (permalink / raw
  To: gentoo-commits

commit:     e76952c1e6817c0bec94665a6307a06507a0e029
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 06:38:01 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 06:38:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e76952c1

fix typo causing traceback in bug 377401 comment # 31

---
 layman/api.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index a5045aa..c04dfe6 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -353,7 +353,8 @@ class LaymanAPI(object):
                         '%(candidates)s\n'
                         '\n'
                         'as correct location%(plural)s.\n'
-                        'Please consider removing and re-adding the overlay.' , {
+                        'Please consider removing and re-adding the overlay.' %
+                        {
                             'repo_name':ovl,
                             'current_src':current_src,
                             'candidates':candidates,



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     4a856960773b513a6dd821b4dac2c5aa87ccc929
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 02:27:30 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 05:59:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4a856960

fix a bug causing it to not get the correct config path.
improve debug messages, set levels to 9

---
 layman/argsparser.py |   30 +++++++++++++++++-------------
 layman/config.py     |   10 +++++-----
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index fd255d7..93f11d6 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -269,12 +269,19 @@ class ArgsParser(BareConfig):
         # Set only alternate config settings from the options
         if self.options.__dict__['config'] is not None:
             self.defaults['config'] = self.options.__dict__['config']
-            self.output.debug('Got config file at ' + self.defaults['config'], 8)
+            self.output.debug('ARGSPARSER: Got config file at ' + \
+                self.defaults['config'], 8)
+        else: # fix the config path
+            self.defaults['config'] = self.defaults['config'] \
+                % {'configdir': self.defaults['configdir']}
         if self.options.__dict__['overlay_defs'] is not None:
             self.defaults['overlay_defs'] = self.options.__dict__['overlay_defs']
-            self.output.debug('Got overlay_defs location at ' + self.defaults['overlay_defs'], 8)
+            self.output.debug('ARGSPARSER: Got overlay_defs location at ' + \
+                self.defaults['overlay_defs'], 8)
 
         # Now parse the config file
+        self.output.debug('ARGSPARSER: Reading config file at ' + \
+            self.defaults['config'], 8)
         self.read_config(self.defaults)
 
         # handle quietness
@@ -283,9 +290,6 @@ class ArgsParser(BareConfig):
         elif self.options.__dict__['quietness']:
             self.set_option('quietness', self.options.__dict__['quietness'])
 
-        #self.output.debug('Reading config file at ' + self.defaults['config'], 8)
-
-        self.read_config(self.defaults)
 
     def __getitem__(self, key):
 
@@ -299,20 +303,20 @@ class ArgsParser(BareConfig):
             if len(overlays):
                 return  overlays
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving options option: %s' % key, 9)
 
         if (key in self.options.__dict__.keys()
             and not self.options.__dict__[key] is None):
             return self.options.__dict__[key]
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving config option: %s' % key, 9)
 
         if self.config.has_option('MAIN', key):
             if key in self._defaults['t/f_options']:
                 return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving option: %s' % key, 9)
 
         if key in self._options.keys():
             return self._options[key]
@@ -320,7 +324,7 @@ class ArgsParser(BareConfig):
         if key in self.defaults.keys():
             return self.defaults[key]
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving option failed. returning None', 9)
 
         return None
 
@@ -328,22 +332,22 @@ class ArgsParser(BareConfig):
     def keys(self):
         '''Special handler for the configuration keys.'''
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys', 9)
 
         keys = [i for i in self.options.__dict__.keys()
                 if not self.options.__dict__[i] is None]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys 2', 9)
 
         keys += [name for name, _ in self.config.items('MAIN')
                  if not name in keys]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys 3', 9)
 
         keys += [i for i in self.defaults.keys()
                  if not i in keys]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Returning keys', 9)
 
         return keys
 

diff --git a/layman/config.py b/layman/config.py
index 644a63a..3873eef 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -150,14 +150,14 @@ class BareConfig(object):
         '''Special handler for the configuration keys.
         '''
         self._options['output'].debug(
-            'Retrieving %s options' % self.__class__.__name__, 8)
+            'Retrieving %s options' % self.__class__.__name__, 9)
         keys = [i for i in self._options]
         self._options['output'].debug(
-            'Retrieving %s defaults' % self.__class__.__name__, 8)
+            'Retrieving %s defaults' % self.__class__.__name__, 9)
         keys += [i for i in self._defaults
                  if not i in keys]
         self._options['output'].debug(
-            'Retrieving %s done...' % self.__class__.__name__, 8)
+            'Retrieving %s done...' % self.__class__.__name__, 9)
         return keys
 
 
@@ -195,7 +195,7 @@ class BareConfig(object):
 
     def _get_(self, key):
         self._options['output'].debug(
-            'Retrieving %s option: %s' % (self.__class__.__name__, key), 8)
+            'Retrieving %s option: %s' % (self.__class__.__name__, key), 9)
         if key == 'overlays':
             overlays = ''
             if (key in self._options
@@ -212,7 +212,7 @@ class BareConfig(object):
             if key in self._defaults['t/f_options']:
                 return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
-        self._options['output'].debug('Retrieving BareConfig default', 8)
+        self._options['output'].debug('Retrieving BareConfig default', 9)
         if key in self._defaults['t/f_options']:
             return self.t_f_check(self._defaults[key])
         if key in self._defaults:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-07  2:29 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-07  2:29 UTC (permalink / raw
  To: gentoo-commits

commit:     2c1ccc83fc0ff72ebe607a459c5d763be1b6421c
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Aug  7 02:27:30 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  7 02:27:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2c1ccc83

fix a bug causing it to not get the correct config path.
improve debug messages, set levels to 9

---
 layman/argsparser.py |   27 ++++++++++++++-------------
 layman/config.py     |   10 +++++-----
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index fd255d7..3bc54ba 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -269,12 +269,16 @@ class ArgsParser(BareConfig):
         # Set only alternate config settings from the options
         if self.options.__dict__['config'] is not None:
             self.defaults['config'] = self.options.__dict__['config']
-            self.output.debug('Got config file at ' + self.defaults['config'], 8)
+            self.output.debug('ARGSPARSER: Got config file at ' + self.defaults['config'], 8)
+        else: # fix the config path
+            self.defaults['config'] = self.defaults['config'].replace(
+                '%(configdir)s', self.defaults['configdir'])
         if self.options.__dict__['overlay_defs'] is not None:
             self.defaults['overlay_defs'] = self.options.__dict__['overlay_defs']
-            self.output.debug('Got overlay_defs location at ' + self.defaults['overlay_defs'], 8)
+            self.output.debug('ARGSPARSER: Got overlay_defs location at ' + self.defaults['overlay_defs'], 8)
 
         # Now parse the config file
+        self.output.debug('ARGSPARSER: Reading config file at ' + self.defaults['config'], 8)
         self.read_config(self.defaults)
 
         # handle quietness
@@ -283,9 +287,6 @@ class ArgsParser(BareConfig):
         elif self.options.__dict__['quietness']:
             self.set_option('quietness', self.options.__dict__['quietness'])
 
-        #self.output.debug('Reading config file at ' + self.defaults['config'], 8)
-
-        self.read_config(self.defaults)
 
     def __getitem__(self, key):
 
@@ -299,20 +300,20 @@ class ArgsParser(BareConfig):
             if len(overlays):
                 return  overlays
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving options option: %s' % key, 9)
 
         if (key in self.options.__dict__.keys()
             and not self.options.__dict__[key] is None):
             return self.options.__dict__[key]
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving config option: %s' % key, 9)
 
         if self.config.has_option('MAIN', key):
             if key in self._defaults['t/f_options']:
                 return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving option: %s' % key, 9)
 
         if key in self._options.keys():
             return self._options[key]
@@ -320,7 +321,7 @@ class ArgsParser(BareConfig):
         if key in self.defaults.keys():
             return self.defaults[key]
 
-        self.output.debug('Retrieving option', 8)
+        self.output.debug('ARGSPARSER: Retrieving option failed. returning None', 9)
 
         return None
 
@@ -328,22 +329,22 @@ class ArgsParser(BareConfig):
     def keys(self):
         '''Special handler for the configuration keys.'''
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys', 9)
 
         keys = [i for i in self.options.__dict__.keys()
                 if not self.options.__dict__[i] is None]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys 2', 9)
 
         keys += [name for name, _ in self.config.items('MAIN')
                  if not name in keys]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Retrieving keys 3', 9)
 
         keys += [i for i in self.defaults.keys()
                  if not i in keys]
 
-        self.output.debug('Retrieving keys', 8)
+        self.output.debug('ARGSPARSER: Returning keys', 9)
 
         return keys
 

diff --git a/layman/config.py b/layman/config.py
index 644a63a..3873eef 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -150,14 +150,14 @@ class BareConfig(object):
         '''Special handler for the configuration keys.
         '''
         self._options['output'].debug(
-            'Retrieving %s options' % self.__class__.__name__, 8)
+            'Retrieving %s options' % self.__class__.__name__, 9)
         keys = [i for i in self._options]
         self._options['output'].debug(
-            'Retrieving %s defaults' % self.__class__.__name__, 8)
+            'Retrieving %s defaults' % self.__class__.__name__, 9)
         keys += [i for i in self._defaults
                  if not i in keys]
         self._options['output'].debug(
-            'Retrieving %s done...' % self.__class__.__name__, 8)
+            'Retrieving %s done...' % self.__class__.__name__, 9)
         return keys
 
 
@@ -195,7 +195,7 @@ class BareConfig(object):
 
     def _get_(self, key):
         self._options['output'].debug(
-            'Retrieving %s option: %s' % (self.__class__.__name__, key), 8)
+            'Retrieving %s option: %s' % (self.__class__.__name__, key), 9)
         if key == 'overlays':
             overlays = ''
             if (key in self._options
@@ -212,7 +212,7 @@ class BareConfig(object):
             if key in self._defaults['t/f_options']:
                 return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
-        self._options['output'].debug('Retrieving BareConfig default', 8)
+        self._options['output'].debug('Retrieving BareConfig default', 9)
         if key in self._defaults['t/f_options']:
             return self.t_f_check(self._defaults[key])
         if key in self._defaults:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-06 20:30 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-06 20:30 UTC (permalink / raw
  To: gentoo-commits

commit:     f4ccd5f6ac6449eee0a5144027ee7faa24a6e3d4
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Aug  6 20:29:35 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug  6 20:29:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f4ccd5f6

add a space before the * in the output func()'s as per "Etal"'s request in http://forums.gentoo.org/viewtopic-t-877029.html 

---
 layman/output.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 6751b59..3e82305 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -133,7 +133,7 @@ class Message(MessageBase):
             return
 
         for i in info.split('\n'):
-            print(self.color_func('green', '* ') + i, file=self.std_out)
+            print(self.color_func('green', ' * ') + i, file=self.std_out)
 
 
     def status (self, message, status, info = 'ignored'):
@@ -147,7 +147,7 @@ class Message(MessageBase):
             return
 
         for i in lines[0:-1]:
-            print(self.color_func('green', '* ') + i, file=self.std_out)
+            print(self.color_func('green', ' * ') + i, file=self.std_out)
 
         i = lines[-1]
 
@@ -161,7 +161,7 @@ class Message(MessageBase):
         else:
             result = '[' + self.color_func('yellow', info) + ']'
 
-        print(self.color_func('green', '* ') + i + ' ' + \
+        print(self.color_func('green', ' * ') + i + ' ' + \
             '.' * (58 - len(i)) + ' ' + result, file=self.std_out)
 
 
@@ -174,7 +174,7 @@ class Message(MessageBase):
             return
 
         for i in warn.split('\n'):
-            print(self.color_func('yellow', '* ') + i, file=self.std_out)
+            print(self.color_func('yellow', ' * ') + i, file=self.std_out)
 
 
     def error (self, error):
@@ -188,7 +188,7 @@ class Message(MessageBase):
             # "layman -L |& less".
             sys.stdout.flush()
             self.error_out.flush()
-            print(self.color_func('red', '* ') + i, file=self.std_out)
+            print(self.color_func('red', ' * ') + i, file=self.std_out)
             sys.stdout.flush()
         self.do_error_callback(error)
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-06 18:29 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-06 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     341f69005710839bc984e414a823238c9329bd08
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Aug  6 18:28:53 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug  6 18:28:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=341f6900

add debug messages, fix error reporting in the api, refactor action & error processing/tracking.

---
 layman/api.py |   45 ++++++++++++++++++++++++++-----------
 layman/cli.py |   68 +++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 36 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 869d882..a5045aa 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -112,7 +112,7 @@ class LaymanAPI(object):
         results = []
         for ovl in repos:
             if not self.is_installed(ovl):
-                self._error("Repository '"+ovl+"' was not installed")
+                self.output.error("Repository '"+ovl+"' was not installed")
                 results.append(False)
                 continue
             success = False
@@ -142,11 +142,11 @@ class LaymanAPI(object):
         results = []
         for ovl in repos:
             if self.is_installed(ovl):
-                self._error("Repository '"+ovl+"' was already installed")
+                self.output.error("Repository '"+ovl+"' was already installed")
                 results.append(False)
                 continue
             if not self.is_repo(ovl):
-                self._error(UnknownOverlayMessage(ovl))
+                self.output.error(UnknownOverlayMessage(ovl))
                 results.append(False)
                 continue
             success = False
@@ -199,7 +199,7 @@ class LaymanAPI(object):
 
         for ovl in repos:
             if not self.is_repo(ovl):
-                self._error(UnknownOverlayMessage(ovl))
+                self.output.error(UnknownOverlayMessage(ovl))
                 result[ovl] = ('', False, False)
                 continue
             try:
@@ -251,7 +251,7 @@ class LaymanAPI(object):
 
         for ovl in repos:
             if not self.is_repo(ovl):
-                self._error(UnknownOverlayMessage(ovl))
+                self.output.error(UnknownOverlayMessage(ovl))
                 result[ovl] = ('', False, False)
                 continue
             try:
@@ -298,26 +298,39 @@ class LaymanAPI(object):
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype bool or {'repo-id': bool,...}
         """
+        self.output.debug("API.sync(); repos to sync = %s" % ', '.join(repos), 5)
         fatals = []
         warnings = []
         success  = []
         repos = self._check_repo_type(repos, "sync")
         db = self._get_installed_db()
 
+        self.output.debug("API.sync(); starting ovl loop", 5)
         for ovl in repos:
+            self.output.debug("API.sync(); starting ovl = %s" %ovl, 5)
             try:
+                self.output.debug("API.sync(); selecting %s, db = %s" % (ovl, str(db)), 5)
                 odb = db.select(ovl)
+                self.output.debug("API.sync(); %s now selected" %ovl, 5)
             except UnknownOverlayException as error:
-                self._error(UnknownOverlayException(error))
+                self.output.debug("API.sync(); UnknownOverlayException selecting %s" %ovl, 5)
+                self._error(str(error))
+                fatals.append((ovl,
+                    'Failed to select overlay "' + ovl + '".\nError was: '
+                    + str(error)))
+                self.output.debug("API.sync(); UnknownOverlayException "
+                    "selecting %s.   continuing to next ovl..." %ovl, 5)
                 continue
 
             try:
+                self.output.debug("API.sync(); try: self._get_remote_db().select(ovl)", 5)
                 ordb = self._get_remote_db().select(ovl)
             except UnknownOverlayException:
                 message = 'Overlay "%s" could not be found in the remote lists.\n' \
                         'Please check if it has been renamed and re-add if necessary.' % ovl
                 warnings.append((ovl, message))
             else:
+                self.output.debug("API.sync(); else: self._get_remote_db().select(ovl)", 5)
                 current_src = odb.sources[0].src
                 available_srcs = set(e.src for e in ordb.sources)
                 if ordb and odb and not current_src in available_srcs:
@@ -348,6 +361,7 @@ class LaymanAPI(object):
                             }))
 
             try:
+                self.output.debug("API.sync(); starting db.sync(ovl)", 5)
                 db.sync(ovl, self.config['quiet'])
                 success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))
             except Exception as error:
@@ -357,19 +371,22 @@ class LaymanAPI(object):
 
         if output_results:
             if success:
-                self.output.info('\nSucceeded:\n------\n', 3)
+                message = '\nSucceeded:\n------\n'
                 for ovl, result in success:
-                    self.output.info(result, 3)
+                    message += result + '\n'
+                self.output.info(message, 3)
 
             if warnings:
-                self.output.warn('\nWarnings:\n------\n', 2)
+                message = '\nWarnings:\n------\n'
                 for ovl, result in warnings:
-                    self.output.warn(result + '\n', 2)
+                    message += result + '\n'
+                self.output.warn(message, 2)
 
             if fatals:
-                self.output.error('\nErrors:\n------\n')
+                message = '\nErrors:\n------\n'
                 for ovl, result in fatals:
-                    self.output.error(result + '\n')
+                    message += result + '\n'
+                self.output.error(message)
 
         self.sync_results = (success, warnings, fatals)
 
@@ -434,7 +451,7 @@ class LaymanAPI(object):
                 'LaymanAPI.fetch_remote_list(); cache updated = %s'
                 % str(dbreload),8)
         except Exception as error:
-            self._error('Failed to fetch overlay list!\n Original Error was: '
+            self.output.error('Failed to fetch overlay list!\n Original Error was: '
                     + str(error))
             return False
         self.get_available(dbreload)
@@ -483,6 +500,7 @@ class LaymanAPI(object):
         due to code taken from the packagekit backend.
         """
         self._error_messages.append(message)
+        self.output.debug("API._error(); _error_messages = %s" % str(self._error_messages), 4)
         if self.report_errors:
             print(message, file=self.config['stderr'])
 
@@ -494,6 +512,7 @@ class LaymanAPI(object):
         @rtype: list
         @return: list of error strings
         """
+        self.output.debug("API.get_errors(); _error_messages = %s" % str(self._error_messages), 4)
         if len(self._error_messages):
             messages =  self._error_messages[:]
             self._error_messages = []

diff --git a/layman/cli.py b/layman/cli.py
index 5618d49..f545b0e 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -135,7 +135,7 @@ class Main(object):
         #print("config.keys()", config.keys())
         self.output = config['output']
         self.api = LaymanAPI(config,
-                             report_errors=True,
+                             report_errors=False,
                              output=config.output)
         # Given in order of precedence
         self.actions = [('fetch',      'Fetch'),
@@ -148,6 +148,8 @@ class Main(object):
                         ('list_local', 'ListLocal'),]
 
     def __call__(self):
+        self.output.debug("CLI.__call__(): self.config.keys()"
+            " %s" % str(self.config.keys()), 6)
         # Make fetching the overlay list a default action
         if not 'nofetch' in self.config.keys():
             # Actions that implicitely call the fetch operation before
@@ -169,23 +171,41 @@ class Main(object):
             self.output.die('Failed setting to umask "' + umask +
                 '"!\nError was: ' + str(error))
 
+        action_errors = []
+        results = []
+        act=set([x[0] for x in self.actions])
+        k=set([x for x in self.config.keys()])
+        a=act.intersection(k)
+        self.output.debug('Actions = %s' % str(a), 4)
         for action in self.actions:
 
-            self.output.debug('Checking for action', 7)
+            self.output.debug('Checking for action %s' % action[0], 4)
 
             if action[0] in self.config.keys():
-                try:
-                    result += getattr(self, action[1])()
-                except Exception as error:
-                    for _error in self.api.get_errors():
-                        self.output.error(_error)
+                result += getattr(self, action[1])()
+                _errors = self.api.get_errors()
+                if _errors:
+                    self.output.debug("CLI: found errors performing "
+                        "action %s" % action[0], 2)
+                    action_errors.append((action[0], _errors))
                     result = -1  # So it cannot remain 0, i.e. success
-                    break
+            results.append(result)
+            self.output.debug('Completed action %s, result %s'
+                % (action[0], result==0), 4)
+
+        self.output.debug('Checking for action errors', 4)
+        if action_errors:
+            for action, _errors in action_errors:
+                self.output.notice("\n")
+                self.output.warn("CLI: Errors occured processing action"
+                    " %s" % action)
+                for _error in _errors:
+                    self.output.error(_error)
 
         # Reset umask
         os.umask(old_umask)
 
-        if not result:
+        if -1 in results:
             sys.exit(FAILURE)
         else:
             sys.exit(SUCCEED)
@@ -194,20 +214,21 @@ class Main(object):
     def Fetch(self):
         ''' Fetches the overlay listing.
         '''
-        self.output.info("Fetching remote list,...", 2)
+        self.output.info("\nFetching remote list,...", 2)
         result = self.api.fetch_remote_list()
         if result:
             self.output.info('Fetch Ok', 2)
-        else:
-            errors = self.api.get_errors()
-            self.output.warn('Download failed.\nError was: '
-                             + str('\n'.join(errors)), 2)
+        #else:
+        #    errors = self.api.get_errors()
+        #    self.output.warn('Download failed.\nError was: '
+        #                     + str('\n'.join(errors)), 2)
         return result
 
 
     def Add(self):
         ''' Adds the selected overlays.
         '''
+        self.output.info("\nAdding overlay,...", 2)
         selection = decode_selection(self.config['add'])
         if 'ALL' in selection:
             selection = self.api.get_available()
@@ -216,10 +237,10 @@ class Main(object):
         if result:
             self.output.info('Successfully added overlay(s) '+\
                 ', '.join(selection) +'.', 2)
-        else:
-            errors = self.api.get_errors()
-            self.output.warn('Failed to add overlay(s).\nError was: '
-                             + str('\n'.join(errors)), 2)
+        #else:
+        #    errors = self.api.get_errors()
+        #    self.output.warn('Failed to add overlay(s).\nError was: '
+        #                     + str('\n'.join(errors)), 2)
         return result
 
 
@@ -227,6 +248,7 @@ class Main(object):
     def Sync(self):
         ''' Syncs the selected overlays.
         '''
+        self.output.info("\nSyncing selected overlays,...", 2)
         # Note api.sync() defaults to printing results
         selection = decode_selection(self.config['sync'])
         if self.config['sync_all'] or 'ALL' in selection:
@@ -238,18 +260,18 @@ class Main(object):
     def Delete(self):
         ''' Deletes the selected overlays.
         '''
+        self.output.info('\nDeleting selected overlays,...', 2)
         selection = decode_selection(self.config['delete'])
         if 'ALL' in selection:
             selection = self.api.get_installed()
-        self.output.debug('Deleting selected overlays', 6)
         result = self.api.delete_repos(selection)
         if result:
             self.output.info('Successfully deleted overlay(s) ' +\
                 ', '.join(selection) + '.', 2)
-        else:
-            errors = self.api.get_errors()
-            self.output.warn('Failed to delete overlay(s).\nError was: '
-                             + str('\n'.join(errors)), 2)
+        #else:
+        #    errors = self.api.get_errors()
+        #    self.output.warn('Failed to delete overlay(s).\nError was: '
+        #                     + str('\n'.join(errors)), 2)
         return result
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-08-06 18:29 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-08-06 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     53db3cb076054b41e5479299526c67f7cd4d0871
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Aug  6 18:24:51 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug  6 18:24:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=53db3cb0

add --debug-level to cli options and code Message.debug()

---
 layman/argsparser.py |   17 +++++++++++++++++
 layman/output.py     |   12 ++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index dee5d43..fd255d7 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -224,6 +224,14 @@ class ArgsParser(BareConfig):
                          'ssue a warning if description or contact information'
                          ' are missing.')
 
+        group.add_option('--debug-level',
+                         action = 'store',
+                         type = 'int',
+                         help = 'A value between 0 and 10. 0 means no debugging '
+                         'messages will be selected, 10 selects all debugging me'
+                         'ssages. Default is "4".')
+
+
         self.parser.add_option_group(group)
 
         #-----------------------------------------------------------------
@@ -246,6 +254,15 @@ class ArgsParser(BareConfig):
         # handle debugging
         #self.output.cli_handle(self.options)
 
+        if (self.options.__dict__.has_key('debug_level') and
+            self.options.__dict__['debug_level']):
+            dbglvl = int(self.options.__dict__['debug_level'])
+            if dbglvl < 0:
+                dbglvl = 0
+            if dbglvl > 10:
+                dbglvl = 10
+            self.output.set_debug_level(dbglvl)
+
         if self.options.__dict__['nocolor']:
             self.output.set_colorize(OFF)
 

diff --git a/layman/output.py b/layman/output.py
index 06161ca..6751b59 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -110,7 +110,14 @@ class Message(MessageBase):
         """empty debug function, does nothing,
         declared here for compatibility with DebugMessage
         """
-        pass
+        if type(info) not in types.StringTypes:
+            info = str(info)
+
+        if level > self.debug_lev:
+            return
+
+        for i in info.split('\n'):
+            print(self.color_func('yellow', 'DEBUG: ') + i, file=self.std_out)
 
 
     def notice (self, note):
@@ -180,8 +187,9 @@ class Message(MessageBase):
             # stay in nice order.  This is a workaround for calls like
             # "layman -L |& less".
             sys.stdout.flush()
-            print(self.color_func('red', '* ') + i, file=self.std_out)
             self.error_out.flush()
+            print(self.color_func('red', '* ') + i, file=self.std_out)
+            sys.stdout.flush()
         self.do_error_callback(error)
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-28 21:33 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-28 21:33 UTC (permalink / raw
  To: gentoo-commits

commit:     b08a5e4b34e0258e84714bcef16c1d5d09c71b39
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Jul 28 21:29:12 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jul 28 21:29:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b08a5e4b

fix setting the timestamp from the remote server, bug # 376601.

---
 layman/db.py |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index bb6fd81..64b54ce 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -319,7 +319,12 @@ class RemoteDB(DbBase):
 
             try:
                 connection = opener.open(request)
-                timestamp = connection.headers['last-modified']
+                if 'last-modified' in connection.headers.keys():
+                    timestamp = connection.headers['last-modified']
+                elif 'date' in connection.headers.keys():
+                    timestamp = connection.headers['date']
+                else:
+                    timestamp = None
             except urllib2.HTTPError as e:
                 if e.getcode() == 304:
                     self.output.info('Remote list already up to date: %s'
@@ -330,15 +335,16 @@ class RemoteDB(DbBase):
                         % str(e))
                 continue
             except IOError as error:
-                self.output.warn('Failed to update the overlay list from: '
-                         + url + '\nError was:\n' + str(error))
+                self.output.warn('RemoteDB.cache(); Failed to update the overlay list from: '
+                         + url + '\nIOError was:\n' + str(error))
             else:
                 if url.startswith('file://'):
                     quieter = 1
                 else:
                     quieter = 0
                 self.output.info('Fetching new list... %s' % url, 4 + quieter)
-                self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
+                if timestamp is not None:
+                    self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
                 # Fetch the remote list
                 olist = connection.read()
 
@@ -368,9 +374,10 @@ class RemoteDB(DbBase):
                     out_file.write(olist)
                     out_file.close()
 
-                    out_file = open(tpath, 'w')
-                    out_file.write(timestamp)
-                    out_file.close()
+                    if timestamp is not None:
+                        out_file = open(tpath, 'w')
+                        out_file.write(str(timestamp))
+                        out_file.close()
 
                     has_updates = True
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-23  6:45 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-23  6:45 UTC (permalink / raw
  To: gentoo-commits

commit:     76631892e26c1f08d3a00232e58f454acda09fef
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Jul 23 06:40:41 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Jul 23 06:40:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=76631892

fix existing tests. add tests for new classes. rename T/F_options to lowwercase due to ConfigParser making it lowercase, creating a dupe.

---
 layman/argsparser.py |   33 ++++++++++++++++++++-------------
 layman/config.py     |   44 ++++++++++++++++++++++++++++++++++----------
 2 files changed, 54 insertions(+), 23 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index aa31149..dee5d43 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -51,20 +51,19 @@ class ArgsParser(BareConfig):
     def __init__(self, args=None, stdout=None, stdin=None, stderr=None):
         '''
         Creates and describes all possible polymeraZe options and creates
-        a debugging object.
+        a Message object.
 
         >>> import os.path
         >>> here = os.path.dirname(os.path.realpath(__file__))
         >>> sys.argv.append('--config')
         >>> sys.argv.append(here + '/../etc/layman.cfg')
+        >>> sys.argv.append('--overlay_defs')
+        >>> sys.argv.append('')
         >>> a = ArgsParser()
         >>> a['overlays']
         '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command',
-        'git_command', 'local_list', 'make_conf', 'mercurial_command',
-        'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage',
-        'svn_command', 'tar_command', 'umask', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'overlay_defs', 'overlays', 'proxy', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'width']
         '''
 
         BareConfig.__init__(self, stdout=stdout, stderr=stderr, stdin=stdin)
@@ -159,6 +158,12 @@ class ArgsParser(BareConfig):
                          help = 'Path to the config file [default: ' \
                          + self.defaults['config'] + '].')
 
+        group.add_option('-O',
+                         '--overlay_defs',
+                         action = 'store',
+                         help = 'Path to aditional overlay.xml files [default: '\
+                         + self.defaults['overlay_defs'] + '].')
+
         group.add_option('-o',
                          '--overlays',
                          action = 'append',
@@ -235,7 +240,7 @@ class ArgsParser(BareConfig):
         (self.options, remain_args) = self.parser.parse_args(args)
         # remain_args starts with something like "bin/layman" ...
         if len(remain_args) > 1:
-            self.parser.error("Unhandled parameters: %s"
+            self.parser.error("ArgsParser(): Unhandled parameters: %s"
                 % ', '.join(('"%s"' % e) for e in remain_args[1:]))
 
         # handle debugging
@@ -244,14 +249,16 @@ class ArgsParser(BareConfig):
         if self.options.__dict__['nocolor']:
             self.output.set_colorize(OFF)
 
-        # Fetch only an alternate config setting from the options
-        #if not self.options.__dict__['config'] is None:
-        #    self._defaults['config'] = self.options.__dict__['config']
-
-            #self.output.debug('Got config file at ' + self.defaults['config'], 8)
+        # Set only alternate config settings from the options
+        if self.options.__dict__['config'] is not None:
+            self.defaults['config'] = self.options.__dict__['config']
+            self.output.debug('Got config file at ' + self.defaults['config'], 8)
+        if self.options.__dict__['overlay_defs'] is not None:
+            self.defaults['overlay_defs'] = self.options.__dict__['overlay_defs']
+            self.output.debug('Got overlay_defs location at ' + self.defaults['overlay_defs'], 8)
 
         # Now parse the config file
-        self.read_config(self._defaults)
+        self.read_config(self.defaults)
 
         # handle quietness
         if self.options.__dict__['quiet']:
@@ -284,7 +291,7 @@ class ArgsParser(BareConfig):
         self.output.debug('Retrieving option', 8)
 
         if self.config.has_option('MAIN', key):
-            if key in self._defaults['T/F_options']:
+            if key in self._defaults['t/f_options']:
                 return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
 

diff --git a/layman/config.py b/layman/config.py
index 609b81e..644a63a 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -68,14 +68,16 @@ class BareConfig(object):
 
         >>> a = BareConfig()
         >>> a['overlays']
-        '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml'
+        'http://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command',
-        'git_command', 'local_list', 'make_conf', 'mercurial_command',
-        'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage',
-        'svn_command', 'tar_command', 'umask', 'width', ...]
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
+        >>> a.get_option('nocheck')
+        True
         '''
-        self._defaults = {'config'    : '/etc/layman/layman.cfg',
+
+        self._defaults = {
+                    'configdir': '/etc/layman',
+                    'config'    : '%(configdir)s/layman.cfg',
                     'storage'   : '/var/lib/layman',
                     'cache'     : '%(storage)s/cache',
                     'local_list': '%(storage)s/overlays.xml',
@@ -85,7 +87,7 @@ class BareConfig(object):
                     'umask'     : '0022',
                     'overlays'  :
                     'http://www.gentoo.org/proj/en/overlays/repositories.xml',
-                    'overlay_defs': '/etc/layman/overlays',
+                    'overlay_defs': '%(configdir)s/overlays',
                     'bzr_command': '/usr/bin/bzr',
                     'cvs_command': '/usr/bin/cvs',
                     'darcs_command': '/usr/bin/darcs',
@@ -95,7 +97,7 @@ class BareConfig(object):
                     'rsync_command': '/usr/bin/rsync',
                     'svn_command': '/usr/bin/svn',
                     'tar_command': '/bin/tar',
-                    'T/F_options': ['nocheck'],
+                    't/f_options': ['nocheck'],
                     'bzr_addopts' : '',
                     'bzr_syncopts' : '',
                     'cvs_addopts' : '',
@@ -207,10 +209,12 @@ class BareConfig(object):
             and not self._options[key] is None):
             return self._options[key]
         if self.config and self.config.has_option('MAIN', key):
-            if key in self._defaults['T/F_options']:
-                return t_f_check(self.config.get('MAIN', key))
+            if key in self._defaults['t/f_options']:
+                return self.t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
         self._options['output'].debug('Retrieving BareConfig default', 8)
+        if key in self._defaults['t/f_options']:
+            return self.t_f_check(self._defaults[key])
         if key in self._defaults:
             if '%(storage)s' in self._defaults[key]:
                 return self._defaults[key] %{'storage': self._defaults['storage']}
@@ -235,6 +239,16 @@ class OptionConfig(BareConfig):
         """
         @param options: dictionary of {'option': value, ...}
         @rtype OptionConfig class instance.
+
+        >>> options = {"overlays": ["http://www.gentoo-overlays.org/repositories.xml"]}
+        >>> new_defaults = {"configdir": "/etc/test-dir"}
+        >>> a = OptionConfig(options=options, defaults=new_defaults)
+        >>> a['overlays']
+        'http://www.gentoo-overlays.org/repositories.xml'
+        >>> a["configdir"]
+        '/etc/test-dir'
+        >>> sorted(a.keys())
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
         """
         BareConfig.__init__(self)
 
@@ -268,3 +282,13 @@ class OptionConfig(BareConfig):
         if new_defaults is not None:
             self._defaults.update(new_defaults)
         return
+
+#===============================================================================
+#
+# Testing
+#
+#-------------------------------------------------------------------------------
+
+if __name__ == '__main__':
+    import doctest
+    doctest.testmod(sys.modules[__name__])



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-20 18:34 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-20 18:34 UTC (permalink / raw
  To: gentoo-commits

commit:     2a3d535c9a6ec6680832ce2bc249f9bc80b67864
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul 20 18:27:12 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jul 20 18:27:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2a3d535c

fix --list --verbose functionality, bug 375779

---
 layman/db.py     |    2 +-
 layman/dbbase.py |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index b1df906..747eb4b 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -391,7 +391,7 @@ class RemoteDB(DbBase):
                 if hint:
                     self.output.warn(
                         'You do not have permission to update the cache (%s).'
-                        % mpath)
+                        % path)
                     import getpass
                     if getpass.getuser() != 'root':
                         self.output.warn('Hint: You are not root.\n')

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 70d0cfa..48199a6 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -277,8 +277,8 @@ class DbBase:
 
         for overlay in selection:
             if verbose:
-                result.append(overlay.get_infostr(), overlay.is_supported(),
-                               overlay.is_official())
+                result.append((overlay.get_infostr(), overlay.is_supported(),
+                               overlay.is_official()))
             else:
                 result.append((overlay.short_list(width), overlay.is_supported(),
                                overlay.is_official()))



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-12 20:01 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-12 20:01 UTC (permalink / raw
  To: gentoo-commits

commit:     bebce640cda970df5f98e1a9d3a2d0c4a68b2e57
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jul 12 20:00:54 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jul 12 20:00:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bebce640

change raising an exceptio to outputing the error.

---
 layman/db.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 3ed5cc6..b1df906 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -206,7 +206,9 @@ class DB(DbBase):
             self.write(self.path)
             make_conf.delete(overlay)
         else:
-            raise Exception('No local overlay named "' + overlay.name + '"!')
+            self.output.error('No local overlay named "' + overlay.name + '"!')
+            return False
+        return True
 
     def sync(self, overlay_name, quiet = False):
         '''Synchronize the given overlay.'''



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-12 19:57 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-12 19:57 UTC (permalink / raw
  To: gentoo-commits

commit:     021d8bc9211cb4f4adad814f6c1bbcd399f72786
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jul 12 19:57:08 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jul 12 19:57:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=021d8bc9

fix success mistracking

---
 layman/api.py |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 8e54d7d..985eee0 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -114,14 +114,15 @@ class LaymanAPI(object):
                 self._error("Repository '"+ovl+"' was not installed")
                 results.append(False)
                 continue
+            success = False
             try:
                 self._get_installed_db().delete(
                     self._get_installed_db().select(ovl))
-                results.append(True)
             except Exception as e:
                 self._error(
-                        "Failed to disable repository '"+ovl+"':\n"+str(e))
-                results.append(False)
+                        "Exception caught disabling repository '"+ovl+
+                            "':\n"+str(e))
+            results.append(success)
             self.get_installed(dbreload=True)
         if False in results:
             return False
@@ -147,12 +148,14 @@ class LaymanAPI(object):
                 self._error(UnknownOverlayMessage(ovl))
                 results.append(False)
                 continue
+            success = False
             try:
-                self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
-                results.append(True)
+                success = self._get_installed_db().add(
+                    self._get_remote_db().select(ovl), quiet=True)
             except Exception as e:
-                self._error("Failed to enable repository '"+ovl+"' : "+str(e))
-                results.append(False)
+                self._error("Exception caught enabling repository '"+ovl+
+                    "' : "+str(e))
+            results.append(success)
             self.get_installed(dbreload=True)
         if False in results:
             return False



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-12 19:57 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-12 19:57 UTC (permalink / raw
  To: gentoo-commits

commit:     c5c3121331d8f2f2b39b8f41b91d705d197be250
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jul 12 19:01:43 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jul 12 19:36:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c5c31213

fix mistracking success adding an overlay.

---
 layman/api.py |   17 +++++++++--------
 layman/db.py  |    4 +++-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 8e54d7d..a924ead 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -114,14 +114,14 @@ class LaymanAPI(object):
                 self._error("Repository '"+ovl+"' was not installed")
                 results.append(False)
                 continue
+            success = False
             try:
-                self._get_installed_db().delete(
+                success = self._get_installed_db().delete(
                     self._get_installed_db().select(ovl))
-                results.append(True)
             except Exception as e:
                 self._error(
-                        "Failed to disable repository '"+ovl+"':\n"+str(e))
-                results.append(False)
+                        "Exception caught disabling repository '"+ovl+"':\n"+str(e))
+            results.append(success)
             self.get_installed(dbreload=True)
         if False in results:
             return False
@@ -147,12 +147,13 @@ class LaymanAPI(object):
                 self._error(UnknownOverlayMessage(ovl))
                 results.append(False)
                 continue
+            success = False
             try:
-                self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
-                results.append(True)
+                success = self._get_installed_db().add(
+                    self._get_remote_db().select(ovl), quiet=True)
             except Exception as e:
-                self._error("Failed to enable repository '"+ovl+"' : "+str(e))
-                results.append(False)
+                self._error("Exception caught enabling repository '"+ovl+"' : "+str(e))
+            results.append(success)
             self.get_installed(dbreload=True)
         if False in results:
             return False

diff --git a/layman/db.py b/layman/db.py
index 3ed5cc6..b1df906 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -206,7 +206,9 @@ class DB(DbBase):
             self.write(self.path)
             make_conf.delete(overlay)
         else:
-            raise Exception('No local overlay named "' + overlay.name + '"!')
+            self.output.error('No local overlay named "' + overlay.name + '"!')
+            return False
+        return True
 
     def sync(self, overlay_name, quiet = False):
         '''Synchronize the given overlay.'''



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-12 19:02 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-12 19:02 UTC (permalink / raw
  To: gentoo-commits

commit:     925f99c614b8708e1b79681ee7ae166152f0c396
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jun  6 06:50:34 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  6 06:50:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=925f99c6

pre-release update

---
 layman/version.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/layman/version.py b/layman/version.py
index 5a1e9cd..b16a250 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -10,11 +10,13 @@
 # Copyright:
 #             (c) 2005 - 2009 Gunnar Wrobel
 #             (c) 2009        Sebastian Pipping
+#             (c) 2011        Brian Dolbec
 #             Distributed under the terms of the GNU General Public License v2
 #
 # Author(s):
 #             Gunnar Wrobel <wrobel@gentoo.org>
 #             Sebastian Pipping <sebastian@pipping.org>
+#             Brian Dolbec <brian.dolbec@gmail.com>
 #
 
 from __future__ import print_function
@@ -22,7 +24,7 @@ from __future__ import print_function
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '2.0-git'
+VERSION = '2.0.0_rc1'
 
 if __name__ == '__main__':
     print(VERSION)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-07-12 19:02 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-07-12 19:02 UTC (permalink / raw
  To: gentoo-commits

commit:     36b0e7f01af24ed622d7ebab1bda9ad00ab8dcfc
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jul 12 19:01:43 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jul 12 19:01:43 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=36b0e7f0

fix an errant mistracking of the success of adding an overlay.

---
 layman/api.py |   12 +++++-------
 layman/db.py  |    4 +++-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 8e54d7d..b494b58 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -115,9 +115,9 @@ class LaymanAPI(object):
                 results.append(False)
                 continue
             try:
-                self._get_installed_db().delete(
+                success = self._get_installed_db().delete(
                     self._get_installed_db().select(ovl))
-                results.append(True)
+                results.append(success)
             except Exception as e:
                 self._error(
                         "Failed to disable repository '"+ovl+"':\n"+str(e))
@@ -147,12 +147,10 @@ class LaymanAPI(object):
                 self._error(UnknownOverlayMessage(ovl))
                 results.append(False)
                 continue
-            try:
-                self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
-                results.append(True)
-            except Exception as e:
+            success = self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
+            results.append(success)
+            if not success:
                 self._error("Failed to enable repository '"+ovl+"' : "+str(e))
-                results.append(False)
             self.get_installed(dbreload=True)
         if False in results:
             return False

diff --git a/layman/db.py b/layman/db.py
index 3ed5cc6..b1df906 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -206,7 +206,9 @@ class DB(DbBase):
             self.write(self.path)
             make_conf.delete(overlay)
         else:
-            raise Exception('No local overlay named "' + overlay.name + '"!')
+            self.output.error('No local overlay named "' + overlay.name + '"!')
+            return False
+        return True
 
     def sync(self, overlay_name, quiet = False):
         '''Synchronize the given overlay.'''



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-18  5:19 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-18  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     c0fff99f7ae0168900eeea30dc27fc240caa9240
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed May 18 05:19:39 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed May 18 05:19:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c0fff99f

fix the success result when adding already installed overlays

---
 layman/api.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 30f850c..8e54d7d 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -111,7 +111,7 @@ class LaymanAPI(object):
         results = []
         for ovl in repos:
             if not self.is_installed(ovl):
-                self._error("Repository '"+ovl+"': was not installed")
+                self._error("Repository '"+ovl+"' was not installed")
                 results.append(False)
                 continue
             try:
@@ -140,7 +140,8 @@ class LaymanAPI(object):
         results = []
         for ovl in repos:
             if self.is_installed(ovl):
-                results.append(True)
+                self._error("Repository '"+ovl+"' was already installed")
+                results.append(False)
                 continue
             if not self.is_repo(ovl):
                 self._error(UnknownOverlayMessage(ovl))



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-18  5:13 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-18  5:13 UTC (permalink / raw
  To: gentoo-commits

commit:     50b971a3724c2b5637d1ce3fc6587d6e3325f2ca
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed May 18 05:12:50 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed May 18 05:12:50 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=50b971a3

fix a false -d success for non-existent overlay. fix a couple error messages.
fix a long line

---
 layman/api.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 7e4ad0e..30f850c 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -111,13 +111,15 @@ class LaymanAPI(object):
         results = []
         for ovl in repos:
             if not self.is_installed(ovl):
-                results.append(True)
+                self._error("Repository '"+ovl+"': was not installed")
+                results.append(False)
                 continue
             try:
-                self._get_installed_db().delete(self._get_installed_db().select(ovl))
+                self._get_installed_db().delete(
+                    self._get_installed_db().select(ovl))
                 results.append(True)
             except Exception as e:
-                self._error(ERROR_INTERNAL_ERROR,
+                self._error(
                         "Failed to disable repository '"+ovl+"':\n"+str(e))
                 results.append(False)
             self.get_installed(dbreload=True)
@@ -148,8 +150,7 @@ class LaymanAPI(object):
                 self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
                 results.append(True)
             except Exception as e:
-                self._error(ERROR_INTERNAL_ERROR,
-                        "Failed to enable repository '"+ovl+"' : "+str(e))
+                self._error("Failed to enable repository '"+ovl+"' : "+str(e))
                 results.append(False)
             self.get_installed(dbreload=True)
         if False in results:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-14 13:06 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-14 13:06 UTC (permalink / raw
  To: gentoo-commits

commit:     6dbd30b42a513437e4219446f34997610b351353
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat May 14 13:06:17 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat May 14 13:06:17 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6dbd30b4

fix /var/lib/layman/make.conf not being updated when adding an overlay

---
 layman/db.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index b152814..3ed5cc6 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -122,7 +122,7 @@ class DB(DbBase):
                     overlay.set_priority(self.config['priority'])
                 self.overlays[overlay.name] = overlay
                 self.write(self.path)
-                if self.config['make_config']:
+                if self.config['make_conf']:
                     make_conf = MakeConf(self.config, self.overlays)
                     make_ok = make_conf.add(overlay)
                     return make_ok



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-05  9:44 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-05  9:44 UTC (permalink / raw
  To: gentoo-commits

commit:     e15707648c5024274bd91b9348dad8cc85b0a497
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu May  5 09:43:11 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu May  5 09:43:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e1570764

quiet the "Fetching" output for locally defined overlays.

---
 layman/db.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 1cf637d..b152814 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -323,8 +323,12 @@ class RemoteDB(DbBase):
                 self.output.warn('Failed to update the overlay list from: '
                          + url + '\nError was:\n' + str(error))
             else:
-                self.output.info('Fetching new list... %s' % url, 4)
-                self.output.info('Last-modified: %s' % timestamp, 4)
+                if url.startswith('file://'):
+                    quieter = 1
+                else:
+                    quieter = 0
+                self.output.info('Fetching new list... %s' % url, 4 + quieter)
+                self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
                 # Fetch the remote list
                 olist = connection.read()
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-02  5:25 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-02  5:25 UTC (permalink / raw
  To: gentoo-commits

commit:     b3c8fd83c0db1f8a38c59386452128b9bd04b7c9
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon May  2 04:54:27 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon May  2 04:54:27 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b3c8fd83

set VERSION and set the 'User-Agent' header to use it.

---
 layman/db.py      |    3 ++-
 layman/version.py |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 0e581bd..1cf637d 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -31,6 +31,7 @@ import hashlib
 from   layman.utils             import path, delete_empty_directory
 from   layman.dbbase            import DbBase
 from   layman.makeconf          import MakeConf
+from   layman.version           import VERSION
 
 #from   layman.debug             import OUT
 
@@ -296,7 +297,7 @@ class RemoteDB(DbBase):
             # and don't re-fetch it unless it has changed
             request = urllib2.Request(url)
             opener = urllib2.build_opener()
-            opener.addheaders = [('User-Agent', 'Layman-2.0-git')]
+            opener.addheaders = [('User-Agent', 'Layman-' + VERSION)]
 
             if os.path.exists(tpath):
                 with open(tpath,'r') as previous:

diff --git a/layman/version.py b/layman/version.py
index 02750c5..5a1e9cd 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -22,7 +22,7 @@ from __future__ import print_function
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
-VERSION = '1.4.2'
+VERSION = '2.0-git'
 
 if __name__ == '__main__':
     print(VERSION)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-01  2:18 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-01  2:18 UTC (permalink / raw
  To: gentoo-commits

commit:     db3e6ddad1edf4b984abd49b23c35715614e733d
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun May  1 02:18:21 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun May  1 02:18:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=db3e6dda

fix --quiet option.

---
 layman/argsparser.py |    2 +-
 layman/config.py     |    6 +++---
 layman/db.py         |    7 ++++---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 9b6aa91..aa31149 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -254,7 +254,7 @@ class ArgsParser(BareConfig):
         self.read_config(self._defaults)
 
         # handle quietness
-        if self['quiet']:
+        if self.options.__dict__['quiet']:
             self.set_option('quiet', True)
         elif self.options.__dict__['quietness']:
             self.set_option('quietness', self.options.__dict__['quietness'])

diff --git a/layman/config.py b/layman/config.py
index 809ca8f..609b81e 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -178,15 +178,15 @@ class BareConfig(object):
         if option == 'quiet':
             if self._options['quiet']:
                 self._set_quietness(1)
-                self._options['quietness'] = 0
+                self._options['quietness'] = 1
             else:
                 self._set_quietness(4)
         if option == 'quietness':
             self._set_quietness(value)
 
     def _set_quietness(self, value):
-            self._options['output'].set_info_level(int(self['quietness']))
-            self._options['output'].set_warn_level(int(self['quietness']))
+            self._options['output'].set_info_level(value)
+            self._options['output'].set_warn_level(value)
 
     def __getitem__(self, key):
         return self._get_(key)

diff --git a/layman/db.py b/layman/db.py
index 6f79e26..0e581bd 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -312,8 +312,8 @@ class RemoteDB(DbBase):
             except urllib2.HTTPError as e:
                 if e.getcode() == 304:
                     self.output.info('Remote list already up to date: %s'
-                        % url)
-                    self.output.info('Last-modified: %s' % timestamp)
+                        % url, 4)
+                    self.output.info('Last-modified: %s' % timestamp, 4)
                 else:
                     self.output.info('RemoteDB.cache(); HTTPError was:\n %s'
                         % str(e))
@@ -322,7 +322,8 @@ class RemoteDB(DbBase):
                 self.output.warn('Failed to update the overlay list from: '
                          + url + '\nError was:\n' + str(error))
             else:
-                self.output.info('Fetching new list...')
+                self.output.info('Fetching new list... %s' % url, 4)
+                self.output.info('Last-modified: %s' % timestamp, 4)
                 # Fetch the remote list
                 olist = connection.read()
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-01  0:53 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-01  0:53 UTC (permalink / raw
  To: gentoo-commits

commit:     fa6bee894b2259941b2ca233fee1c07fed487d73
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun May  1 00:53:35 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun May  1 00:53:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fa6bee89

Add the timestamp and url to the RemoteDB.cache() outputs.

---
 layman/db.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 3498223..6f79e26 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -300,8 +300,8 @@ class RemoteDB(DbBase):
 
             if os.path.exists(tpath):
                 with open(tpath,'r') as previous:
-                    last_time = previous.read()
-                request.add_header('If-Modified-Since', last_time)
+                    timestamp = previous.read()
+                request.add_header('If-Modified-Since', timestamp)
 
             if not self.check_path([mpath]):
                 continue
@@ -313,6 +313,7 @@ class RemoteDB(DbBase):
                 if e.getcode() == 304:
                     self.output.info('Remote list already up to date: %s'
                         % url)
+                    self.output.info('Last-modified: %s' % timestamp)
                 else:
                     self.output.info('RemoteDB.cache(); HTTPError was:\n %s'
                         % str(e))



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-05-01  0:26 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-05-01  0:26 UTC (permalink / raw
  To: gentoo-commits

commit:     d1520e65968d61eb100133ab1248e00bc79ac3e9
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun May  1 00:26:06 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun May  1 00:26:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d1520e65

fix the wrong return value for sync() move an ouptut to .debug

---
 layman/api.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index b71dd72..7e4ad0e 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -367,7 +367,7 @@ class LaymanAPI(object):
 
         self.sync_results = (success, warnings, fatals)
 
-        return fatals != []
+        return fatals == []
 
 
     def fetch_remote_list(self):
@@ -387,8 +387,8 @@ class LaymanAPI(object):
 
     def get_available(self, dbreload=False):
         """returns the list of available overlays"""
-        self.output.info('LaymanAPI.get_available() dbreload = %s'
-            % str(dbreload))
+        self.output.debug('LaymanAPI.get_available() dbreload = %s'
+            % str(dbreload), 8)
         if self._available_ids is None or dbreload:
             self._available_ids = self._get_remote_db(dbreload).list_ids()
         return self._available_ids[:] or ['None']



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-30 22:37 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-30 22:37 UTC (permalink / raw
  To: gentoo-commits

commit:     fcd35daad6e84fdaab69f4bd0c969b80daee590d
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Apr 30 22:36:54 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 30 22:36:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fcd35daa

Add checks and code to fetch the new list using 'If-Modified-Since' protocol.
adds saving the 'last-modified' date of the same filename with a .timestamp extension.

---
 layman/api.py |   39 +++++++++++++++------------
 layman/db.py  |   80 ++++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 84 insertions(+), 35 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index cbb9d99..b71dd72 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -120,7 +120,7 @@ class LaymanAPI(object):
                 self._error(ERROR_INTERNAL_ERROR,
                         "Failed to disable repository '"+ovl+"':\n"+str(e))
                 results.append(False)
-            self.get_installed(reload=True)
+            self.get_installed(dbreload=True)
         if False in results:
             return False
         return True
@@ -151,7 +151,7 @@ class LaymanAPI(object):
                 self._error(ERROR_INTERNAL_ERROR,
                         "Failed to enable repository '"+ovl+"' : "+str(e))
                 results.append(False)
-            self.get_installed(reload=True)
+            self.get_installed(dbreload=True)
         if False in results:
             return False
         return True
@@ -373,47 +373,52 @@ class LaymanAPI(object):
     def fetch_remote_list(self):
         """Fetches the latest remote overlay list"""
         try:
-            self._get_remote_db().cache()
+            dbreload = self._get_remote_db().cache()
+            self.output.debug(
+                'LaymanAPI.fetch_remote_list(); cache updated = %s'
+                % str(dbreload),8)
         except Exception as error:
             self._error('Failed to fetch overlay list!\n Original Error was: '
                     + str(error))
             return False
-        self.get_available(reload=True)
+        self.get_available(dbreload)
         return True
 
 
-    def get_available(self, reload=False):
+    def get_available(self, dbreload=False):
         """returns the list of available overlays"""
-        if self._available_ids is None or reload:
-            self._available_ids = self._get_remote_db(reload).list_ids()
+        self.output.info('LaymanAPI.get_available() dbreload = %s'
+            % str(dbreload))
+        if self._available_ids is None or dbreload:
+            self._available_ids = self._get_remote_db(dbreload).list_ids()
         return self._available_ids[:] or ['None']
 
 
-    def get_installed(self, reload=False):
+    def get_installed(self, dbreload=False):
         """returns the list of installed overlays"""
-        if self._installed_ids is None or reload:
-            self._installed_ids = self._get_installed_db(reload).list_ids()
+        if self._installed_ids is None or dbreload:
+            self._installed_ids = self._get_installed_db(dbreload).list_ids()
         return self._installed_ids[:]
 
 
-    def _get_installed_db(self, reload=False):
+    def _get_installed_db(self, dbreload=False):
         """returns the list of installed overlays"""
-        if not self._installed_db or reload:
+        if not self._installed_db or dbreload:
             self._installed_db = DB(self.config)
         return self._installed_db
 
 
-    def _get_remote_db(self, reload=False):
+    def _get_remote_db(self, dbreload=False):
         """returns the list of installed overlays"""
-        if self._available_db is None or reload:
+        if self._available_db is None or dbreload:
             self._available_db = RemoteDB(self.config)
         return self._available_db
 
 
     def reload(self):
         """reloads the installed and remote db's to the data on disk"""
-        result = self.get_available(reload=True)
-        result = self.get_installed(reload=True)
+        result = self.get_available(dbreload=True)
+        result = self.get_installed(dbreload=True)
 
 
     def _error(self, message):
@@ -423,7 +428,7 @@ class LaymanAPI(object):
         """
         self._error_messages.append(message)
         if self.report_errors:
-            print(message, file=stderr)
+            print(message, file=self.config['stderr'])
 
 
     def get_errors(self):

diff --git a/layman/db.py b/layman/db.py
index d078e46..3498223 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -24,7 +24,9 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
 #
 #-------------------------------------------------------------------------------
 
-import os, os.path, urllib2, hashlib
+import os, os.path
+import urllib2
+import hashlib
 
 from   layman.utils             import path, delete_empty_directory
 from   layman.dbbase            import DbBase
@@ -243,7 +245,7 @@ class RemoteDB(DbBase):
 
         self.urls  = [i.strip() for i in config['overlays'].split('\n') if len(i)]
 
-        paths = [self.path(i) for i in self.urls]
+        paths = [self.filepath(i) + '.xml' for i in self.urls]
 
         if config['nocheck']:
             ignore = 2
@@ -283,22 +285,45 @@ class RemoteDB(DbBase):
         >>> a.overlays.keys()
         [u'wrobel', u'wrobel-stable']
         '''
+        has_updates = False
         for url in self.urls:
 
-            mpath = self.path(url)
+            filepath = self.filepath(url)
+            mpath = filepath + '.xml'
+            tpath = filepath + '.timestamp'
 
-            # Check for sufficient privileges
-            if os.path.exists(mpath) and not os.access(mpath, os.W_OK):
-                self.output.warn('You do not have permission to update the cache (%s).' % mpath)
-                import getpass
-                if getpass.getuser() != 'root':
-                    self.output.warn('Hint: You are not root.\n')
+            # check when the cache was last updated
+            # and don't re-fetch it unless it has changed
+            request = urllib2.Request(url)
+            opener = urllib2.build_opener()
+            opener.addheaders = [('User-Agent', 'Layman-2.0-git')]
+
+            if os.path.exists(tpath):
+                with open(tpath,'r') as previous:
+                    last_time = previous.read()
+                request.add_header('If-Modified-Since', last_time)
+
+            if not self.check_path([mpath]):
                 continue
 
             try:
-
+                connection = opener.open(request)
+                timestamp = connection.headers['last-modified']
+            except urllib2.HTTPError as e:
+                if e.getcode() == 304:
+                    self.output.info('Remote list already up to date: %s'
+                        % url)
+                else:
+                    self.output.info('RemoteDB.cache(); HTTPError was:\n %s'
+                        % str(e))
+                continue
+            except IOError as error:
+                self.output.warn('Failed to update the overlay list from: '
+                         + url + '\nError was:\n' + str(error))
+            else:
+                self.output.info('Fetching new list...')
                 # Fetch the remote list
-                olist = urllib2.urlopen(url).read()
+                olist = connection.read()
 
                 # Create our storage directory if it is missing
                 if not os.path.exists(os.path.dirname(mpath)):
@@ -326,24 +351,43 @@ class RemoteDB(DbBase):
                     out_file.write(olist)
                     out_file.close()
 
+                    out_file = open(tpath, 'w')
+                    out_file.write(timestamp)
+                    out_file.close()
+
+                    has_updates = True
+
                 except Exception as error:
                     raise IOError('Failed to temporarily cache overlays list in'
                                   ' ' + mpath + '\nError was:\n' + str(error))
+        return has_updates
 
 
-            except IOError as error:
-                self.output.warn('Failed to update the overlay list from: '
-                         + url + '\nError was:\n' + str(error))
-
-    def path(self, url):
+    def filepath(self, url):
         '''Return a unique file name for the url.'''
 
         base = self.config['cache']
 
         self.output.debug('Generating cache path.', 6)
 
-        return base + '_' + hashlib.md5(url).hexdigest() + '.xml'
-
+        return base + '_' + hashlib.md5(url).hexdigest()
+
+
+    def check_path(self, paths, hint=True):
+        '''Check for sufficient privileges'''
+        self.output.debug('RemoteDB.check_path; paths = ' + str(paths), 8)
+        is_ok = True
+        for path in paths:
+            if os.path.exists(path) and not os.access(path, os.W_OK):
+                if hint:
+                    self.output.warn(
+                        'You do not have permission to update the cache (%s).'
+                        % mpath)
+                    import getpass
+                    if getpass.getuser() != 'root':
+                        self.output.warn('Hint: You are not root.\n')
+                is_ok = False
+        return is_ok
 
 #===============================================================================
 #



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-30 22:37 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-30 22:37 UTC (permalink / raw
  To: gentoo-commits

commit:     cfa618287cf94f5ba4b295aeadf8168e90374533
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Apr 30 22:37:21 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 30 22:37:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=cfa61828

improve the output a bit.

---
 layman/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index c8093c3..5618d49 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -197,7 +197,7 @@ class Main(object):
         self.output.info("Fetching remote list,...", 2)
         result = self.api.fetch_remote_list()
         if result:
-            self.output.info('Ok', 2)
+            self.output.info('Fetch Ok', 2)
         else:
             errors = self.api.get_errors()
             self.output.warn('Download failed.\nError was: '



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-30  6:37 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-30  6:37 UTC (permalink / raw
  To: gentoo-commits

commit:     e3bee4b35df8cc63e84a54a512020ee895ae5dfe
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Apr 30 06:36:40 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 30 06:36:40 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e3bee4b3

Add the module and function to the error message for better tracking of the problem.

---
 layman/db.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index aaba2b7..d078e46 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -212,7 +212,8 @@ class DB(DbBase):
         result = overlay.sync(self.config['storage'], quiet)
         if result:
             raise Exception('Syncing overlay "' + overlay_name +
-                            '" returned status ' + str(result) + '!')
+                            '" returned status ' + str(result) + '!' +
+                            '\ndb.sync()')
 
 #===============================================================================
 #



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-30  6:37 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-30  6:37 UTC (permalink / raw
  To: gentoo-commits

commit:     b44b5484afd1386a17021cee2922b1330ece5f63
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Apr 30 06:32:38 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 30 06:32:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b44b5484

Add empty add, sync and postsync options to the defaults so they are defined.
Fixes sync not working due to the addition of them in the code.

---
 layman/config.py |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 1645a3c..809ca8f 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -73,7 +73,7 @@ class BareConfig(object):
         ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command',
         'git_command', 'local_list', 'make_conf', 'mercurial_command',
         'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage',
-        'svn_command', 'tar_command', 'umask', 'width']
+        'svn_command', 'tar_command', 'umask', 'width', ...]
         '''
         self._defaults = {'config'    : '/etc/layman/layman.cfg',
                     'storage'   : '/var/lib/layman',
@@ -95,7 +95,31 @@ class BareConfig(object):
                     'rsync_command': '/usr/bin/rsync',
                     'svn_command': '/usr/bin/svn',
                     'tar_command': '/bin/tar',
-                    'T/F_options': ['nocheck']
+                    'T/F_options': ['nocheck'],
+                    'bzr_addopts' : '',
+                    'bzr_syncopts' : '',
+                    'cvs_addopts' : '',
+                    'cvs_syncopts' : '',
+                    'darcs_addopts' : '',
+                    'darcs_syncopts' : '',
+                    'git_addopts' : '',
+                    'git_syncopts' : '',
+                    'mercurial_addopts' : '',
+                    'mercurial_syncopts' : '',
+                    'rsync_syncopts' : '',
+                    'svn_addopts' : '',
+                    'svn_syncopts' : '',
+                    'g-common_generateopts' : '',
+                    'g-common_syncopts' : '',
+                    'bzr_postsync' : '',
+                    'cvs_postsync' : '',
+                    'darcs_postsync' : '',
+                    'git_postsync' : '',
+                    'mercurial_postsync' : '',
+                    'rsync_postsync' : '',
+                    'svn_postsync' : '',
+                    'tar_postsync' : '',
+                    'g-common_postsync' : '',
                     }
         self._options = {
                     'config': config if config else self._defaults['config'],



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     58530ac4e610f8eb9952ba8ee7ca920d400915db
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Mar 28 02:50:10 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Mar 28 02:50:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=58530ac4

fix double output for info sent to output.error() due to callback.

---
 layman/cli.py    |    5 +++--
 layman/output.py |    7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index d58c4ff..c8093c3 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -96,9 +96,12 @@ class ListPrinter(object):
         elif complain:
             # Give a reason why this is marked red if it is a verbose
             # listing
+            prev_state = self.output.block_callback
+            self.output.block_callback = True
             if self.config['verbose']:
                 self.output.error(NOT_SUPPORTED_MSG)
             self.output.error(summary)
+            self.output.block_callback = prev_state
 
 
     def short_list(self, overlay):
@@ -262,9 +265,7 @@ class Main(object):
 
         info = self.api.get_info_str(selection, local=False,
             verbose=True, width=list_printer.width)
-        #print("info =", info)
         list_printer.print_shortdict(info, complain=_complain)
-
         return info != {}
 
 

diff --git a/layman/output.py b/layman/output.py
index caccd93..06161ca 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -49,6 +49,7 @@ class MessageBase(object):
         # callback function that gets passed any error messages
         # that have shown up.
         self.error_callback = error_callback
+        self.block_callback = False
 
 
     def _color (self, col, text):
@@ -81,7 +82,7 @@ class MessageBase(object):
         """runs the error_callback function with the error
         that occurred
         """
-        if self.error_callback:
+        if self.error_callback is not None and not self.block_callback:
             self.error_callback(error)
 
 
@@ -135,7 +136,7 @@ class Message(MessageBase):
 
         lines = message.split('\n')
 
-        if not lines:
+        if not len(lines):
             return
 
         for i in lines[0:-1]:
@@ -179,7 +180,7 @@ class Message(MessageBase):
             # stay in nice order.  This is a workaround for calls like
             # "layman -L |& less".
             sys.stdout.flush()
-            print(self.color_func('red', '* ') + i, file=self.error_out)
+            print(self.color_func('red', '* ') + i, file=self.std_out)
             self.error_out.flush()
         self.do_error_callback(error)
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     0cd786b5d016d3b08dc8dbb1843ed04b5ce910a0
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Mar 27 06:37:19 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 06:37:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0cd786b5

fix a missed change in error handling.

---
 layman/api.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 9178dbe..11fef62 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -421,10 +421,9 @@ class LaymanAPI(object):
         defaults to stderr.  This method may be removed, is here for now
         due to code taken from the packagekit backend.
         """
-        #msg = "Error: %d," % num, message
         self._error_messages.append(message)
         if self.report_errors:
-            print(msg, file=stderr)
+            print(message, file=stderr)
 
 
     def get_errors(self):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     e14906b88ec2da99dba82d565d88ed5ca1d40099
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Mar 27 03:24:26 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 03:24:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e14906b8

migrate to print()

---
 layman/api.py     |   10 +++++---
 layman/cli.py     |   22 ++++++++++---------
 layman/dbbase.py  |    6 +++-
 layman/debug.py   |   59 +++++++++++++++++++++++++++-------------------------
 layman/output.py  |   15 +++++++------
 layman/version.py |    4 ++-
 6 files changed, 64 insertions(+), 52 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 75d0c10..9dfb1a3 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -13,6 +13,8 @@
 #              Brian Dolbec <dol-sen@sourceforge.net>
 #
 
+from __future__ import print_function
+
 from sys import stderr
 import os
 
@@ -248,10 +250,10 @@ class LaymanAPI(object):
                 continue
             try:
                 overlay = db.select(ovl)
-                #print "overlay = ", ovl
-                #print "!!!", overlay
+                #print("overlay = ", ovl)
+                #print("!!!", overlay)
             except UnknownOverlayException, error:
-                #print "ERRORS", str(error)
+                #print("ERRORS", str(error))
                 self._error(error)
                 result[ovl] = ('', False, False)
             else:
@@ -422,7 +424,7 @@ class LaymanAPI(object):
         #msg = "Error: %d," % num, message
         self._error_messages.append(message)
         if self.report_errors:
-            print >>stderr, msg
+            print(msg, file=stderr)
 
 
     def get_errors(self):

diff --git a/layman/cli.py b/layman/cli.py
index 8f94f4a..1187ef2 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -19,6 +19,8 @@
 #
 ''' Provides the command line actions that can be performed by layman.'''
 
+from __future__ import print_function
+
 __version__ = "$Id: cli.py 2011-01-15 23:52 PST Brian Dolbec$"
 
 
@@ -48,27 +50,27 @@ class ListPrinter(object):
             self.my_lister = self.short_list
 
     def print_shortdict(self, info, complain):
-        #print "ListPrinter.print_shortdict()",info, "\n\n"
+        #print("ListPrinter.print_shortdict()",info, "\n\n")
         overlays = sorted(info)
-        #print "ids =======>", overlays, "\n"
+        #print("ids =======>", overlays, "\n")
         for ovl in overlays:
             overlay = info[ovl]
-            #print "overlay =", overlay
+            #print("overlay =", overlay)
             summary, supported, official = overlay
             self.print_overlay(summary, supported, official, complain)
 
     def print_shortlist(self, info, complain):
-        #print "ListPrinter.print_shortlist()",info
+        #print("ListPrinter.print_shortlist()",info)
         for summary, supported, official in info:
             self.print_overlay(summary, supported, official, complain)
 
 
     def print_fulldict(self, info, complain):
         ids = sorted(info)
-        #print "ids =======>", ids, "\n"
+        #print("ids =======>", ids, "\n")
         for ovl in ids:
             overlay = info[ovl]
-            #print overlay
+            #print(overlay)
             self.print_overlay(self.my_lister(overlay),
                                overlay['supported'],
                                overlay['official'],
@@ -101,7 +103,7 @@ class ListPrinter(object):
 
     def short_list(self, overlay):
         '''
-        >>> print short_list(overlay)
+        >>> print(short_list(overlay))
         wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
         '''
         name   = pad(overlay['name'], 25)
@@ -127,7 +129,7 @@ class Main(object):
 
     def __init__(self, config):
         self.config = config
-        #print "config.keys()", config.keys()
+        #print("config.keys()", config.keys())
         self.output = config['output']
         self.api = LaymanAPI(config,
                              report_errors=True,
@@ -260,7 +262,7 @@ class Main(object):
 
         info = self.api.get_info_str(selection, local=False,
             verbose=True, width=list_printer.width)
-        #print "info =", info
+        #print("info =", info)
         list_printer.print_shortdict(info, complain=_complain)
 
         return info != {}
@@ -284,7 +286,7 @@ class Main(object):
     def ListLocal(self):
         ''' Lists the local overlays.
         '''
-        #print "ListLocal()"
+        #print("ListLocal()")
         self.output.debug('Printing installed overlays.', 6)
         list_printer = ListPrinter(self.config)
 

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 776a90f..02aeb9d 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -20,6 +20,8 @@
 #
 '''Main handler for overlays.'''
 
+from __future__ import print_function
+
 __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
 
 #===============================================================================
@@ -240,7 +242,7 @@ class DbBase:
         >>> config = {'svn_command': '/usr/bin/svn', 'rsync_command':'/usr/bin/rsync'}
         >>> a = DbBase([here + '/tests/testfiles/global-overlays.xml', ], config)
         >>> for i in a.list(True):
-        ...     print i[0]
+        ...     print(i[0])
         wrobel
         ~~~~~~
         Source  : https://overlays.gentoo.org/svn/dev/wrobel
@@ -263,7 +265,7 @@ class DbBase:
         <BLANKLINE>
 
         >>> for i in a.list(False, 80):
-        ...     print i[0]
+        ...     print(i[0])
         wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
         wrobel-stable             [Rsync     ] (rsync://gunnarwrobel.de/wrobel-stable)
         '''

diff --git a/layman/debug.py b/layman/debug.py
index f5c247b..ab04f40 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -6,6 +6,8 @@
 # Copyright 2005 - 2008 Gunnar Wrobel
 # Distributed under the terms of the GNU General Public License v2
 
+from __future__ import print_function
+
 __version__ = "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $"
 
 #################################################################################
@@ -101,7 +103,7 @@ class DebugMessage(Message):
 
     def cli_opts(self, parser):
 
-        #print "Parsing debug opts"
+        #print("Parsing debug opts")
 
         group = OptionGroup(parser,
                             '<Debugging options>',
@@ -327,11 +329,11 @@ class DebugMessage(Message):
             if lines > 0:
                 for j in range(lines):
                     ## Print line with continuation marker
-                    print >> self.debug_out, ls + '// ' + x[0:60] + ' \\'
+                    print(ls + '// ' + x[0:60] + ' \\', file=self.debug_out)
                     ## Remove printed characters from output
                     x = x[60:]
             ## Print final line
-            print >> self.debug_out, ls + '// ' + x
+            print(ls + '// ' + x, file=self.debug_out)
 
         if self.debug_vrb == 1:
             # Top line indicates class and method
@@ -340,60 +342,61 @@ class DebugMessage(Message):
                 c += 'Class: ' + str(callerobject.__class__.__name__) + ' | '
             if callermethod:
                 c += 'Method: ' + str(callermethod)
-            print >> self.debug_out, '// ' + c
+            print('// ' + c, file=self.debug_out)
             # Selected variables follow
             if callerlocals:
                 for i,j in callerlocals.items():
-                    print >> self.debug_out, '// '                              \
-                          + self.maybe_color('turquoise', str(i)) + ':' + str(j)
+                    print('// ' + self.maybe_color('turquoise',
+                        str(i)) + ':' + str(j), file=self.debug_out)
             # Finally the message
-            print >> self.debug_out, self.maybe_color('yellow', message)
+            print(self.maybe_color('yellow', message), file=self.debug_out)
             return
 
         if self.debug_vrb == 3:
-            print >> self.debug_out, ls + '/////////////////////////////////' + \
-                  '////////////////////////////////'
+            print(ls + '/////////////////////////////////' + \
+                  '////////////////////////////////', file=self.debug_out)
 
             # General information about what is being debugged
             #(module name or similar)
-            print >> self.debug_out, ls + '// ' + self.debug_env
-        print >> self.debug_out, ls + '//-----------------------------------' + \
-              '----------------------------'
+            print(ls + '// ' + self.debug_env, file=self.debug_out)
+        print(ls + '//-----------------------------------' + \
+              '----------------------------', file=self.debug_out)
 
         ## If the caller is a class print the name here
         if callerobject:
-            print >> self.debug_out, ls +                                       \
-                  '// Object Class: ' + str(callerobject.__class__.__name__)
+            print(ls + '// Object Class: ' +
+                str(callerobject.__class__.__name__), file=self.debug_out)
 
         ## If the method has been extracted print it here
         if callermethod:
-            print >> self.debug_out, ls + '// '                                 \
-                  + self.maybe_color('green', 'Method: ') + str(callermethod)
+            print(ls + '// ' + self.maybe_color('green', 'Method: ')
+                + str(callermethod), file=self.debug_out)
             if self.debug_vrb == 3:
-                print >> self.debug_out, ls + '//---------------------------' + \
-                      '------------------------------------'
+                print(ls + '//---------------------------' + \
+                    '------------------------------------', file=self.debug_out)
 
         ## Print the information on all available local variables
         if callerlocals:
             if self.debug_vrb == 3:
-                print >> self.debug_out, ls + '//'
-                print >> self.debug_out, ls + '// VALUES '
+                print(ls + '//', file=self.debug_out)
+                print(ls + '// VALUES ', file=self.debug_out)
             for i,j in callerlocals.items():
-                print >> self.debug_out, ls + '// ------------------> '         \
-                      + self.maybe_color('turquoise', str(i)) + ':'
+                print(ls + '// ------------------> '         \
+                      + self.maybe_color('turquoise', str(i)) + ':',
+                      file=self.debug_out)
                 breaklines(str(j))
             if self.debug_vrb == 3:
-                print >> self.debug_out, ls + '//------------------------------'\
-                      '---------------------------------'
+                print(ls + '//------------------------------'\
+                      '---------------------------------', file=self.debug_out)
 
         # Finally print the message
         breaklines(self.maybe_color('yellow', message))
 
         if self.debug_vrb == 3:
-            print >> self.debug_out, ls + '//-------------------------------' + \
-                  '--------------------------------'
-            print >> self.debug_out, ls + '/////////////////////////////////' + \
-                  '////////////////////////////////'
+            print(ls + '//-------------------------------' + \
+                  '--------------------------------', file=self.debug_out)
+            print(ls + '/////////////////////////////////' + \
+                  '////////////////////////////////', file=self.debug_out)
 
 ## gloabal message handler
 OUT = Message('layman')

diff --git a/layman/output.py b/layman/output.py
index 469f673..caccd93 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -6,6 +6,7 @@
  Distributed under the terms of the GNU General Public License v2
 """
 
+from __future__ import print_function
 
 __version__ = "0.1"
 
@@ -112,7 +113,7 @@ class Message(MessageBase):
 
 
     def notice (self, note):
-        print >> self.std_out, note
+        print(note, file=self.std_out)
 
 
     def info (self, info, level = INFO_LEVEL):
@@ -124,7 +125,7 @@ class Message(MessageBase):
             return
 
         for i in info.split('\n'):
-            print  >> self.std_out, self.color_func('green', '* ') + i
+            print(self.color_func('green', '* ') + i, file=self.std_out)
 
 
     def status (self, message, status, info = 'ignored'):
@@ -138,7 +139,7 @@ class Message(MessageBase):
             return
 
         for i in lines[0:-1]:
-            print  >> self.std_out, self.color_func('green', '* ') + i
+            print(self.color_func('green', '* ') + i, file=self.std_out)
 
         i = lines[-1]
 
@@ -152,8 +153,8 @@ class Message(MessageBase):
         else:
             result = '[' + self.color_func('yellow', info) + ']'
 
-        print  >> self.std_out, self.color_func('green', '* ') + i + ' ' + \
-            '.' * (58 - len(i)) + ' ' + result
+        print(self.color_func('green', '* ') + i + ' ' + \
+            '.' * (58 - len(i)) + ' ' + result, file=self.std_out)
 
 
     def warn (self, warn, level = WARN_LEVEL):
@@ -165,7 +166,7 @@ class Message(MessageBase):
             return
 
         for i in warn.split('\n'):
-            print  >> self.std_out, self.color_func('yellow', '* ') + i
+            print(self.color_func('yellow', '* ') + i, file=self.std_out)
 
 
     def error (self, error):
@@ -178,7 +179,7 @@ class Message(MessageBase):
             # stay in nice order.  This is a workaround for calls like
             # "layman -L |& less".
             sys.stdout.flush()
-            print >> self.error_out, self.color_func('red', '* ') + i
+            print(self.color_func('red', '* ') + i, file=self.error_out)
             self.error_out.flush()
         self.do_error_callback(error)
 

diff --git a/layman/version.py b/layman/version.py
index 5d7a73d..02750c5 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -17,10 +17,12 @@
 #             Sebastian Pipping <sebastian@pipping.org>
 #
 
+from __future__ import print_function
+
 __version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
 
 
 VERSION = '1.4.2'
 
 if __name__ == '__main__':
-    print VERSION
+    print(VERSION)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     34d7a5444ee72a7b6ca9193c2dc5975d0b894a8a
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Mar 27 07:13:32 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 07:13:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=34d7a544

migrate to print()

---
 layman/argsparser.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index ff7f8f7..708b1f8 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -20,6 +20,8 @@
 #
 '''Defines the configuration options and provides parsing functionality.'''
 
+from __future__ import print_function
+
 __version__ = "$Id: config.py 286 2007-01-09 17:48:23Z wrobel $"
 
 #===============================================================================
@@ -227,7 +229,7 @@ class ArgsParser(BareConfig):
         # Parse the command line first since we need to get the config
         # file option.
         if len(args) == 1:
-            print 'Usage:%s' % _USAGE
+            print('Usage:%s' % _USAGE)
             sys.exit(0)
 
         (self.options, remain_args) = self.parser.parse_args(args)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     336d0c4b675dff698455cc9df91b71de78347fa7
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 07:17:06 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=336d0c4b

make add_from_dict() private.

---
 layman/dbbase.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 7b0a26a..776a90f 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -168,12 +168,12 @@ class DbBase:
             self.output.info("DbBase: add_new() from_dict")
             if isinstance(from_dict, dict):
                 from_dict = [from_dict]
-            self.add_from_dict(from_dict)
+            self._add_from_dict(from_dict)
 
         return
 
 
-    def add_from_dict(self, overlays=None):
+    def _add_from_dict(self, overlays=None):
         """Add a new overlay from a list of dictionary values
         """
         self.output.info("DbBase: add_from_dict()")



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     50833d06b407b6028d6b6ec66e938bc26cc23141
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Fri Mar 18 04:17:23 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=50833d06

remove no longer used action.py

---
 layman/action.py |  570 ------------------------------------------------------
 1 files changed, 0 insertions(+), 570 deletions(-)

diff --git a/layman/action.py b/layman/action.py
deleted file mode 100644
index 7199054..0000000
--- a/layman/action.py
+++ /dev/null
@@ -1,570 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#################################################################################
-# LAYMAN ACTIONS
-#################################################################################
-# File:       action.py
-#
-#             Handles layman actions.
-#
-# Copyright:
-#             (c) 2005 - 2008 Gunnar Wrobel
-#             Distributed under the terms of the GNU General Public License v2
-#
-# Author(s):
-#             Gunnar Wrobel <wrobel@gentoo.org>
-#
-''' Provides the different actions that can be performed by layman.'''
-
-__version__ = "$Id: action.py 312 2007-04-09 19:45:49Z wrobel $"
-
-#===============================================================================
-#
-# Dependencies
-#
-#-------------------------------------------------------------------------------
-
-import os, sys
-
-from   layman.dbbase            import UnknownOverlayException
-from   layman.db                import DB, RemoteDB
-from   layman.utils             import path, delete_empty_directory
-from   layman.debug             import OUT
-
-#===============================================================================
-#
-# Class Fetch
-#
-#-------------------------------------------------------------------------------
-
-class Fetch:
-    ''' Fetches the overlay listing.
-
-    >>> import os
-    >>> here = os.path.dirname(os.path.realpath(__file__))
-    >>> cache = os.tmpnam()
-    >>> config = {'overlays' :
-    ...           'file://' + here + '/tests/testfiles/global-overlays.xml',
-    ...           'cache' : cache,
-    ...           'nocheck'    : True,
-    ...           'proxy' : None,
-    ...           'quietness':3,
-    ...           'svn_command':'/usr/bin/svn',
-    ...           'rsync_command':'/usr/bin/rsync'}
-    >>> a = Fetch(config)
-    >>> a.run()
-    0
-    >>> b = open(a.db.path(config['overlays']))
-    >>> b.readlines()[24]
-    '      A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n'
-
-    >>> b.close()
-    >>> os.unlink(a.db.path(config['overlays']))
-
-    >>> a.db.overlays.keys()
-    [u'wrobel', u'wrobel-stable']
-    '''
-
-    def __init__(self, config):
-        self.db = RemoteDB(config, ignore_init_read_errors=True)
-
-    def run(self):
-        '''Fetch the overlay listing.'''
-        try:
-            self.db.cache()
-        except Exception, error:
-            OUT.die('Failed to fetch overlay list!\nError was: '
-                    + str(error))
-
-        return 0
-
-#===============================================================================
-#
-# Class Sync
-#
-#-------------------------------------------------------------------------------
-
-class Sync:
-    ''' Syncs the selected overlays.'''
-
-    def __init__(self, config):
-
-        self.db = DB(config)
-
-        self.rdb = RemoteDB(config)
-
-        self.quiet = int(config['quietness']) < 3
-
-        self.selection = config['sync']
-
-        if config['sync_all'] or 'ALL' in self.selection:
-            self.selection = self.db.overlays.keys()
-
-        enc = sys.getfilesystemencoding()
-        if enc:
-            self.selection = [i.decode(enc) for i in self.selection]
-
-    def run(self):
-        '''Synchronize the overlays.'''
-
-        OUT.debug('Updating selected overlays', 6)
-
-        fatals = []
-        warnings = []
-        success  = []
-        for i in self.selection:
-            try:
-                odb = self.db.select(i)
-            except UnknownOverlayException, error:
-                fatals.append(str(error))
-                continue
-
-            try:
-                ordb = self.rdb.select(i)
-            except UnknownOverlayException:
-                warnings.append(\
-                    'Overlay "%s" could not be found in the remote lists.\n'
-                    'Please check if it has been renamed and re-add if necessary.' % i)
-            else:
-                current_src = odb.sources[0].src
-                available_srcs = set(e.src for e in ordb.sources)
-                if ordb and odb and not current_src in available_srcs:
-                    if len(available_srcs) == 1:
-                        plural = ''
-                        candidates = '  %s' % tuple(available_srcs)[0]
-                    else:
-                        plural = 's'
-                        candidates = '\n'.join(('  %d. %s' % (i + 1, v)) for i, v in enumerate(available_srcs))
-
-                    warnings.append(
-                        'The source of the overlay "%(repo_name)s" seems to have changed.\n'
-                        'You currently sync from\n'
-                        '\n'
-                        '  %(current_src)s\n'
-                        '\n'
-                        'while the remote lists report\n'
-                        '\n'
-                        '%(candidates)s\n'
-                        '\n'
-                        'as correct location%(plural)s.\n'
-                        'Please consider removing and re-adding the overlay.' % {
-                            'repo_name':i,
-                            'current_src':current_src,
-                            'candidates':candidates,
-                            'plural':plural,
-                            })
-
-            try:
-                self.db.sync(i, self.quiet)
-                success.append('Successfully synchronized overlay "' + i + '".')
-            except Exception, error:
-                fatals.append(
-                    'Failed to sync overlay "' + i + '".\nError was: '
-                    + str(error))
-
-        if success:
-            OUT.info('\nSuccess:\n------\n', 3)
-            for i in success:
-                OUT.info(i, 3)
-
-        if warnings:
-            OUT.warn('\nWarnings:\n------\n', 2)
-            for i in warnings:
-                OUT.warn(i + '\n', 2)
-
-        if fatals:
-            OUT.error('\nErrors:\n------\n')
-            for i in fatals:
-                OUT.error(i + '\n')
-            return 1
-
-        return 0
-
-#===============================================================================
-#
-# Class Add
-#
-#-------------------------------------------------------------------------------
-
-class Add:
-    ''' Adds the selected overlays.'''
-
-    def __init__(self, config):
-
-        self.config = config
-
-        self.db = DB(config)
-
-        self.rdb = RemoteDB(config)
-
-        self.quiet = int(config['quietness']) < 3
-
-        self.selection = config['add']
-
-        enc = sys.getfilesystemencoding()
-        if enc:
-            self.selection = [i.decode(enc) for i in self.selection]
-
-        if 'ALL' in self.selection:
-            self.selection = self.rdb.overlays.keys()
-
-    def run(self):
-        '''Add the overlay.'''
-
-        OUT.debug('Adding selected overlays', 6)
-
-        result = 0
-
-        for i in self.selection:
-            try:
-                overlay = self.rdb.select(i)
-            except UnknownOverlayException, error:
-                OUT.warn(str(error), 2)
-                result = 1
-            else:
-                OUT.debug('Selected overlay', 7)
-                try:
-                    self.db.add(overlay, self.quiet)
-                    OUT.info('Successfully added overlay "' + i + '".', 2)
-                except Exception, error:
-                    OUT.warn('Failed to add overlay "' + i + '".\nError was: '
-                             + str(error), 2)
-                    result = 1
-
-        return result
-
-#===============================================================================
-#
-# Class Delete
-#
-#-------------------------------------------------------------------------------
-
-class Delete:
-    ''' Deletes the selected overlays.'''
-
-    def __init__(self, config):
-
-        self.db = DB(config)
-
-        self.selection = config['delete']
-
-        enc = sys.getfilesystemencoding()
-        if enc:
-            self.selection = [i.decode(enc) for i in self.selection]
-
-        if 'ALL' in self.selection:
-            self.selection = self.db.overlays.keys()
-
-    def run(self):
-        '''Delete the overlay.'''
-
-        OUT.debug('Deleting selected overlays', 6)
-
-        result = 0
-
-        for i in self.selection:
-            try:
-                overlay = self.db.select(i)
-            except UnknownOverlayException, error:
-                OUT.warn(str(error), 2)
-
-                mdir = path([self.db.config['storage'], i])
-                delete_empty_directory(mdir)
-
-                result = 1
-            else:
-                OUT.debug('Selected overlay', 7)
-                try:
-                    self.db.delete(overlay)
-                    OUT.info('Successfully deleted overlay "' + i + '".', 2)
-                except Exception, error:
-                    OUT.warn('Failed to delete overlay "' + i + '".\nError was: '
-                             + str(error), 2)
-                    result = 1
-
-        return result
-
-#===============================================================================
-#
-# Class Info
-#
-#-------------------------------------------------------------------------------
-
-class Info:
-    ''' Print information about the specified overlays.
-
-    >>> import os
-    >>> here = os.path.dirname(os.path.realpath(__file__))
-    >>> cache = os.tmpnam()
-    >>> config = {'overlays' :
-    ...           'file://' + here + '/tests/testfiles/global-overlays.xml',
-    ...           'cache'  : cache,
-    ...           'proxy'  : None,
-    ...           'info'   : ['wrobel'],
-    ...           'nocheck'    : False,
-    ...           'verbose': False,
-    ...           'quietness':3,
-    ...           'svn_command':'/usr/bin/svn',
-    ...           'rsync_command':'/usr/bin/rsync'}
-    >>> a = Info(config)
-    >>> a.rdb.cache()
-    >>> OUT.color_off()
-    >>> a.run()
-    * wrobel
-    * ~~~~~~
-    * Source  : https://overlays.gentoo.org/svn/dev/wrobel
-    * Contact : nobody@gentoo.org
-    * Type    : Subversion; Priority: 10
-    * Quality : experimental
-    *
-    * Description:
-    *   Test
-    *
-    0
-    '''
-
-    def __init__(self, config):
-
-        OUT.debug('Creating RemoteDB handler', 6)
-
-        self.rdb    = RemoteDB(config)
-        self.config = config
-
-        self.selection = config['info']
-
-        enc = sys.getfilesystemencoding()
-        if enc:
-            self.selection = [i.decode(enc) for i in self.selection]
-
-        if 'ALL' in self.selection:
-            self.selection = self.rdb.overlays.keys()
-
-    def run(self):
-        ''' Print information about the selected overlays.'''
-
-        result = 0
-
-        for i in self.selection:
-            try:
-                overlay = self.rdb.select(i)
-            except UnknownOverlayException, error:
-                OUT.warn(str(error), 2)
-                result = 1
-            else:
-                # Is the overlay supported?
-                OUT.info(overlay.__str__(), 1)
-                if not overlay.is_official():
-                    OUT.warn('*** This is no official gentoo overlay ***\n', 1)
-                if not overlay.is_supported():
-                    OUT.error('*** You are lacking the necessary tools to install t'
-                              'his overlay ***\n')
-
-        return result
-
-#===============================================================================
-#
-# Class List
-#
-#-------------------------------------------------------------------------------
-
-class List(object):
-    def __init__(self, config, db):
-        self.config = config
-        self.db = db
-
-    def _run(self, complain):
-        for summary, supported, official \
-                in self.db.list(None, self.config['verbose'], self.config['width']):
-            # Is the overlay supported?
-            if supported:
-                # Is this an official overlay?
-                if official:
-                    OUT.info(summary, 1)
-                # Unofficial overlays will only be listed if we are not
-                # checking or listing verbose
-                elif complain:
-                    # Give a reason why this is marked yellow if it is a verbose
-                    # listing
-                    if self.config['verbose']:
-                        OUT.warn('*** This is no official gentoo overlay ***\n', 1)
-                    OUT.warn(summary, 1)
-            # Unsupported overlays will only be listed if we are not checking
-            # or listing verbose
-            elif complain:
-                # Give a reason why this is marked red if it is a verbose
-                # listing
-                if self.config['verbose']:
-                    OUT.error('*** You are lacking the necessary tools '
-                              'to install this overlay ***\n')
-                OUT.error(summary)
-
-
-#===============================================================================
-#
-# Class ListRemote
-#
-#-------------------------------------------------------------------------------
-
-class ListRemote(List):
-    ''' Lists the available overlays.
-
-    >>> import os
-    >>> here = os.path.dirname(os.path.realpath(__file__))
-    >>> cache = os.tmpnam()
-    >>> config = {'overlays' :
-    ...           'file://' + here + '/tests/testfiles/global-overlays.xml',
-    ...           'cache'  : cache,
-    ...           'proxy'  : None,
-    ...           'nocheck'    : False,
-    ...           'verbose': False,
-    ...           'quietness':3,
-    ...           'width':80,
-    ...           'svn_command':'/usr/bin/svn',
-    ...           'rsync_command':'/usr/bin/rsync'}
-    >>> a = ListRemote(config)
-    >>> a.db.cache()
-    >>> OUT.color_off()
-    >>> a.run()
-    * wrobel                    [Subversion] (https://o.g.o/svn/dev/wrobel         )
-    0
-    >>> a.config['verbose'] = True
-    >>> a.run()
-    * wrobel
-    * ~~~~~~
-    * Source  : https://overlays.gentoo.org/svn/dev/wrobel
-    * Contact : nobody@gentoo.org
-    * Type    : Subversion; Priority: 10
-    * Quality : experimental
-    *
-    * Description:
-    *   Test
-    *
-    * *** This is no official gentoo overlay ***
-    *
-    * wrobel-stable
-    * ~~~~~~~~~~~~~
-    * Source  : rsync://gunnarwrobel.de/wrobel-stable
-    * Contact : nobody@gentoo.org
-    * Type    : Rsync; Priority: 50
-    * Quality : experimental
-    *
-    * Description:
-    *   A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].
-    *
-    0
-    '''
-
-    def __init__(self, config):
-        OUT.debug('Creating RemoteDB handler', 6)
-        super(ListRemote, self).__init__(config, RemoteDB(config))
-
-    def run(self):
-        ''' List the available overlays.'''
-
-        OUT.debug('Printing remote overlays.', 8)
-
-        _complain = self.config['nocheck'] or self.config['verbose']
-        self._run(complain=_complain)
-
-        return 0
-
-#===============================================================================
-#
-# Class ListLocal
-#
-#-------------------------------------------------------------------------------
-
-class ListLocal(List):
-    ''' Lists the local overlays.'''
-
-    def __init__(self, config):
-        OUT.debug('Creating DB handler', 6)
-        super(ListLocal, self).__init__(config, DB(config))
-
-    def run(self):
-        '''List the overlays.'''
-
-        OUT.debug('Printing local overlays.', 8)
-
-        self._run(complain=True)
-
-        return 0
-
-#===============================================================================
-#
-# MAIN
-#
-#-------------------------------------------------------------------------------
-
-def main(config):
-    '''Dispatches to the actions the user selected. '''
-
-    # Given in order of precedence
-    actions = [('fetch',      Fetch),
-               ('add',        Add),
-               ('sync',       Sync),
-               ('info',       Info),
-               ('sync_all',   Sync),
-               ('delete',     Delete),
-               ('list',       ListRemote),
-               ('list_local', ListLocal),]
-
-    if True:  # A hack to save diff with indentation changes only
-
-        # Make fetching the overlay list a default action
-        if not 'nofetch' in config.keys():
-            # Actions that implicitely call the fetch operation before
-            fetch_actions = ['sync', 'sync_all', 'list']
-            for i in fetch_actions:
-                if i in config.keys():
-                    # Implicitely call fetch, break loop
-                    Fetch(config).run()
-                    break
-
-        result = 0
-
-        # Set the umask
-        umask = config['umask']
-        try:
-            new_umask = int(umask, 8)
-            old_umask = os.umask(new_umask)
-        except Exception, error:
-            OUT.die('Failed setting to umask "' + umask + '"!\nError was: '
-                    + str(error))
-
-        for i in actions:
-
-            OUT.debug('Checking for action', 7)
-
-            if i[0] in config.keys():
-                try:
-                    result += i[1](config).run()
-                except Exception, error:
-                    OUT.error(str(error))
-                    result = -1  # So it cannot remain 0, i.e. success
-                    break
-
-        # Reset umask
-        os.umask(old_umask)
-
-        if not result:
-            sys.exit(0)
-        else:
-            sys.exit(1)
-
-#===============================================================================
-#
-# Testing
-#
-#-------------------------------------------------------------------------------
-
-if __name__ == '__main__':
-    import doctest
-
-    # Ignore warnings here. We are just testing
-    from warnings     import filterwarnings, resetwarnings
-    filterwarnings('ignore')
-
-    doctest.testmod(sys.modules[__name__])
-
-    resetwarnings()



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     d9de33168cfe46be2e269d04ec52afe003f7ba6d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 07:42:42 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d9de3316

add being able to set the OptionConfig defaults as well

---
 layman/config.py |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index cda6fce..1645a3c 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -203,19 +203,22 @@ class BareConfig(object):
 
 class OptionConfig(BareConfig):
     """This subclasses BareCongig adding functions to make overriding
-    defaults and/or setting up options much easier via a dictionary
+    or resetting defaults and/or setting options much easier
+    by using dictionaries.
     """
 
-    def __init__(self, options=None):
+    def __init__(self, options=None, defaults=None):
         """
         @param options: dictionary of {'option': value, ...}
         @rtype OptionConfig class instance.
         """
         BareConfig.__init__(self)
 
+        self.update_defaults(defaults)
+
         self.update(options)
 
-        return self
+        return
 
     def update(self, options):
         """update the options with new values passed in via options
@@ -232,3 +235,12 @@ class OptionConfig(BareConfig):
                 options.pop('quietness')
             self._options.update(options)
         return
+
+    def update_defaults(self, new_defaults):
+        """update the options with new values passed in via options
+
+        @param options
+        """
+        if new_defaults is not None:
+            self._defaults.update(new_defaults)
+        return



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     bc8019e52ba29b30b528d31aa46180576e7d9dcb
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 06:38:03 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bc8019e5

clean out excessive use of try: except pairs

---
 layman/dbbase.py |   29 +++++++++--------------------
 1 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 53c2946..7b0a26a 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -94,10 +94,7 @@ class DbBase:
             if not os.path.exists(path):
                 continue
 
-            try:
-                self.read_file(path)
-            except Exception, error:
-                if not ignore_init_read_errors: raise error
+            self.read_file(path)
 
 
     def __eq__(self, other):
@@ -118,8 +115,10 @@ class DbBase:
             document = open(path, 'r').read()
 
         except Exception, error:
-            raise IOError('Failed to read the overlay list at ("'
-                          + path + '")!\nError was:\n' + str(error))
+            if not ignore_init_read_errors:
+                self.output.error('Failed to read the overlay list at ("'
+                    + path + '")')
+                raise error
 
         self.read(document, origin=path)
 
@@ -153,15 +152,9 @@ class DbBase:
 
         for overlay in overlays:
             self.output.debug('Parsing overlay entry', 8)
-            try:
-                ovl = Overlay(config=self.config, xml=overlay,
+            ovl = Overlay(config=self.config, xml=overlay,
                     ignore=self.ignore, quiet=self.quiet)
-            except Exception, error:
-                raise error
-                self.output.warn("DbBase(); Error creating overlay instance", 3)
-                self.output.warn("Original error was: " + str(error), 3)
-            else:
-                self.overlays[ovl.name] = ovl
+            self.overlays[ovl.name] = ovl
         return
 
 
@@ -186,13 +179,9 @@ class DbBase:
         self.output.info("DbBase: add_from_dict()")
         for overlay in overlays:
             self.output.debug('Parsing overlay entry', 8)
-            try:
-                ovl = Overlay(self.config, ovl_dict=overlay,
+            ovl = Overlay(self.config, ovl_dict=overlay,
                     ignore=self.ignore, quiet=self.quiet)
-            except Exception, error:
-                self.output.warn(str(error), 3)
-            else:
-                self.overlays[ovl.name] = ovl
+            self.overlays[ovl.name] = ovl
         return
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     fcadf2247b0982bc0449e65116bd7fd9a76bd789
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 06:14:18 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fcadf224

add a new OptionConfig subclass.
improve some debug messages.

---
 layman/config.py |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 58e222a..cda6fce 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -123,12 +123,15 @@ class BareConfig(object):
     def keys(self):
         '''Special handler for the configuration keys.
         '''
-        self._options['output'].debug('Retrieving BareConfig options', 8)
+        self._options['output'].debug(
+            'Retrieving %s options' % self.__class__.__name__, 8)
         keys = [i for i in self._options]
-        self._options['output'].debug('Retrieving BareConfig defaults', 8)
+        self._options['output'].debug(
+            'Retrieving %s defaults' % self.__class__.__name__, 8)
         keys += [i for i in self._defaults
                  if not i in keys]
-        self._options['output'].debug('Retrieving BareConfig done...', 8)
+        self._options['output'].debug(
+            'Retrieving %s done...' % self.__class__.__name__, 8)
         return keys
 
 
@@ -166,7 +169,7 @@ class BareConfig(object):
 
     def _get_(self, key):
         self._options['output'].debug(
-            'Retrieving BareConfig option: %s' % key, 8)
+            'Retrieving %s option: %s' % (self.__class__.__name__, key), 8)
         if key == 'overlays':
             overlays = ''
             if (key in self._options
@@ -197,3 +200,35 @@ class BareConfig(object):
         """
         return option.lower() in ['yes', 'true', 'y', 't']
 
+
+class OptionConfig(BareConfig):
+    """This subclasses BareCongig adding functions to make overriding
+    defaults and/or setting up options much easier via a dictionary
+    """
+
+    def __init__(self, options=None):
+        """
+        @param options: dictionary of {'option': value, ...}
+        @rtype OptionConfig class instance.
+        """
+        BareConfig.__init__(self)
+
+        self.update(options)
+
+        return self
+
+    def update(self, options):
+        """update the options with new values passed in via options
+
+        @param options
+        """
+        if options is not None:
+            keys = sorted(options)
+            if 'quiet' in keys:
+                self.set_option('quiet', options['quiet'])
+                options.pop('quiet')
+            if 'quietness' in keys and not options['quiet']:
+                self._set_quietness(options['quietness'])
+                options.pop('quietness')
+            self._options.update(options)
+        return



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     f0f43429d260c9afa4bdda394e86a9b258e29150
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 06:17:00 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f0f43429

create a new create_overlay_dict() to assist in using a python dictionary for overlay definitions

---
 layman/utils.py |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index 67a0ab7..86524ef 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -175,6 +175,31 @@ def delete_empty_directory(mdir, output=OUT):
             if getpass.getuser() != 'root':
                 output.warn('Hint: You are not root.')
 
+
+def create_overlay_dict(**kwargs):
+    """Creates a complete empty reository definition.
+    Then fills it with values passed in
+    """
+    result = {
+        'name': '',
+        'owner_name': '',
+        'owner_email': '',
+        'homepage': '',
+        'irc': '',
+        'description': '',
+        'feeds': [],
+        'sources': [('','','')],
+        'priority': 50,
+        'quality': u'experimental',
+        'status': '',
+        'official': False,
+        'supported': False,
+        }
+    for key in kwargs:
+        result[key] = kwargs[key]
+    return result
+
+
 #===============================================================================
 #
 # Testing



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     091147c6abb9bdfa814a8fc571b6cad85669fa46
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 06:13:04 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 02:39:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=091147c6

remove a few raise Exception()'s and replace them with self.output.error messages.
wrap the make_Conf in a config check.

---
 layman/db.py |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index 01dc454..ed2bb2e 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -56,10 +56,10 @@ class DB(DbBase):
         quiet = int(config['quietness']) < 3
 
         DbBase.__init__(self,
-                          [config['local_list'], ],
                           config,
-                          ignore,
-                          quiet)
+                          paths=[config['local_list'], ],
+                          ignore=ignore,
+                          quiet=quiet)
 
         self.output.debug('DB handler initiated', 6)
 
@@ -119,22 +119,30 @@ class DB(DbBase):
                     overlay.set_priority(self.config['priority'])
                 self.overlays[overlay.name] = overlay
                 self.write(self.path)
-                make_conf = MakeConf(self.config, self.overlays)
-                make_conf.add(overlay)
+                if self.config['make_config']:
+                    make_conf = MakeConf(self.config, self.overlays)
+                    make_ok = make_conf.add(overlay)
+                    return make_ok
+                return True
             else:
                 mdir = path([self.config['storage'], overlay.name])
                 delete_empty_directory(mdir, self.output)
                 if os.path.exists(mdir):
-                    raise Exception('Adding overlay "%s" failed!'
+                    self.output.error('Adding repository "%s" failed!'
                                 ' Possible remains of the operation have NOT'
                                 ' been removed and may be left at "%s".'
                                 ' Please remove them manually if required.' \
                                 % (overlay.name, mdir))
+                    return False
                 else:
-                    raise Exception('Adding overlay "%s" failed!' % overlay.name)
+                    self.output.error(
+                        'Adding repository "%s" failed!' % overlay.name)
+                    return False
         else:
-            raise Exception('Overlay "' + overlay.name + '" already in the loca'
-                            'l list!')
+            self.output.error('Repository "' + overlay.name +
+                '" already in the local (installed) list!')
+            return False
+
 
     def delete(self, overlay):
         '''
@@ -243,7 +251,8 @@ class RemoteDB(DbBase):
 
         quiet = int(config['quietness']) < 3
 
-        DbBase.__init__(self, paths, config, ignore, quiet, ignore_init_read_errors)
+        DbBase.__init__(self, config, paths=paths, ignore=ignore,
+            quiet=quiet, ignore_init_read_errors=ignore_init_read_errors)
 
     # overrider
     def _broken_catalog_hint(self):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     4c51f94ca343338c0d266fae5c5ab6500df5e258
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 24 06:10:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Feb 24 06:49:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4c51f94c

add 2 new functions, add_new & add_from_dict.
Modify the __init__ params a bit
whitespace additions between functions.

---
 layman/dbbase.py |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 5d082a0..53c2946 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -76,7 +76,9 @@ class BrokenOverlayCatalog(ValueError):
 class DbBase:
     ''' Handle a list of overlays.'''
 
-    def __init__(self, paths, config, ignore = 0, quiet = False, ignore_init_read_errors=False):
+    def __init__(self, config, paths=None, ignore = 0,
+        quiet = False, ignore_init_read_errors=False
+        ):
 
         self.config = config
         self.quiet = quiet
@@ -97,15 +99,18 @@ class DbBase:
             except Exception, error:
                 if not ignore_init_read_errors: raise error
 
+
     def __eq__(self, other):
         for key in set(self.overlays.keys() + other.overlays.keys()):
             if self.overlays[key] != other.overlays[key]:
                 return False
         return True
 
+
     def __ne__(self, other):
         return not self.__eq__(other)
 
+
     def read_file(self, path):
         '''Read the overlay definition file.'''
 
@@ -118,11 +123,13 @@ class DbBase:
 
         self.read(document, origin=path)
 
+
     def _broken_catalog_hint(self):
         this_function_name = sys._getframe().f_code.co_name
         raise NotImplementedError('Method "%s.%s" not implemented' % \
                 (self.__class__.__name__, this_function_name))
 
+
     def read(self, text, origin):
         '''
         Read an xml list of overlays (adding to and potentially overwriting existing entries)
@@ -147,11 +154,46 @@ class DbBase:
         for overlay in overlays:
             self.output.debug('Parsing overlay entry', 8)
             try:
-                ovl = Overlay(overlay, self.config, self.ignore, self.quiet)
+                ovl = Overlay(config=self.config, xml=overlay,
+                    ignore=self.ignore, quiet=self.quiet)
+            except Exception, error:
+                raise error
+                self.output.warn("DbBase(); Error creating overlay instance", 3)
+                self.output.warn("Original error was: " + str(error), 3)
+            else:
+                self.overlays[ovl.name] = ovl
+        return
+
+
+    def add_new(self, xml=None, origin=None, from_dict=None):
+        '''Reads xml text and dictionary definitions and adds
+        them to the db.
+        '''
+        if xml:
+            self.read(xml, origin)
+        if from_dict:
+            self.output.info("DbBase: add_new() from_dict")
+            if isinstance(from_dict, dict):
+                from_dict = [from_dict]
+            self.add_from_dict(from_dict)
+
+        return
+
+
+    def add_from_dict(self, overlays=None):
+        """Add a new overlay from a list of dictionary values
+        """
+        self.output.info("DbBase: add_from_dict()")
+        for overlay in overlays:
+            self.output.debug('Parsing overlay entry', 8)
+            try:
+                ovl = Overlay(self.config, ovl_dict=overlay,
+                    ignore=self.ignore, quiet=self.quiet)
             except Exception, error:
                 self.output.warn(str(error), 3)
             else:
                 self.overlays[ovl.name] = ovl
+        return
 
 
     def write(self, path):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     b68a9eaead31e08460460a13d999444118784a59
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 21 11:37:13 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Feb 24 06:49:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b68a9eae

Change most exceptions raised to output.errors().
set functions to return True/False.

Signed-off-by: Brian Dolbec <brian.dolbec <AT> gmail.com>

---
 layman/makeconf.py |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/layman/makeconf.py b/layman/makeconf.py
index fdd10c4..b6f5d90 100644
--- a/layman/makeconf.py
+++ b/layman/makeconf.py
@@ -69,14 +69,16 @@ class MakeConf:
 
     def __init__(self, config, overlays):
 
+        self.config = config
         self.path = config['make_conf']
         self.storage = config['storage']
         self.data = ''
         self.db = overlays
         self.overlays = []
         self.extra = []
+        self.output = config['output']
 
-        self.read()
+        self.read(True)
 
     def add(self, overlay):
         '''
@@ -104,7 +106,7 @@ class MakeConf:
         >>> os.unlink(write)
         '''
         self.overlays.append(overlay)
-        self.write()
+        return self.write()
 
     def delete(self, overlay):
         '''
@@ -134,9 +136,9 @@ class MakeConf:
         self.overlays = [i
                          for i in self.overlays
                          if i.name != overlay.name]
-        self.write()
+        return self.write()
 
-    def read(self):
+    def read(self, raise_error=False):
         '''
         Read the list of registered overlays from /etc/make.conf.
 
@@ -160,8 +162,13 @@ class MakeConf:
             overlays = self.my_re.search(self.data)
 
             if not overlays:
-                raise Exception('Did not find a PORTDIR_OVERLAY entry in file ' +
-                                self.path +'! Did you specify the correct file?')
+                msg = 'MakeConf: read(); Did not find a ' + \
+                    'PORTDIR_OVERLAY entry in file ' + \
+                    self.path +'! Did you specify the correct file?'
+                if raise_error:
+                    raise Exception(msg)
+                self.output.error(msg)
+                return False
 
             overlays = [i.strip()
                         for i in overlays.group(1).split('\n')
@@ -181,7 +188,6 @@ class MakeConf:
                     # about. The user probably added them manually
                     self.extra.append(i)
 
-
         else:
             self.overlays = []
             self.data     = 'PORTDIR_OVERLAY="\n"\n'
@@ -189,6 +195,7 @@ class MakeConf:
         self.extra = [i for i in self.extra
                          if (i != '$PORTDIR_OVERLAY'
                              and i != '${PORTDIR_OVERLAY}')]
+        return True
 
     def write(self):
         '''
@@ -238,9 +245,10 @@ class MakeConf:
         content = self.my_re.sub(overlays, self.data)
 
         if not self.my_re.search(content):
-            raise Exception('Ups, failed to set a proper PORTDIR_OVERLAY entry '
-                            'in file ' + self.path +'! Did not overwrite the fi'
-                            'le.')
+            self.output.error('MakeConf: write(); Oops, failed to set a '
+                'proper PORTDIR_OVERLAY entry in file '
+                 + self.path +'! Did not overwrite the file.')
+            return False
 
         try:
             make_conf = codecs.open(self.path, 'w', 'utf-8')
@@ -250,8 +258,10 @@ class MakeConf:
             make_conf.close()
 
         except Exception, error:
-            raise Exception('Failed to read "' + self.path + '".\nError was:\n'
-                            + str(error))
+            self.output.error('MakeConf: write(); Failed to write "'
+                + self.path + '".\nError was:\n' + str(error))
+            return False
+        return True
 
     def content(self):
         '''
@@ -265,5 +275,6 @@ class MakeConf:
             make_conf.close()
 
         except Exception, error:
-            raise Exception('Failed to read "' + self.path + '".\nError was:\n'
-                            + str(error))
+            self.output.error('MakeConf: content(); Failed to read "' +
+                self.path + '".\nError was:\n' + str(error))
+            raise error



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     e4cbd7af207a2f21df967a080af5bb61c6c782d7
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 21 11:41:16 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Feb 24 06:49:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e4cbd7af

set output's error callback to the api's _error().
update the overlay's info dictionary.

---
 layman/api.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 8081bcb..75d0c10 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -53,6 +53,9 @@ class LaymanAPI(object):
 
         self.report_errors = report_errors
 
+        # add our error recording function to output
+        self.output.error_callback = self._error
+
         # get installed and available dbs
         self._installed_db = None
         self._installed_ids = None
@@ -204,6 +207,9 @@ class LaymanAPI(object):
                     'homepage': overlay.homepage,
                     'irc': overlay.irc,
                     'description': overlay.description,
+                    'feeds': overlay.feeds,
+                    'sources': [(e.src, e.type, e.subpath) \
+                        for e in overlay.sources],
                     #'src_uris': [e.src for e in overlay.sources],
                     'src_uris': overlay.source_uris(),
                     'src_types': overlay.source_types(),



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-04-27 10:58 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-04-27 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     89455e5de82d644e5b034642bacaac8338e8987a
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 21 11:38:41 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Feb 24 06:49:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=89455e5d

add an error callback function ability to pass errors to.

---
 layman/output.py |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 05260ce..469f673 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -24,7 +24,8 @@ class MessageBase(object):
                  err = sys.stderr,
                  info_level = INFO_LEVEL,
                  warn_level = WARN_LEVEL,
-                 col = True
+                 col = True,
+                 error_callback=None
                  ):
         # Where should the error output go? This can also be a file
         self.error_out = err
@@ -44,7 +45,9 @@ class MessageBase(object):
 
         self.debug_lev = OFF
 
-        self.has_error = False
+        # callback function that gets passed any error messages
+        # that have shown up.
+        self.error_callback = error_callback
 
 
     def _color (self, col, text):
@@ -73,6 +76,12 @@ class MessageBase(object):
     def set_debug_level(self, debugging_level = DEBUG_LEVEL):
         self.debug_lev = debugging_level
 
+    def do_error_callback(self, error):
+        """runs the error_callback function with the error
+        that occurred
+        """
+        if self.error_callback:
+            self.error_callback(error)
 
 
 class Message(MessageBase):
@@ -86,8 +95,9 @@ class Message(MessageBase):
                  err = sys.stderr,
                  info_level = INFO_LEVEL,
                  warn_level = WARN_LEVEL,
-                 col = True
-                 ):
+                 col = True,
+                 error_callback = None
+                ):
 
         MessageBase.__init__(self)
 
@@ -170,7 +180,7 @@ class Message(MessageBase):
             sys.stdout.flush()
             print >> self.error_out, self.color_func('red', '* ') + i
             self.error_out.flush()
-        self.has_error = True
+        self.do_error_callback(error)
 
 
     def die (self, error):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19 11:01 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19 11:01 UTC (permalink / raw
  To: gentoo-commits

commit:     990e967e10ec6511aa8e58beacdc9c3a5a029fcc
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 11:01:30 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 11:01:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=990e967e

Create a new single import high level Layman class

---
 layman/__init__.py |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/layman/__init__.py b/layman/__init__.py
index 792d600..e27488a 100644
--- a/layman/__init__.py
+++ b/layman/__init__.py
@@ -1 +1,47 @@
-#
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""Layman is a complete library for the operation and maintainance
+on all gentoo repositories and overlays
+"""
+
+
+
+class Layman(object):
+    """High level interface capable of performing all
+    overlay repository actions."""
+
+    def __init__(self, stdout=None, stdin=None, stderr=None,
+        config=None, read_configfile=True, quiet=False, quietness=4,
+        verbose=False, nocolor=False, width=0
+        ):
+        """Input parameters are optional to override the defaults.
+        sets up our LaymanAPI with defaults or passed in values
+        and returns an instance of it"""
+        import sys
+        try:
+            from layman.api import LaymanAPI
+            from layman.config import BareConfig
+            from layman.output import Message
+        except ImportError:
+            sys.stderr.write("!!! Layman API import failed.")
+            return None
+        self.message = Message()
+        self.config = BareConfig(
+                output=message,
+                stdout=None,
+                stdin=None,
+                stderr=None,
+                config=None,
+                read_configfile=True,
+                quiet=False,
+                quietness=4,
+                verbose=False,
+                nocolor=False,
+                width=0
+            )
+        self.layman = LaymanAPI(self.config,
+                             report_errors=True,
+                             output=config['output']
+                            )
+        return _layman



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19 11:01 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19 11:01 UTC (permalink / raw
  To: gentoo-commits

commit:     7a970a992bfc1fea6c37ef96378c2fd4bfbc8b17
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 10:43:11 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 10:43:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=7a970a99

eliminate the need to import Message, cleanup some stale comments.

---
 layman/api.py |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 63682f6..8081bcb 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -21,8 +21,6 @@ from layman.config import BareConfig
 from layman.dbbase import UnknownOverlayException, UnknownOverlayMessage
 from layman.db import DB, RemoteDB
 #from layman.utils import path, delete_empty_directory
-#from layman.debug import OUT
-from layman.output import OUT
 
 # give them some values for now, these are from the packagekit backend
 # TODO  establish some proper errors for the api.
@@ -31,11 +29,6 @@ ERROR_INTERNAL_ERROR = -2
 UNKNOWN_REPO_ID = "Repo ID '%s' " + \
         "is not listed in the current available overlays list"
 
-# In order to redirect output you need to get a Message class instance with the
-# stderr, stdout, stddebug directed to where you want.
-# eg:  output = Message('layman', err=mystderr, dbg=mydebug, out=myoutput)
-# there are many more options available, refer to debug.py Message class
-
 
 class LaymanAPI(object):
     """class to hold and run a layman instance for use by API consumer apps, guis, etc.
@@ -54,10 +47,10 @@ class LaymanAPI(object):
                                     default is Message(module='layman') other params are defaults.
         """
 
-        self.output = output if output  else OUT
-
         self.config = config if config else BareConfig(output=output)
 
+        self.output = self.config['output']
+
         self.report_errors = report_errors
 
         # get installed and available dbs



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19 11:01 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19 11:01 UTC (permalink / raw
  To: gentoo-commits

commit:     9df5b23e5b71d6f35302572162239f3d23732e33
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 10:45:03 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 10:45:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9df5b23e

import Message directly add all options to BareConfig for easy instantiation with teh desired options.

---
 layman/config.py |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index d02fe13..e8736ed 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -34,7 +34,7 @@ import os
 from optparse import OptionParser, OptionGroup
 
 #from layman.debug import OUT
-from layman.output import OUT
+from layman.output import Message
 
 from layman.constants import OFF
 from layman.version import VERSION
@@ -79,7 +79,9 @@ class BareConfig(object):
     '''Handles the configuration only.'''
 
     def __init__(self, output=None, stdout=None, stdin=None, stderr=None,
-        read_configfile=False):
+        config=None, read_configfile=False, quiet=False, quietness=4,
+        verbose=False, nocolor=False, width=0
+        ):
         '''
         Creates a bare config with defaults and a few output options.
 
@@ -115,10 +117,11 @@ class BareConfig(object):
                     'T/F_options': ['nocheck']
                     }
         self._options = {
+                    'config': config if config else self._defaults['config'],
                     'stdout': stdout if stdout else sys.stdout,
                     'stdin': stdin if stdin else sys.stdin,
                     'stderr': stderr if stderr else sys.stderr,
-                    'output': output if output else OUT,
+                    'output': output if output else Message(),
                     'quietness': 4,
                     'nocolor': False,
                     'width': 0,
@@ -127,9 +130,9 @@ class BareConfig(object):
                     }
         self.config = None
         if read_configfile:
-            self.config = ConfigParser.ConfigParser(self.defaults)
+            self.config = ConfigParser.ConfigParser(self._defaults)
             self.config.add_section('MAIN')
-            read_config(self.config, self.defaults)
+            read_config(self.config, self._defaults)
 
 
     def keys(self):
@@ -225,7 +228,7 @@ class ArgsParser(object):
         self.stdout = stdout if stdout else sys.stdout
         self.stderr = stderr if stderr else sys.stderr
         self.stdin = stdin if stdin else sys.stdin
-        self.output = output if output else OUT
+        self.output = output if output else Message()
 
         bare_config = BareConfig(self.output, self.stdout,
             self.stdin, self.stderr)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19 11:01 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19 11:01 UTC (permalink / raw
  To: gentoo-commits

commit:     3097da00099de860894ddde8f7b3df9722ec6734
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 10:45:50 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 10:45:50 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3097da00

remove no longer needed imports and OUT variable

---
 layman/output.py |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 250ce96..05260ce 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -10,9 +10,7 @@
 __version__ = "0.1"
 
 
-import sys, inspect, types
-
-from optparse import OptionGroup
+import sys, types
 
 from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, DEBUG_LEVEL, OFF
 
@@ -184,8 +182,3 @@ class Message(MessageBase):
             self.error(self.color_func('red', 'Fatal error: ') + i)
         self.error(self.color_func('red', 'Fatal error(s) - aborting'))
         sys.exit(1)
-
-
-
-## gloabal message handler
-OUT = Message()



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19  4:49 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     bf5a704ebca23f917911c73994c708a1fa45d78d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 04:49:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 04:49:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bf5a704e

missed another typo

---
 layman/config.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 12fe0c9..d02fe13 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -159,7 +159,7 @@ class BareConfig(object):
         self._options[option] = value
         # handle quietness
         if option == 'quiet':
-            if self._option['quiet']:
+            if self._options['quiet']:
                 self._set_quietness(1)
             else:
                 self._set_quietness(4)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19  4:47 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19  4:47 UTC (permalink / raw
  To: gentoo-commits

commit:     762d63a6bd055092ce2033c21bd70871c1c8d234
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 04:46:57 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 04:46:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=762d63a6

fix typos

---
 layman/config.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 3abb73c..12fe0c9 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -167,8 +167,8 @@ class BareConfig(object):
             self._set_quietness()
 
     def _set_quietness(self, value):
-            self._option['output'].set_info_level(int(self['quietness']))
-            self._option['output'].set_warn_level(int(self['quietness']))
+            self._options['output'].set_info_level(int(self['quietness']))
+            self._options['output'].set_warn_level(int(self['quietness']))
 
 
     def __getitem__(self, key):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19  4:10 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19  4:10 UTC (permalink / raw
  To: gentoo-commits

commit:     a54b7138d76dacf2c8e3ba9b550d7619790a9010
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 04:10:18 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 04:10:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a54b7138

fix missed colon

---
 layman/config.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 6c3677c..3abb73c 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -166,7 +166,7 @@ class BareConfig(object):
         if option == 'quietness':
             self._set_quietness()
 
-    def _set_quietness(self, value)
+    def _set_quietness(self, value):
             self._option['output'].set_info_level(int(self['quietness']))
             self._option['output'].set_warn_level(int(self['quietness']))
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-19  4:07 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-19  4:07 UTC (permalink / raw
  To: gentoo-commits

commit:     f2dd98035ee2c90bb01174d6f816a4866b1c0f7d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sat Feb 19 04:06:51 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 19 04:06:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f2dd9803

add nocolr to BareConfig and improve quiet/quietness handling

---
 layman/config.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index a2b9377..6c3677c 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -119,7 +119,8 @@ class BareConfig(object):
                     'stdin': stdin if stdin else sys.stdin,
                     'stderr': stderr if stderr else sys.stderr,
                     'output': output if output else OUT,
-                    'quietness': '4',
+                    'quietness': 4,
+                    'nocolor': False,
                     'width': 0,
                     'verbose': False,
                     'quiet': False,
@@ -157,7 +158,15 @@ class BareConfig(object):
         """Sets an option to the value """
         self._options[option] = value
         # handle quietness
+        if option == 'quiet':
+            if self._option['quiet']:
+                self._set_quietness(1)
+            else:
+                self._set_quietness(4)
         if option == 'quietness':
+            self._set_quietness()
+
+    def _set_quietness(self, value)
             self._option['output'].set_info_level(int(self['quietness']))
             self._option['output'].set_warn_level(int(self['quietness']))
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-17 21:53 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-17 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     4872509aab4693638c957fcd8e9d38af06357769
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Thu Feb 17 21:52:44 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Feb 17 21:52:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4872509a

make the BareConfig more comparable with the ArgsParser.
Separate out a True/False function for config option string conversion.

---
 layman/config.py |   46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 6f8f658..a2b9377 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -68,12 +68,18 @@ def read_config(config=None, defaults=None):
                 overlays.update(["file://" + path])
         config.set('MAIN', 'overlays', '\n'.join(overlays))
 
+def t_f_check(option):
+    """evaluates the option and returns
+    True or False
+    """
+    return option.lower() in ['yes', 'true', 'y', 't']
 
 
 class BareConfig(object):
     '''Handles the configuration only.'''
 
-    def __init__(self, output=None, stdout=None, stdin=None, stderr=None):
+    def __init__(self, output=None, stdout=None, stdin=None, stderr=None,
+        read_configfile=False):
         '''
         Creates a bare config with defaults and a few output options.
 
@@ -105,7 +111,8 @@ class BareConfig(object):
                     'mercurial_command': '/usr/bin/hg',
                     'rsync_command': '/usr/bin/rsync',
                     'svn_command': '/usr/bin/svn',
-                    'tar_command': '/bin/tar'
+                    'tar_command': '/bin/tar',
+                    'T/F_options': ['nocheck']
                     }
         self._options = {
                     'stdout': stdout if stdout else sys.stdout,
@@ -117,6 +124,11 @@ class BareConfig(object):
                     'verbose': False,
                     'quiet': False,
                     }
+        self.config = None
+        if read_configfile:
+            self.config = ConfigParser.ConfigParser(self.defaults)
+            self.config.add_section('MAIN')
+            read_config(self.config, self.defaults)
 
 
     def keys(self):
@@ -144,13 +156,30 @@ class BareConfig(object):
     def set_option(self, option, value):
         """Sets an option to the value """
         self._options[option] = value
+        # handle quietness
+        if option == 'quietness':
+            self._option['output'].set_info_level(int(self['quietness']))
+            self._option['output'].set_warn_level(int(self['quietness']))
 
 
     def __getitem__(self, key):
         self._options['output'].debug('Retrieving BareConfig option', 8)
+        if key == 'overlays':
+            overlays = ''
+            if (key in self._options
+                and not self._options[key] is None):
+                overlays = '\n'.join(self._options[key])
+            if self.config and self.config.has_option('MAIN', 'overlays'):
+                overlays += '\n' + self.config.get('MAIN', 'overlays')
+            if overlays:
+                return  overlays
         if (key in self._options
             and not self._options[key] is None):
             return self._options[key]
+        if self.config and self.config.has_option('MAIN', key):
+            if key in self._defaults['T/F_options']:
+                return t_f_check(self.config.get('MAIN', key))
+            return self.config.get('MAIN', key)
         self._options['output'].debug('Retrieving BareConfig default', 8)
         if key in self._defaults:
             if '%(storage)s' in self._defaults[key]:
@@ -159,8 +188,6 @@ class BareConfig(object):
         return None
 
 
-
-
 class ArgsParser(object):
     '''Handles the configuration and option parser.'''
 
@@ -191,9 +218,9 @@ class ArgsParser(object):
         self.stdin = stdin if stdin else sys.stdin
         self.output = output if output else OUT
 
-        self.bare_config = BareConfig(self.output, self.stdout,
+        bare_config = BareConfig(self.output, self.stdout,
             self.stdin, self.stderr)
-        self.defaults = self.bare_config.get_defaults()
+        self.defaults = bare_config.get_defaults()
         #print self.defaults
 
         self.parser = OptionParser(
@@ -418,11 +445,8 @@ class ArgsParser(object):
         self.output.debug('Retrieving option', 8)
 
         if self.config.has_option('MAIN', key):
-            if key == 'nocheck':
-                if self.config.get('MAIN', key).lower() == 'yes':
-                    return True
-                else:
-                    return False
+            if key in self.defaults['T/F_options']:
+                return t_f_check(self.config.get('MAIN', key))
             return self.config.get('MAIN', key)
 
         self.output.debug('Retrieving option', 8)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     69ca817b92d78e91b03ee3e327b9e369c8f26e5a
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 14 00:52:19 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Feb 14 00:52:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=69ca817b

Split out MessageBase class, more code reduction/cleanup

---
 layman/output.py |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/layman/output.py b/layman/output.py
index 5785d58..250ce96 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -12,15 +12,14 @@ __version__ = "0.1"
 
 import sys, inspect, types
 
-from   optparse      import OptionGroup
+from optparse import OptionGroup
 
-from   layman.constants  import codes, INFO_LEVEL, WARN_LEVEL, OFF
+from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, DEBUG_LEVEL, OFF
 
 
-
-class Message:
-    #FIXME: Think about some simple doctests before you modify this class the
-    #       next time.
+class MessageBase(object):
+    """Base Message class helper functions and variables
+    """
 
     def __init__(self,
                  out = sys.stdout,
@@ -29,7 +28,6 @@ class Message:
                  warn_level = WARN_LEVEL,
                  col = True
                  ):
-
         # Where should the error output go? This can also be a file
         self.error_out = err
 
@@ -43,24 +41,27 @@ class Message:
         self.info_lev = info_level
 
         # Should the output be colored?
+        self.color_func = None
         self.set_colorize(col)
 
+        self.debug_lev = OFF
+
         self.has_error = False
 
 
-    def color (self, col, text):
+    def _color (self, col, text):
         return codes[col] + text + codes['reset']
 
 
-    def no_color (self, col, text):
+    def _no_color (self, col, text):
         return text
 
 
     def set_colorize(self, state):
         if state:
-            self.color_func = self.color
+            self.color_func = self._color
         else:
-            self.color_func = self.no_color
+            self.color_func = self._no_color
 
 
     def set_info_level(self, info_level = INFO_LEVEL):
@@ -71,10 +72,34 @@ class Message:
         self.warn_lev = warn_level
 
 
+    def set_debug_level(self, debugging_level = DEBUG_LEVEL):
+        self.debug_lev = debugging_level
+
+
+
+class Message(MessageBase):
+    """Primary Message output methods
+    """
+    #FIXME: Think about some simple doctests before you modify this class the
+    #       next time.
+
+    def __init__(self,
+                 out = sys.stdout,
+                 err = sys.stderr,
+                 info_level = INFO_LEVEL,
+                 warn_level = WARN_LEVEL,
+                 col = True
+                 ):
+
+        MessageBase.__init__(self)
+
+
     ## Output Functions
 
     def debug(self, info, level = OFF):
-        """empty debug function"""
+        """empty debug function, does nothing,
+        declared here for compatibility with DebugMessage
+        """
         pass
 
 
@@ -84,8 +109,6 @@ class Message:
 
     def info (self, info, level = INFO_LEVEL):
 
-        #print "info =", info
-
         if type(info) not in types.StringTypes:
             info = str(info)
 
@@ -145,7 +168,7 @@ class Message:
         for i in error.split('\n'):
             # NOTE: Forced flushing ensures that stdout and stderr
             # stay in nice order.  This is a workaround for calls like
-            # "overlord -L |& less".
+            # "layman -L |& less".
             sys.stdout.flush()
             print >> self.error_out, self.color_func('red', '* ') + i
             self.error_out.flush()



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     306b419af140c6e1eb41a2114005b20b82a5332c
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Feb 13 09:30:24 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 09:30:24 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=306b419a

further simplify, reduce the number of functions

---
 layman/constants.py |    7 +++++++
 layman/output.py    |   37 +++++++++----------------------------
 2 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/layman/constants.py b/layman/constants.py
index 7fc72ea..6962867 100644
--- a/layman/constants.py
+++ b/layman/constants.py
@@ -43,3 +43,10 @@ codes['turquoise'] = esc_seq + '36;01m'
 NOT_OFFICIAL_MSG = '*** This is not an official gentoo overlay ***\n'
 NOT_SUPPORTED_MSG = '*** You are lacking the necessary tools' +\
     ' to install this overlay ***\n'
+
+
+OFF = 0
+WARN_LEVEL = 4
+INFO_LEVEL = 4
+DEBUG_LEVEL = 4
+DEBUG_VERBOSITY = 2

diff --git a/layman/output.py b/layman/output.py
index 49ebb34..5785d58 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -14,7 +14,7 @@ import sys, inspect, types
 
 from   optparse      import OptionGroup
 
-from   overlord.constants  import codes
+from   layman.constants  import codes, INFO_LEVEL, WARN_LEVEL, OFF
 
 
 
@@ -25,8 +25,8 @@ class Message:
     def __init__(self,
                  out = sys.stdout,
                  err = sys.stderr,
-                 info_level = 4,
-                 warn_level = 4,
+                 info_level = INFO_LEVEL,
+                 warn_level = WARN_LEVEL,
                  col = True
                  ):
 
@@ -63,43 +63,26 @@ class Message:
             self.color_func = self.no_color
 
 
-    def set_info_level(self, info_level = 4):
+    def set_info_level(self, info_level = INFO_LEVEL):
         self.info_lev = info_level
 
 
-    def info_off(self):
-        self.set_info_level(0)
-
-
-    def info_on(self, info_level = 4):
-        self.set_info_level(info_level)
-
-
-    def set_warn_level(self, warn_level = 4):
+    def set_warn_level(self, warn_level = WARN_LEVEL):
         self.warn_lev = warn_level
 
 
-    def warn_off(self):
-        self.set_warn_level(0)
-
-
-    def warn_on(self, warn_level = 4):
-        self.set_warn_level(warn_level)
-
-
-
-
     ## Output Functions
 
-    def debug(self, info, level=0):
+    def debug(self, info, level = OFF):
         """empty debug function"""
         pass
 
+
     def notice (self, note):
         print >> self.std_out, note
 
 
-    def info (self, info, level = 4):
+    def info (self, info, level = INFO_LEVEL):
 
         #print "info =", info
 
@@ -142,9 +125,7 @@ class Message:
             '.' * (58 - len(i)) + ' ' + result
 
 
-    def warn (self, warn, level = 4):
-
-        #print "DEBUG.warn()"
+    def warn (self, warn, level = WARN_LEVEL):
 
         if type(warn) not in types.StringTypes:
             warn = str(warn)



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     2dd23d2be98537bebe647340a6ba6c6f88578300
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jan 18 07:58:04 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:48:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2dd23d2b

add a list_ids() and use the it

---
 layman/api.py    |    4 ++--
 layman/dbbase.py |    6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index ef5fc5b..d97bf8e 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -385,14 +385,14 @@ class LaymanAPI(object):
     def get_available(self, reload=False):
         """returns the list of available overlays"""
         if self._available_ids is None or reload:
-            self._available_ids = sorted(self._get_remote_db(reload).overlays)
+            self._available_ids = self._get_remote_db(reload).list_ids()
         return self._available_ids[:] or ['None']
 
 
     def get_installed(self, reload=False):
         """returns the list of installed overlays"""
         if self._installed_ids is None or reload:
-            self._installed_ids = sorted(self._get_installed_db(reload).overlays)
+            self._installed_ids = self._get_installed_db(reload).list_ids()
         return self._installed_ids[:]
 
 

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 7eaa1cf..3532062 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -252,6 +252,12 @@ class DbBase:
 
         return result
 
+    def list_ids(self):
+        """returns a list of the overlay names
+        """
+        return sorted(self.overlays)
+
+
 #===============================================================================
 #
 # Testing



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8f3c12a02768bea0cf1ceed02b27886cdac3f2af
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Feb  6 23:34:36 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:55:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8f3c12a0

add the ability to plugin repository definition xml files without editing the config file

---
 layman/config.py |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index baa3af3..33951e7 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -28,6 +28,7 @@ __version__ = "$Id: config.py 286 2007-01-09 17:48:23Z wrobel $"
 #-------------------------------------------------------------------------------
 
 import sys, ConfigParser
+import os
 
 from   optparse                 import OptionParser, OptionGroup
 from   layman.debug             import OUT
@@ -44,6 +45,31 @@ _USAGE = """
   layman -f [-o URL]
   layman (-l|-L|-S)"""
 
+
+def read_config(config=None, defaults=None):
+    """reads the config file defined in defaults['config']
+    and updates the config
+
+    @param config: ConfigParser.ConfigParser(self.defaults) instance
+    @param defaults: dict
+    @modifies config['MAIN']['overlays']
+    """
+    config.read(defaults['config'])
+    if config.get('MAIN', 'overlay_defs'):
+        try:
+            filelist = os.listdir(config.get('MAIN', 'overlay_defs'))
+        except OSError:
+            return
+        filelist = [f for f in filelist if f.endswith('.xml')]
+        overlays = set(config.get('MAIN', 'overlays').split('\n'))
+        for _file in filelist:
+            path = os.path.join(config.get('MAIN', 'overlay_defs'), _file)
+            if os.path.isfile(path):
+                overlays.update(["file://" + path])
+        config.set('MAIN', 'overlays', '\n'.join(overlays))
+
+
+
 class BareConfig(object):
     '''Handles the configuration only.'''
 
@@ -70,6 +96,7 @@ class BareConfig(object):
                     'umask'     : '0022',
                     'overlays'  :
                     'http://www.gentoo.org/proj/en/overlays/repositories.xml',
+                    'overlay_defs': '/etc/layman/overlays',
                     'bzr_command': '/usr/bin/bzr',
                     'cvs_command': '/usr/bin/cvs',
                     'darcs_command': '/usr/bin/darcs',
@@ -318,7 +345,7 @@ class ArgsParser(object):
         #-----------------------------------------------------------------
         # Debug Options
 
-        self.output.cli_opts(self.parser)
+        #self.output.cli_opts(self.parser)
 
         # Parse the command line first since we need to get the config
         # file option.
@@ -333,7 +360,7 @@ class ArgsParser(object):
                 % ', '.join(('"%s"' % e) for e in remain_args[1:]))
 
         # handle debugging
-        self.output.cli_handle(self.options)
+        #self.output.cli_handle(self.options)
 
         # add output to the options
         self.options.__dict__['output'] = self.output
@@ -351,7 +378,7 @@ class ArgsParser(object):
         if not self.options.__dict__['config'] is None:
             self.defaults['config'] = self.options.__dict__['config']
 
-            self.output.debug('Got config file at ' + self.defaults['config'], 8)
+            #self.output.debug('Got config file at ' + self.defaults['config'], 8)
 
         # Now parse the config file
         self.config = ConfigParser.ConfigParser(self.defaults)
@@ -366,9 +393,9 @@ class ArgsParser(object):
             self.output.set_info_level(int(self['quietness']))
             self.output.set_warn_level(int(self['quietness']))
 
-        self.output.debug('Reading config file at ' + self.defaults['config'], 8)
+        #self.output.debug('Reading config file at ' + self.defaults['config'], 8)
 
-        self.config.read(self.defaults['config'])
+        read_config(self.config, self.defaults)
 
     def __getitem__(self, key):
 
@@ -407,6 +434,7 @@ class ArgsParser(object):
 
         return None
 
+
     def keys(self):
         '''Special handler for the configuration keys.'''
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3da3a059d7e0c251e457a3b803752dd517acf726
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jan 18 04:06:37 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:48:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3da3a059

add missing output messages

---
 layman/cli.py |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index b273c89..29b6989 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -79,7 +79,7 @@ class ListPrinter(object):
         if supported:
             # Is this an official overlay?
             if official:
-                 self.output.info(summary, 1)
+                self.output.info(summary, 1)
             # Unofficial overlays will only be listed if we are not
             # checking or listing verbose
             elif complain:
@@ -197,7 +197,16 @@ class Main(object):
         if 'ALL' in selection:
             selection = self.api.get_available()
         self.output.debug('Adding selected overlays', 6)
-        return self.api.add_repos(selection)
+        result = self.api.add_repos(selection)
+        if result:
+            self.output.info('Successfully added overlay(s) '+\
+                ', '.join(selection) +'.', 2)
+        else:
+            errors = self.api.get_errors()
+            self.output.warn('Failed to add overlay(s).\nError was: '
+                             + str('\n'.join(errors)), 2)
+        return result
+
 
 
     def Sync(self):
@@ -217,7 +226,15 @@ class Main(object):
         if 'ALL' in selection:
             selection = self.api.get_installed()
         self.output.debug('Deleting selected overlays', 6)
-        return self.api.delete_repos(selection)
+        result = self.api.delete_repos(selection)
+        if result:
+            self.output.info('Successfully deleted overlay(s) ' +\
+                ', '.join(selection) + '.', 2)
+        else:
+            errors = self.api.get_errors()
+            self.output.warn('Failed to delete overlay(s).\nError was: '
+                             + str('\n'.join(errors)), 2)
+        return result
 
 
     def Info(self):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     6780f08f787642bb3e1620a0909d96a7e43abb0d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jan 18 07:57:18 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:48:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6780f08f

add missing output statements, debug all the new actions

---
 layman/cli.py |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index 29b6989..dca6bb6 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -47,11 +47,11 @@ class ListPrinter(object):
             self.my_lister = self.short_list
 
     def print_shortdict(self, info, complain):
-        #print "ListPrinter.print_tuple()",info
-        ids = sorted(info)
-        #print "ids =======>", ids, "\n"
-        for _id in ids:
-            overlay = info[_id]
+        #print "ListPrinter.print_shortdict()",info, "\n\n"
+        overlays = sorted(info)
+        #print "ids =======>", overlays, "\n"
+        for ovl in overlays:
+            overlay = info[ovl]
             #print "overlay =", overlay
             summary, supported, official = overlay
             self.print_overlay(summary, supported, official, complain)
@@ -187,7 +187,15 @@ class Main(object):
     def Fetch(self):
         ''' Fetches the overlay listing.
         '''
-        return self.api.fetch_remote_list()
+        self.output.info("Fetching remote list,...", 2)
+        result = self.api.fetch_remote_list()
+        if result:
+            self.output.info('Ok', 2)
+        else:
+            errors = self.api.get_errors()
+            self.output.warn('Download failed.\nError was: '
+                             + str('\n'.join(errors)), 2)
+        return result
 
 
     def Add(self):
@@ -212,6 +220,7 @@ class Main(object):
     def Sync(self):
         ''' Syncs the selected overlays.
         '''
+        # Note api.sync() defaults to printing results
         selection = decode_selection(self.config['sync'])
         if self.config['sync_all'] or 'ALL' in selection:
             selection = self.api.get_installed()
@@ -243,15 +252,15 @@ class Main(object):
         selection = decode_selection(self.config['info'])
         if 'ALL' in selection:
             selection = self.api.get_available()
-        info = self.api.get_info_str(selection)
-
-        for overlay in info:
-            # Is the overlay supported?
-            self.output.info(overlay[0], 1)
-            if not overlay[1]:
-                self.output.warn(NOT_OFFICIAL_MSG, 1)
-            if not overlay[2]:
-                self.output.error(NOT_SUPPORTED_MSG)
+
+        list_printer = ListPrinter(self.config)
+        _complain = self.config['nocheck'] or self.config['verbose']
+
+        info = self.api.get_info_str(selection, local=False,
+            verbose=True, width=list_printer.width)
+        #print "info =", info
+        list_printer.print_shortdict(info, complain=_complain)
+
         return info != {}
 
 
@@ -261,10 +270,10 @@ class Main(object):
 
         self.output.debug('Printing remote overlays.', 6)
         list_printer = ListPrinter(self.config)
-        width = list_printer.width
 
         _complain = self.config['nocheck'] or self.config['verbose']
-        info = self.api.get_info_list(local=False, verbose=self.config['verbose'], width=width)
+        info = self.api.get_info_list(local=False,
+            verbose=self.config['verbose'], width=list_printer.width)
         list_printer.print_shortlist(info, complain=_complain)
 
         return info != {}



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     da083d70887673dbb3e26c28f4a796355f47b00e
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Jan 18 04:48:38 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:48:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=da083d70

minor word change

---
 layman/api.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 99696f8..ef5fc5b 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -350,7 +350,7 @@ class LaymanAPI(object):
 
         if output_results:
             if success:
-                self.output.info('\nSuccess:\n------\n', 3)
+                self.output.info('\nSucceeded:\n------\n', 3)
                 for ovl, result in success:
                     self.output.info(result, 3)
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     cf439af88990de7f7e0ef68faca1581e0480a458
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:56:06 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 03:39:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=cf439af8

overhaul the api, add several functions, delay loading of the db's, etc

---
 layman/api.py   |  235 ++++++++++++++++++++++++++++++++-----------------------
 layman/utils.py |    2 +
 2 files changed, 140 insertions(+), 97 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 4dacf99..dfce4a0 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -30,7 +30,7 @@ ERROR_REPO_NOT_FOUND = -1
 ERROR_INTERNAL_ERROR = -2
 UNKNOWN_REPO_ID = "Repo ID '%s' " + \
         "is not listed in the current available overlays list"
- 
+
 # In order to redirect output you need to get a Message class instance with the
 # stderr, stdout, stddebug directed to where you want.
 # eg:  output = Message('layman', err=mystderr, dbg=mydebug, out=myoutput)
@@ -53,13 +53,13 @@ class LaymanAPI(object):
         @param output: optional Message class instance created with your settings.
                                     default is Message(module='layman') other params are defaults.
         """
-        
+
         self.output = output if output  else OUT
-       
+
         self.config = config if config else BareConfig(output=output)
-        
+
         self.report_errors = report_errors
-        
+
         # get installed and available dbs
         self._installed_db = None
         self._installed_ids = None
@@ -67,30 +67,26 @@ class LaymanAPI(object):
         self._available_ids = None
         self._error_messages = []
         self.sync_results = []
-        # call reload() for now to initialize the 2 db's
-        self.reload()
-        # change it to delayed loading (similar to delayed imports)
-        # to simplify some of the code and make it automagic.
 
 
-    def is_repo(self, id):
-        """validates that the id given is a known repo id
-        
-        @param id: repo id
-        @type id: str
+    def is_repo(self, ovl):
+        """validates that the ovl given is a known repo id
+
+        @param ovl: repo id
+        @type ovl: str
         @rtype boolean
         """
-        return id in self._available_ids
+        return ovl in self.get_available()
+
 
+    def is_installed(self, ovl):
+        """checks that ovl is a known installed repo id
 
-    def is_installed(self, id):
-        """checks the repo id is a known installed repo id
-        
-        @param id: repo id
-        @type id: str
+        @param ovl: repo id
+        @type ovl: str
         @rtype boolean
         """
-        return id in self._installed_ids
+        return ovl in self.get_installed()
 
 
     @staticmethod
@@ -102,15 +98,12 @@ class LaymanAPI(object):
         if isinstance(repos, basestring):
             repos = [repos]
         # else assume it is an iterable, if not it will error
-        #~ elif not isinstance(repos, list):
-            #~ self._error(2, "%s(), Unsupported input type: %s" %(caller, str(type(repos))))
-            #~ return []
         return repos
 
 
     def delete_repos(self, repos):
         """delete the selected repo from the system
-        
+
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @param output: method to handle output if desired
@@ -118,20 +111,20 @@ class LaymanAPI(object):
         """
         repos = self._check_repo_type(repos, "delete_repo")
         results = []
-        for id in repos:
-            if not self.is_installed(id):
+        for ovl in repos:
+            if not self.is_installed(ovl):
                 results.append(True)
                 break
-            if not self.is_repo(id):
-                self._error(1, UNKNOWN_REPO_ID %id)
+            if not self.is_repo(ovl):
+                self._error(1, UNKNOWN_REPO_ID %ovl)
                 results.append(False)
                 break
             try:
-                self._installed_db.delete(self._installed_db.select(id))
+                self._get_installed_db().delete(self._get_installed_db().select(ovl))
                 results.append(True)
             except Exception, e:
                 self._error(ERROR_INTERNAL_ERROR,
-                        "Failed to disable repository '"+id+"':\n"+str(e))
+                        "Failed to disable repository '"+ovl+"':\n"+str(e))
                 results.append(False)
             self.get_installed(reload=True)
         if False in results:
@@ -141,28 +134,28 @@ class LaymanAPI(object):
 
     def add_repos(self, repos):
         """installs the seleted repo id
-        
+
         @type repos: list of strings or string
-        @param repos: ['repo-id1', ...] or 'repo-id'
+        @param repos: ['repo-id', ...] or 'repo-id'
         @param output: method to handle output if desired
         @rtype dict
         """
         repos = self._check_repo_type(repos, "add_repo")
         results = []
-        for id in repos:
-            if self.is_installed(id):
+        for ovl in repos:
+            if self.is_installed(ovl):
                 results.append(True)
                 break
-            if not self.is_repo(id):
-                self._error(1, UNKNOWN_REPO_ID %id)
+            if not self.is_repo(ovl):
+                self._error(1, UNKNOWN_REPO_ID %ovl)
                 results.append(False)
                 break
             try:
-                self._installed_db.add(self._available_db.select(id), quiet=True)
+                self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
                 results.append(True)
             except Exception, e:
                 self._error(ERROR_INTERNAL_ERROR,
-                        "Failed to enable repository '"+id+"' : "+str(e))
+                        "Failed to enable repository '"+ovl+"' : "+str(e))
                 results.append(False)
             self.get_installed(reload=True)
         if False in results:
@@ -170,15 +163,15 @@ class LaymanAPI(object):
         return True
 
 
-    def get_all_info(self, repos):
+    def get_all_info(self, repos, local=False):
         """retrieves the recorded information about the repo(s)
-        specified by id
-        
+        specified by repo-id
+
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype list of tuples [(str, bool, bool),...]
-        @return: dictionary of dictionaries  
-        {'id1':
+        @return: dictionary of dictionaries
+        {'ovl1':
             {'name': str,
             'owner_name': str,
             'owner_email': str,
@@ -187,38 +180,44 @@ class LaymanAPI(object):
             'src_uris': list of str ['uri1',...]
             'src_type': str,
             'priority': int,
-            'quality': str 
+            'quality': str
             'status':,
             'official': bool,
             'supported': bool,
             },
-        'id2': {...}
+        'ovl2': {...}
         }
         """
-        
+
         repos = self._check_repo_type(repos, "get_info")
         result = {}
 
-        for id in repos:
-            if not self.is_repo(id):
-                self._error(1, UNKNOWN_REPO_ID %id)
-                result[id] = ('', False, False)
+        if local:
+            db = self._get_installed_db()
+        else:
+            db = self._get_remote_db()
+
+        for ovl in repos:
+            if not self.is_repo(ovl):
+                self._error(1, UNKNOWN_REPO_ID %ovl)
+                result[ovl] = ('', False, False)
             try:
-                overlay = self._available_db.select(id)
+                overlay = db.select(ovl)
             except UnknownOverlayException, error:
                 self._error(2, "Error: %s" %str(error))
-                result[id] = ('', False, False)
+                result[ovl] = ('', False, False)
             else:
-                result[id] = {
+                result[ovl] = {
                     'name': overlay.name,
                     'owner_name': overlay.owner_name,
                     'owner_email': overlay.owner_email,
                     'homepage': overlay.homepage,
                     'description': overlay.description,
+                    #'src_uris': [e.src for e in overlay.sources],
                     'src_uris': overlay.source_uris(),
-                    'src_type': overlay.sources[0].type,
+                    'src_types': [e.type for e in overlay.sources],
                     'priority': overlay.priority,
-                    'quality': overlay.quality, 
+                    'quality': overlay.quality,
                     'status': overlay.status,
                     'official': overlay.is_official(),
                     'supported': overlay.is_supported(),
@@ -227,40 +226,67 @@ class LaymanAPI(object):
         return result
 
 
-    def get_info_str(self, repos):
-        """retirves the string representation of the recorded information
-        about the repo(s) specified by id
-        
+    def get_info_str(self, repos, local=True, verbose=False, width=0):
+        """retrieves the string representation of the recorded information
+        about the repo(s) specified by ovl
+
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype list of tuples [(str, bool, bool),...]
-        @return: dictionary  {'id': (info string, official, supported)}
+        @return: dictionary  {'repo-id': (info string, official, supported)}
         """
         repos = self._check_repo_type(repos, "get_info")
         result = {}
 
-        for id in repos:
-            if not self.is_repo(id):
-                self._error(1, UNKNOWN_REPO_ID %id)
-                result[id] = ('', False, False)
+        if local:
+            db = self._get_installed_db()
+        else:
+            db = self._get_remote_db()
+
+        for ovl in repos:
+            if not self.is_repo(ovl):
+                self._error(1, UNKNOWN_REPO_ID % ovl)
+                result[ovl] = ('', False, False)
             try:
-                overlay = self._available_db.select(id)
+                overlay = db.select(ovl)
+                #print "overlay = ", ovl
+                #print overlay
             except UnknownOverlayException, error:
+                #print "ERRORS", str(error)
                 self._error(2, "Error: %s" %str(error))
-                result[id] = ('', False, False)
+                result[ovl] = ('', False, False)
             else:
                 # Is the overlay supported?
-                info = overlay.__str__()
+                if verbose:
+                    info = overlay.__str__()
+                else:
+                    info = overlay.short_list(width)
                 official = overlay.is_official()
                 supported = overlay.is_supported()
-                result[id] = (info, official, supported)
+                result[ovl] = (info, official, supported)
 
         return result
 
+    def get_info_list(self, local=True, verbose=False, width=0):
+        """retrieves the string representation of the recorded information
+        about the repo(s) specified by ovl
+
+        @param local: bool (defaults to True)
+        @param verbose: bool(defaults to False)
+        @param width: int (defaults to 0)
+        @rtype list of tuples [(str, bool, bool),...]
+        @return: list  [(info string, official, supported),...]
+        """
+
+        if local:
+            return self._get_installed_db().list(verbose=verbose, width=width)
+        else:
+            return self._get_remote_db().list(verbose=verbose, width=width)
+
 
     def sync(self, repos, output_results=True):
         """syncs the specified repo(s) specified by repos
-        
+
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype bool or {'repo-id': bool,...}
@@ -269,20 +295,21 @@ class LaymanAPI(object):
         warnings = []
         success  = []
         repos = self._check_repo_type(repos, "sync")
+        db = self._get_installed_db()
 
-        for id in repos:
+        for ovl in repos:
             try:
-                odb = self._installed_db.select(id)
+                odb = db.select(ovl)
             except UnknownOverlayException, error:
-                self._error(1,"Sync(), failed to select %s overlay.  Original error was: %s" %(id, str(error)))
+                self._error(1,"Sync(), failed to select %s overlay.  Original error was: %s" %(ovl, str(error)))
                 continue
 
             try:
-                ordb = self._available_db.select(id)
+                ordb = self._get_remote_db().select(ovl)
             except UnknownOverlayException:
                 message = 'Overlay "%s" could not be found in the remote lists.\n' \
-                        'Please check if it has been renamed and re-add if necessary.' %id
-                warnings.append((id, message))
+                        'Please check if it has been renamed and re-add if necessary.' %ovl
+                warnings.append((ovl, message))
             else:
                 current_src = odb.sources[0].src
                 available_srcs = set(e.src for e in ordb.sources)
@@ -292,9 +319,9 @@ class LaymanAPI(object):
                         candidates = '  %s' % tuple(available_srcs)[0]
                     else:
                         plural = 's'
-                        candidates = '\n'.join(('  %d. %s' % (id + 1, v)) for id, v in enumerate(available_srcs))
+                        candidates = '\n'.join(('  %d. %s' % (ovl + 1, v)) for ovl, v in enumerate(available_srcs))
 
-                    warnings.append((id,
+                    warnings.append((ovl,
                         'The source of the overlay "%(repo_name)s" seems to have changed.\n'
                         'You currently sync from\n'
                         '\n'
@@ -306,34 +333,34 @@ class LaymanAPI(object):
                         '\n'
                         'as correct location%(plural)s.\n'
                         'Please consider removing and re-adding the overlay.' , {
-                            'repo_name':id,
+                            'repo_name':ovl,
                             'current_src':current_src,
                             'candidates':candidates,
                             'plural':plural,
                             }))
 
             try:
-                self._installed_db.sync(id, self.config['quiet'])
-                success.append((id,'Successfully synchronized overlay "' + id + '".'))
+                db.sync(ovl, self.config['quiet'])
+                success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))
             except Exception, error:
-                fatals.append((id,
-                    'Failed to sync overlay "' + id + '".\nError was: '
+                fatals.append((ovl,
+                    'Failed to sync overlay "' + ovl + '".\nError was: '
                     + str(error)))
 
         if output_results:
             if success:
                 self.output.info('\nSuccess:\n------\n', 3)
-                for id, result in success:
+                for ovl, result in success:
                     self.output.info(result, 3)
-                    
+
             if warnings:
                 self.output.warn('\nWarnings:\n------\n', 2)
-                for id, result in warnings:
+                for ovl, result in warnings:
                     self.output.warn(result + '\n', 2)
 
             if fatals:
                 self.output.error('\nErrors:\n------\n')
-                for id, result in fatals:
+                for ovl, result in fatals:
                     self.output.error(result + '\n')
                 return False
 
@@ -345,28 +372,41 @@ class LaymanAPI(object):
     def fetch_remote_list(self):
         """Fetches the latest remote overlay list"""
         try:
-            self._available_db.cache()
+            self._get_remote_db().cache()
         except Exception, error:
             self._error(-1,'Failed to fetch overlay list!\n Original Error was: '
                     + str(error))
             return False
+        self.get_available(reload=True)
         return True
 
 
     def get_available(self, reload=False):
         """returns the list of available overlays"""
-        if not self._available_db or reload:
-            self._available_db = RemoteDB(self.config)
-            self._available_ids = sorted(self._available_db.overlays)
-        return self._available_ids[:]
+        if self._available_ids is None or reload:
+            self._available_ids = sorted(self._get_remote_db(reload).overlays)
+        return self._available_ids[:] or ['None']
 
 
     def get_installed(self, reload=False):
         """returns the list of installed overlays"""
+        if self._installed_ids is None or reload:
+            self._installed_ids = sorted(self._get_installed_db(reload).overlays)
+        return self._installed_ids[:]
+
+
+    def _get_installed_db(self, reload=False):
+        """returns the list of installed overlays"""
         if not self._installed_db or reload:
             self._installed_db = DB(self.config)
-            self._installed_ids = sorted(self._installed_db.overlays)
-        return self._installed_ids[:]
+        return self._installed_db
+
+
+    def _get_remote_db(self, reload=False):
+        """returns the list of installed overlays"""
+        if self._available_db is None or reload:
+            self._available_db = RemoteDB(self.config)
+        return self._available_db
 
 
     def reload(self):
@@ -389,7 +429,7 @@ class LaymanAPI(object):
     def get_errors(self):
         """returns any warning or fatal messages that occurred during
         an operation and resets it back to None
-        
+
         @rtype: list
         @return: list of error strings
         """
@@ -397,6 +437,7 @@ class LaymanAPI(object):
             messages =  self._error_messages[:]
             self._error_messages = []
             return messages
+        return []
 
 
 def create_fd():
@@ -407,5 +448,5 @@ def create_fd():
     w = os.fdopen(fd_w, 'w')
     r = os.fdopen(fd_r, 'r')
     return (r, w, fd_r, fd_w)
-    
-    
+
+

diff --git a/layman/utils.py b/layman/utils.py
index 79b3c18..67a0ab7 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -47,6 +47,8 @@ def decode_selection(selection):
     '''utility function to decode a list of strings
     accoring to the filesystem encoding
     '''
+    # fix None passed in, return an empty list
+    selection = selection or []
     enc = sys.getfilesystemencoding()
     if enc:
         return [i.decode(enc) for i in selection]



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     d7510f1f7ee5c5bec7bdba68a310c1ce17444821
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:50:08 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d7510f1f

add a linefeed to the hint message for better output separation

---
 layman/db.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index f827292..01dc454 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -58,7 +58,7 @@ class DB(DbBase):
         DbBase.__init__(self,
                           [config['local_list'], ],
                           config,
-                          ignore, 
+                          ignore,
                           quiet)
 
         self.output.debug('DB handler initiated', 6)
@@ -282,7 +282,7 @@ class RemoteDB(DbBase):
                 self.output.warn('You do not have permission to update the cache (%s).' % mpath)
                 import getpass
                 if getpass.getuser() != 'root':
-                    self.output.warn('Hint: You are not root.')
+                    self.output.warn('Hint: You are not root.\n')
                 continue
 
             try:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     5e5809bd76bcdab37a6f270a47aa57f5900d4723
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:39:47 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5e5809bd

slight code change to my modified base.
whitespace cleanup

---
 layman/action.py |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/layman/action.py b/layman/action.py
index 5d8dfd5..7199054 100644
--- a/layman/action.py
+++ b/layman/action.py
@@ -166,7 +166,7 @@ class Sync:
             OUT.info('\nSuccess:\n------\n', 3)
             for i in success:
                 OUT.info(i, 3)
-                
+
         if warnings:
             OUT.warn('\nWarnings:\n------\n', 2)
             for i in warnings:
@@ -316,10 +316,10 @@ class Info:
     * Contact : nobody@gentoo.org
     * Type    : Subversion; Priority: 10
     * Quality : experimental
-    * 
+    *
     * Description:
     *   Test
-    * 
+    *
     0
     '''
 
@@ -374,7 +374,7 @@ class List(object):
 
     def _run(self, complain):
         for summary, supported, official \
-                in self.db.list(self.config['verbose'], self.config['width']):
+                in self.db.list(None, self.config['verbose'], self.config['width']):
             # Is the overlay supported?
             if supported:
                 # Is this an official overlay?
@@ -435,22 +435,22 @@ class ListRemote(List):
     * Contact : nobody@gentoo.org
     * Type    : Subversion; Priority: 10
     * Quality : experimental
-    * 
+    *
     * Description:
     *   Test
-    * 
+    *
     * *** This is no official gentoo overlay ***
-    * 
+    *
     * wrobel-stable
     * ~~~~~~~~~~~~~
     * Source  : rsync://gunnarwrobel.de/wrobel-stable
     * Contact : nobody@gentoo.org
     * Type    : Rsync; Priority: 50
     * Quality : experimental
-    * 
+    *
     * Description:
     *   A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].
-    * 
+    *
     0
     '''
 
@@ -529,7 +529,7 @@ def main(config):
             new_umask = int(umask, 8)
             old_umask = os.umask(new_umask)
         except Exception, error:
-            OUT.die('Failed setting to umask "' + umask + '"!\nError was: ' 
+            OUT.die('Failed setting to umask "' + umask + '"!\nError was: '
                     + str(error))
 
         for i in actions:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     b214cd3e79ee70aec597262f5bb9bbaf6fdc74e5
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:46:38 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b214cd3e

Move color codes to a new file.
Add some message string constants

---
 layman/constants.py |   45 +++++++++++++++++++++++++++++++++++++++++++++
 layman/debug.py     |   22 ++++++++--------------
 2 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/layman/constants.py b/layman/constants.py
new file mode 100644
index 0000000..7fc72ea
--- /dev/null
+++ b/layman/constants.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#################################################################################
+# LAYMAN CONSTANTS
+#################################################################################
+# File:       constants.py
+#
+#             Handles layman actions via the command line interface.
+#
+# Copyright:
+#             (c) 2010 - 2011
+#                   Gunnar Wrobel
+#                   Brian Dolbec
+#             Distributed under the terms of the GNU General Public License v2
+#
+# Author(s):
+#             Gunnar Wrobel <wrobel@gentoo.org>
+#             Brian Dolbec <brian.dolbec@gmail.com
+#
+''' Provides the command line actions that can be performed by layman.'''
+
+__version__ = "$Id: constants.py 2011-01-16 23:52 PST Brian Dolbec$"
+
+
+
+
+#################################################################################
+##
+## Color codes (taken from portage)
+##
+#################################################################################
+
+esc_seq = '\x1b['
+
+codes = {}
+codes['reset']     = esc_seq + '39;49;00m'
+codes['red']       = esc_seq + '31;01m'
+codes['green']     = esc_seq + '32;01m'
+codes['yellow']    = esc_seq + '33;01m'
+codes['turquoise'] = esc_seq + '36;01m'
+
+
+NOT_OFFICIAL_MSG = '*** This is not an official gentoo overlay ***\n'
+NOT_SUPPORTED_MSG = '*** You are lacking the necessary tools' +\
+    ' to install this overlay ***\n'

diff --git a/layman/debug.py b/layman/debug.py
index e5a5d61..7c42974 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -18,20 +18,8 @@ import sys, inspect, types
 
 from   optparse      import OptionGroup
 
-#################################################################################
-##
-## Color codes (taken from portage)
-##
-#################################################################################
+from   layman.constants  import codes
 
-esc_seq = '\x1b['
-
-codes = {}
-codes['reset']     = esc_seq + '39;49;00m'
-codes['red']       = esc_seq + '31;01m'
-codes['green']     = esc_seq + '32;01m'
-codes['yellow']    = esc_seq + '33;01m'
-codes['turquoise'] = esc_seq + '36;01m'
 
 #################################################################################
 ##
@@ -112,6 +100,8 @@ class Message:
 
     def cli_opts(self, parser):
 
+        #print "Parsing debug opts"
+
         group = OptionGroup(parser,
                             '<Debugging options>',
                             'Control the debugging features of '
@@ -307,6 +297,8 @@ class Message:
 
     def info (self, info, level = 4):
 
+        #print "info =", info
+
         if type(info) not in types.StringTypes:
             info = str(info)
 
@@ -346,6 +338,8 @@ class Message:
 
     def warn (self, warn, level = 4):
 
+        #print "DEBUG.warn()"
+
         if type(warn) not in types.StringTypes:
             warn = str(warn)
 
@@ -453,7 +447,7 @@ class Message:
                     ## Remove printed characters from output
                     x = x[60:]
             ## Print final line
-            print >> self.debug_out, ls + '// ' + x 
+            print >> self.debug_out, ls + '// ' + x
 
         if self.debug_vrb == 1:
             # Top line indicates class and method



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3ae0e5c0768081314183e66f589b57a13f271af5
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:49:16 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3ae0e5c0

fix long lines and a typo, minor code improvements

---
 layman/config.py |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index ceafcc4..baa3af3 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -127,7 +127,7 @@ class BareConfig(object):
         self._options['output'].debug('Retrieving BareConfig default', 8)
         if key in self._defaults:
             if '%(storage)s' in self._defaults[key]:
-                return self._defaults[key]  %{'storage': self._defaults['storage']}
+                return self._defaults[key] %{'storage': self._defaults['storage']}
             return self._defaults[key]
         return None
 
@@ -137,7 +137,8 @@ class BareConfig(object):
 class ArgsParser(object):
     '''Handles the configuration and option parser.'''
 
-    def __init__(self, args=None, output=None, stdout=None, stdin=None, stderr=None):
+    def __init__(self, args=None, output=None,
+        stdout=None, stdin=None, stderr=None):
         '''
         Creates and describes all possible polymeraZe options and creates
         a debugging object.
@@ -150,7 +151,10 @@ class ArgsParser(object):
         >>> a['overlays']
         '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command', 'git_command', 'local_list', 'make_conf', 'mercurial_command', 'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage', 'svn_command', 'tar_command', 'umask', 'width']
+        ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command',
+        'git_command', 'local_list', 'make_conf', 'mercurial_command',
+        'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage',
+        'svn_command', 'tar_command', 'umask', 'width']
         '''
         if args == None:
             args = sys.argv
@@ -160,7 +164,10 @@ class ArgsParser(object):
         self.stdin = stdin if stdin else sys.stdin
         self.output = output if output else OUT
 
-        self.defaults = BareConfig().get_defaults()
+        self.bare_config = BareConfig(self.output, self.stdout,
+            self.stdin, self.stderr)
+        self.defaults = self.bare_config.get_defaults()
+        #print self.defaults
 
         self.parser = OptionParser(
             usage   = _USAGE,
@@ -243,13 +250,13 @@ class ArgsParser(object):
         group.add_option('-c',
                          '--config',
                          action = 'store',
-                         help = 'Path to the config file [default: '            \
+                         help = 'Path to the config file [default: ' \
                          + self.defaults['config'] + '].')
 
         group.add_option('-o',
                          '--overlays',
                          action = 'append',
-                         help = 'The list of overlays [default: '               \
+                         help = 'The list of overlays [default: ' \
                          + self.defaults['overlays'] + '].')
 
         self.parser.add_option_group(group)
@@ -296,7 +303,7 @@ class ArgsParser(object):
                          type = 'int',
                          default = '0',
                          help = 'Sets the screen width. This setting is usually '
-                         'not required as layman is capable of detecting the ava'
+                         'not required as layman is capable of detecting the '
                          'available number of columns automatically.')
 
         group.add_option('-k',
@@ -320,8 +327,10 @@ class ArgsParser(object):
             sys.exit(0)
 
         (self.options, remain_args) = self.parser.parse_args(args)
-        if len(remain_args) > 1:  # remain_args starts with something like "bin/layman" ...
-            self.parser.error("Unhandled parameters: %s" % ', '.join(('"%s"' % e) for e in remain_args[1:]))
+        # remain_args starts with something like "bin/layman" ...
+        if len(remain_args) > 1:
+            self.parser.error("Unhandled parameters: %s"
+                % ', '.join(('"%s"' % e) for e in remain_args[1:]))
 
         # handle debugging
         self.output.cli_handle(self.options)
@@ -333,7 +342,7 @@ class ArgsParser(object):
         self.options.__dict__['stdout'] = self.stdout
         self.options.__dict__['stdin'] = self.stdin
         self.options.__dict__['stderr'] = self.stderr
-        
+
 
         if self.options.__dict__['nocolor']:
             self.output.color_off()



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     4fbff6fc56d92aaba151bf2a02d27464425f1644
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 17 06:41:32 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4fbff6fc

add optional repo list limiter to the list function

---
 layman/dbbase.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 50ec4ed..7eaa1cf 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -199,7 +199,7 @@ class DbBase:
             raise UnknownOverlayException(overlay)
         return self.overlays[overlay]
 
-    def list(self, verbose = False, width = 0):
+    def list(self, repos=None, verbose = False, width = 0):
         '''
         List all overlays.
 
@@ -236,8 +236,11 @@ class DbBase:
         '''
         result = []
 
-        for _, overlay in self.overlays.items():
+        selection = [overlay for (a, overlay) in self.overlays.items()]
+        if repos:
+            selection = [overlay for overlay in selection if overlay.name in repos]
 
+        for overlay in selection:
             if verbose:
                 result.append((str(overlay), overlay.is_supported(),
                                overlay.is_official()))



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8802626d9ca6c325213f3d19b7da696892c6c1fe
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Fri Jul 16 21:04:24 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8802626d

remove the extra comma that wrapped the dict in a tuple.

---
 layman/api.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index c4e6a15..7784861 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -211,7 +211,7 @@ class LaymanAPI(object):
                     'status': overlay.status,
                     'official': overlay.is_official(),
                     'supported': overlay.is_supported(),
-                    },
+                    }
 
         return result
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     ae654d7a403eb2d018543a9034a408689f26484c
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Nov 15 00:25:36 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ae654d7a

update to using basestring instead of str.
Otherwise assume it is an iterable.

---
 layman/api.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index a3ac497..4dacf99 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -99,11 +99,12 @@ class LaymanAPI(object):
         converting a string to a list[string] if it is not already a list.
         produces and error message if it is any other type
         returns repos as list always"""
-        if isinstance(repos, str):
+        if isinstance(repos, basestring):
             repos = [repos]
-        elif not isinstance(repos, list):
-            self._error(2, "%s(), Unsupported input type: %s" %(caller, str(type(repos))))
-            return []
+        # else assume it is an iterable, if not it will error
+        #~ elif not isinstance(repos, list):
+            #~ self._error(2, "%s(), Unsupported input type: %s" %(caller, str(type(repos))))
+            #~ return []
         return repos
 
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     11ba6a09a61778dbe873246d9c4bcfb875f351d9
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Fri Jul 16 14:10:49 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=11ba6a09

change add_repo and delete_repo to add_repos,
 delete_repos to reflect they can take a list.
fix the dumb error in get_errors().
change get_info() to get_info_str() and code get_all_info()
 that returns data instead of the string representation of it.

---
 layman/api.py |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index b6ff86a..c4e6a15 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -96,7 +96,7 @@ class LaymanAPI(object):
         return repos
 
 
-    def delete_repo(self, repos):
+    def delete_repos(self, repos):
         """delete the selected repo from the system
         
         @type repos: list of strings or string
@@ -127,7 +127,7 @@ class LaymanAPI(object):
         return True
 
 
-    def add_repo(self, repos):
+    def add_repos(self, repos):
         """installs the seleted repo id
         
         @type repos: list of strings or string
@@ -158,13 +158,72 @@ class LaymanAPI(object):
         return True
 
 
-    def get_info(self, repos):
-        """retirves the recorded information about the repo specified by id
+    def get_all_info(self, repos):
+        """retrieves the recorded information about the repo(s)
+        specified by id
         
         @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype list of tuples [(str, bool, bool),...]
-        @return: dictionary  {'id': (info, official, supported)}
+        @return: dictionary of dictionaries  
+        {'id1':
+            {'name': str,
+            'owner_name': str,
+            'owner_email': str,
+            ' homepage': str,
+            'description': str,
+            'src_uris': list of str ['uri1',...]
+            'src_type': str,
+            'priority': int,
+            'quality': str 
+            'status':,
+            'official': bool,
+            'supported': bool,
+            },
+        'id2': {...}
+        }
+        """
+        
+        # In progress, has, been coded to the above dict. yet.
+        repos = self._check_repo_type(repos, "get_info")
+        result = {}
+
+        for id in repos:
+            if not self.is_repo(id):
+                self._error(1, UNKNOWN_REPO_ID %id)
+                result[id] = ('', False, False)
+            try:
+                overlay = self._available_db.select(id)
+            except UnknownOverlayException, error:
+                self._error(2, "Error: %s" %str(error))
+                result[id] = ('', False, False)
+            else:
+                result[id] = {
+                    'name': overlay.name,
+                    'owner_name': overlay.owner_name,
+                    'owner_email': overlay.owner_email,
+                    'homepage': overlay.homepage,
+                    'description': overlay.description,
+                    'src_uris': overlay.source_uris(),
+                    'src_type': overlay.sources[0].type,
+                    'priority': overlay.priority,
+                    'quality': overlay.quality, 
+                    'status': overlay.status,
+                    'official': overlay.is_official(),
+                    'supported': overlay.is_supported(),
+                    },
+
+        return result
+
+
+    def get_info_str(self, repos):
+        """retirves the string representation of the recorded information
+        about the repo(s) specified by id
+        
+        @type repos: list of strings or string
+        @param repos: ['repo-id1', ...] or 'repo-id'
+        @rtype list of tuples [(str, bool, bool),...]
+        @return: dictionary  {'id': (info string, official, supported)}
         """
         repos = self._check_repo_type(repos, "get_info")
         result = {}
@@ -319,10 +378,14 @@ class LaymanAPI(object):
     def get_errors(self):
         """returns any warning or fatal messages that occurred during
         an operation and resets it back to None
+        
+        @rtype: list
+        @return: list of error strings
         """
         if self._error_messages:
-            return self._error_messages[:]
+            messages =  self._error_messages[:]
             self._error_messages = []
+            return messages
 
 
 def create_fd():



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     63789af9d74191578d21159f0b19af524134eb9f
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jul 11 22:21:56 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=63789af9

make the sync_results saved every time rather than conditional.

---
 layman/api.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index daf57a9..e3db37a 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -266,8 +266,8 @@ class LaymanAPI(object):
                 for id, result in fatals:
                     self.output.error(result + '\n')
                 return False
-        else:
-            self.sync_results = (success, warnings, fatals)
+
+        self.sync_results = (success, warnings, fatals)
 
         return True
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     5609d5d6f73b4e15477a4851c1f9701866b5a3c2
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Fri Jul 16 00:52:54 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5609d5d6

fix the docstrings to match current input types.

---
 layman/api.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index e3db37a..b6ff86a 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -99,8 +99,8 @@ class LaymanAPI(object):
     def delete_repo(self, repos):
         """delete the selected repo from the system
         
-       @type repos: list
-        @param repos: ['repo-id1', ...]
+        @type repos: list of strings or string
+        @param repos: ['repo-id1', ...] or 'repo-id'
         @param output: method to handle output if desired
         @rtype dict
         """
@@ -130,8 +130,8 @@ class LaymanAPI(object):
     def add_repo(self, repos):
         """installs the seleted repo id
         
-        @type repos: list
-        @param repos: ['repo-id1', ...]
+        @type repos: list of strings or string
+        @param repos: ['repo-id1', ...] or 'repo-id'
         @param output: method to handle output if desired
         @rtype dict
         """
@@ -161,8 +161,8 @@ class LaymanAPI(object):
     def get_info(self, repos):
         """retirves the recorded information about the repo specified by id
         
-        @type repos: list
-        @param repos: ['repo-id1', ...]
+        @type repos: list of strings or string
+        @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype list of tuples [(str, bool, bool),...]
         @return: dictionary  {'id': (info, official, supported)}
         """
@@ -191,7 +191,7 @@ class LaymanAPI(object):
     def sync(self, repos, output_results=True):
         """syncs the specified repo(s) specified by repos
         
-        @type repos: list or string
+        @type repos: list of strings or string
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype bool or {'repo-id': bool,...}
         """



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     5a949d21c92aa729490bd9aa268354c5c08844ee
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jul 11 21:04:57 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5a949d21

fix some typos, copy/paste errors, and debug/fix some changes to the api.

---
 layman/api.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 902a951..daf57a9 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -172,18 +172,18 @@ class LaymanAPI(object):
         for id in repos:
             if not self.is_repo(id):
                 self._error(1, UNKNOWN_REPO_ID %id)
-                result[id] = ('', False, False))
+                result[id] = ('', False, False)
             try:
                 overlay = self._available_db.select(id)
             except UnknownOverlayException, error:
                 self._error(2, "Error: %s" %str(error))
-                 result[id] = ('', False, False))
+                result[id] = ('', False, False)
             else:
                 # Is the overlay supported?
                 info = overlay.__str__()
                 official = overlay.is_official()
                 supported = overlay.is_supported()
-                 result[id] = (info, official, supported)
+                result[id] = (info, official, supported)
 
         return result
 
@@ -195,7 +195,7 @@ class LaymanAPI(object):
         @param repos: ['repo-id1', ...] or 'repo-id'
         @rtype bool or {'repo-id': bool,...}
         """
-        fatal = []
+        fatals = []
         warnings = []
         success  = []
         repos = self._check_repo_type(repos, "sync")
@@ -210,7 +210,7 @@ class LaymanAPI(object):
             try:
                 ordb = self._available_db.select(id)
             except UnknownOverlayException:
-                message = 'Overlay "%s" could not be found in the remote lists.\n'
+                message = 'Overlay "%s" could not be found in the remote lists.\n' \
                         'Please check if it has been renamed and re-add if necessary.' %id
                 warnings.append((id, message))
             else:
@@ -253,17 +253,17 @@ class LaymanAPI(object):
         if output_results:
             if success:
                 self.output.info('\nSuccess:\n------\n', 3)
-                for result in success:
+                for id, result in success:
                     self.output.info(result, 3)
                     
             if warnings:
                 self.output.warn('\nWarnings:\n------\n', 2)
-                for result in warnings:
+                for id, result in warnings:
                     self.output.warn(result + '\n', 2)
 
             if fatals:
                 self.output.error('\nErrors:\n------\n')
-                for result in fatals:
+                for id, result in fatals:
                     self.output.error(result + '\n')
                 return False
         else:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     e4b3560bf8b8dbce3c992086a5697fea7aefa200
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jul 11 08:54:22 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e4b3560b

Remove the Output class as it is not needed, was used for initial testing only.

---
 layman/api.py |   63 ---------------------------------------------------------
 1 files changed, 0 insertions(+), 63 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index e17d70e..902a951 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -325,69 +325,6 @@ class LaymanAPI(object):
             self._error_messages = []
 
 
-class Output(Message):
-    """a subclass of debug.py's Message to overide several output functions
-    for data capture.  May not be in final api"""
-    
-    def __init__(self, error=stderr):
-        self.stderr = error
-        self.captured = []
-        Message.__init__(self, err=error)
-
-    def notice (self, note):
-        self.captured.append(note)
-
-    def info (self, info, level = 4):
-
-        if type(info) not in types.StringTypes:
-            info = str(info)
-
-        if level > self.info_lev:
-            return
-
-        for i in info.split('\n'):
-            self.captured.append(self.maybe_color('green', '* ') + i)
-
-    def status (self, message, status, info = 'ignored'):
-
-        if type(message) not in types.StringTypes:
-            message = str(message)
-
-        lines = message.split('\n')
-
-        if not lines:
-            return
-
-        for i in lines[0:-1]:
-            self.captured.append(self.maybe_color('green', '* ') + i)
-
-        i = lines[-1]
-
-        if len(i) > 58:
-            i = i[0:57]
-
-        if status == 1:
-            result = '[' + self.maybe_color('green', 'ok') + ']'
-        elif status == 0:
-            result = '[' + self.maybe_color('red', 'failed') + ']'
-        else:
-            result = '[' + self.maybe_color('yellow', info) + ']'
-
-        self.captured.append( self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i))  \
-              + ' ' + result)
-
-    def warn (self, warn, level = 4):
-
-        if type(warn) not in types.StringTypes:
-            warn = str(warn)
-
-        if level > self.warn_lev:
-            return
-
-        for i in warn.split('\n'):
-            self.captured.append(self.maybe_color('yellow', '* ') + i)
-
-
 def create_fd():
     """creates file descriptor pairs an opens them ready for
     use in place of stdin, stdout, stderr.



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     bb446c2f548b08ad745ff8b608383314e76a9224
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jul 11 04:22:40 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=bb446c2f

Add a get_option function as a convenience function for option retrieval instead of using the class instance as a dictionary.

---
 layman/config.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 5ad67f2..e62f535 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -108,6 +108,11 @@ class BareConfig(object):
         return self._defaults
 
 
+    def get_option(self, key):
+        """returns the current option's value"""
+        return self.__getitem__(key)
+
+
     def set_option(self, option, value):
         """Sets an option to the value """
         self._options[option] = value



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     af8c821f1b6c1a48b5ce2f6ba328ba9ff8807a9d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jul 11 04:20:44 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=af8c821f

Modify the API to be more compatible with a c interface.
Make all main repo functions accept either a string or a list of strings.
Change most functions to return True/False for success/failure and save error messages for separate retrieval.
Change other functions to return a dictionary instead of tuples or lists.
Add a get_errors() for retrieving and resetting error messages.
Change sync to either save or print the success, warnings, fatals info.

---
 layman/api.py |  124 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 87 insertions(+), 37 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index f163f86..e17d70e 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -58,6 +58,8 @@ class LaymanAPI(object):
         self._installed_ids = None
         self._available_db = None
         self._available_ids = None
+        self._error_messages = []
+        self.sync_results = []
         # call reload() for now to initialize the 2 db's
         self.reload()
         # change it to delayed loading (similar to delayed imports)
@@ -84,6 +86,16 @@ class LaymanAPI(object):
         return id in self._installed_ids
 
 
+    @staticmethod
+    def _check_repo_type( repos, caller):
+        if isinstance(repos, str):
+            repos = [repos]
+        elif not isinstance(repos, list):
+            self._error(2, "%s(), Unsupported input type: %s" %(caller, str(type(repos))))
+            return []
+        return repos
+
+
     def delete_repo(self, repos):
         """delete the selected repo from the system
         
@@ -92,24 +104,27 @@ class LaymanAPI(object):
         @param output: method to handle output if desired
         @rtype dict
         """
-        results = {}
+        repos = self._check_repo_type(repos, "delete_repo")
+        results = []
         for id in repos:
             if not self.is_installed(id):
-                results[id] = True
+                results.append(True)
                 break
             if not self.is_repo(id):
-                self.error(1, UNKNOWN_REPO_ID %id)
-                results[id] = False
+                self._error(1, UNKNOWN_REPO_ID %id)
+                results.append(False)
                 break
             try:
                 self._installed_db.delete(self._installed_db.select(id))
-                results[id] = True
+                results.append(True)
             except Exception, e:
-                self.error(ERROR_INTERNAL_ERROR,
+                self._error(ERROR_INTERNAL_ERROR,
                         "Failed to disable repository '"+id+"':\n"+str(e))
-                results[id] = False
+                results.append(False)
             self.get_installed(reload=True)
-        return results
+        if False in results:
+            return False
+        return True
 
 
     def add_repo(self, repos):
@@ -120,24 +135,27 @@ class LaymanAPI(object):
         @param output: method to handle output if desired
         @rtype dict
         """
-        results = {}
+        repos = self._check_repo_type(repos, "add_repo")
+        results = []
         for id in repos:
             if self.is_installed(id):
-                results[id] = True
+                results.append(True)
                 break
             if not self.is_repo(id):
-                self.error(1, UNKNOWN_REPO_ID %id)
-                results[id] = False
+                self._error(1, UNKNOWN_REPO_ID %id)
+                results.append(False)
                 break
             try:
                 self._installed_db.add(self._available_db.select(id), quiet=True)
-                results[id] = True
+                results.append(True)
             except Exception, e:
-                self.error(ERROR_INTERNAL_ERROR,
+                self._error(ERROR_INTERNAL_ERROR,
                         "Failed to enable repository '"+id+"' : "+str(e))
-                results[id] = False
+                results.append(False)
             self.get_installed(reload=True)
-        return results
+        if False in results:
+            return False
+        return True
 
 
     def get_info(self, repos):
@@ -146,53 +164,55 @@ class LaymanAPI(object):
         @type repos: list
         @param repos: ['repo-id1', ...]
         @rtype list of tuples [(str, bool, bool),...]
-        @return: (info, official, supported)
+        @return: dictionary  {'id': (info, official, supported)}
         """
-        result = []
+        repos = self._check_repo_type(repos, "get_info")
+        result = {}
 
         for id in repos:
             if not self.is_repo(id):
-                self.error(1, UNKNOWN_REPO_ID %id)
-                result.append(('', False, False))
+                self._error(1, UNKNOWN_REPO_ID %id)
+                result[id] = ('', False, False))
             try:
                 overlay = self._available_db.select(id)
             except UnknownOverlayException, error:
-                self.error(2, "Error: %s" %str(error))
-                result.append(('', False, False))
+                self._error(2, "Error: %s" %str(error))
+                 result[id] = ('', False, False))
             else:
                 # Is the overlay supported?
                 info = overlay.__str__()
                 official = overlay.is_official()
                 supported = overlay.is_supported()
-                result.append((info, official, supported))
+                 result[id] = (info, official, supported)
 
         return result
 
 
-    def sync(self, repos):
+    def sync(self, repos, output_results=True):
         """syncs the specified repo(s) specified by repos
         
-        @type repos: list
-        @param repos: ['repo-id1', ...]
-        @rtype bool
+        @type repos: list or string
+        @param repos: ['repo-id1', ...] or 'repo-id'
+        @rtype bool or {'repo-id': bool,...}
         """
-        
-        fatals = []
+        fatal = []
         warnings = []
         success  = []
+        repos = self._check_repo_type(repos, "sync")
+
         for id in repos:
             try:
                 odb = self._installed_db.select(id)
             except UnknownOverlayException, error:
-                fatals.append((id, str(error)))
+                self._error(1,"Sync(), failed to select %s overlay.  Original error was: %s" %(id, str(error)))
                 continue
 
             try:
                 ordb = self._available_db.select(id)
             except UnknownOverlayException:
-                warnings.append((id,
-                    'Overlay "%s" could not be found in the remote lists.\n'
-                    'Please check if it has been renamed and re-add if necessary.', {'repo_name':id}))
+                message = 'Overlay "%s" could not be found in the remote lists.\n'
+                        'Please check if it has been renamed and re-add if necessary.' %id
+                warnings.append((id, message))
             else:
                 current_src = odb.sources[0].src
                 available_srcs = set(e.src for e in ordb.sources)
@@ -230,7 +250,26 @@ class LaymanAPI(object):
                     'Failed to sync overlay "' + id + '".\nError was: '
                     + str(error)))
 
-        return (warnings, success, fatals)
+        if output_results:
+            if success:
+                self.output.info('\nSuccess:\n------\n', 3)
+                for result in success:
+                    self.output.info(result, 3)
+                    
+            if warnings:
+                self.output.warn('\nWarnings:\n------\n', 2)
+                for result in warnings:
+                    self.output.warn(result + '\n', 2)
+
+            if fatals:
+                self.output.error('\nErrors:\n------\n')
+                for result in fatals:
+                    self.output.error(result + '\n')
+                return False
+        else:
+            self.sync_results = (success, warnings, fatals)
+
+        return True
 
 
     def fetch_remote_list(self):
@@ -238,7 +277,7 @@ class LaymanAPI(object):
         try:
             self._available_db.cache()
         except Exception, error:
-            self.error(-1,'Failed to fetch overlay list!\n Original Error was: '
+            self._error(-1,'Failed to fetch overlay list!\n Original Error was: '
                     + str(error))
             return False
         return True
@@ -266,13 +305,24 @@ class LaymanAPI(object):
         result = self.get_installed(reload=True)
 
 
-    def error(self, num, message):
+    def _error(self, num, message):
         """outputs the error to the pre-determined output
         defaults to stderr.  This method may be removed, is here for now
         due to code taken from the packagekit backend.
         """
+        m = "Error: %d," %num, message
+        self._error_messages.append(m)
         if self.report_errors:
-            print >>stderr, "Error: %d," %num, message
+            print >>stderr, m
+
+
+    def get_errors(self):
+        """returns any warning or fatal messages that occurred during
+        an operation and resets it back to None
+        """
+        if self._error_messages:
+            return self._error_messages[:]
+            self._error_messages = []
 
 
 class Output(Message):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     423dda9923eef331670ab3e79266e5d0ca19a699
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 01:42:53 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=423dda99

fix results tracking

---
 layman/api.py |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 062a96b..52dcd3d 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -95,19 +95,19 @@ class LaymanAPI(object):
         results = {}
         for id in repos:
             if not self.is_installed(id):
-                results[i] = True
+                results[id] = True
                 break
             if not self.is_repo(id):
                 self.error(1, UNKNOWN_REPO_ID %id)
-                results[i] = False
+                results[id] = False
                 break
             try:
                 self._installed_db.delete(self._installed_db.select(id))
-                results[i] = True
+                results[id] = True
             except Exception, e:
                 self.error(ERROR_INTERNAL_ERROR,
                         "Failed to disable repository '"+id+"':\n"+str(e))
-                results[i] = False
+                results[id] = False
             self.get_installed(reload=True)
         return results
 
@@ -123,19 +123,19 @@ class LaymanAPI(object):
         results = {}
         for id in repos:
             if self.is_installed(id):
-                results[i] = True
+                results[id] = True
                 break
             if not self.is_repo(id):
                 self.error(1, UNKNOWN_REPO_ID %id)
-                results[i] = False
+                results[id] = False
                 break
             try:
                 self._installed_db.add(self._available_db.select(id), quiet=True)
-                results[i] = True
+                results[id] = True
             except Exception, e:
                 self.error(ERROR_INTERNAL_ERROR,
                         "Failed to enable repository '"+id+"' : "+str(e))
-                results[i] = False
+                results[id] = False
             self.get_installed(reload=True)
         return results
 
@@ -150,12 +150,12 @@ class LaymanAPI(object):
         """
         result = []
 
-        for i in repos:
+        for id in repos:
             if not self.is_repo(id):
                 self.error(1, UNKNOWN_REPO_ID %id)
                 result.append(('', False, False))
             try:
-                overlay = self._available_db.select(i)
+                overlay = self._available_db.select(id)
             except UnknownOverlayException, error:
                 self.error(2, "Error: %s" %str(error))
                 result.append(('', False, False))
@@ -184,19 +184,19 @@ class LaymanAPI(object):
         fatals = []
         warnings = []
         success  = []
-        for i in repos:
+        for id in repos:
             try:
-                odb = self._installed_db.select(i)
+                odb = self._installed_db.select(id)
             except UnknownOverlayException, error:
-                fatals.append((i, str(error)))
+                fatals.append((id, str(error)))
                 continue
 
             try:
-                ordb = self._available_db.select(i)
+                ordb = self._available_db.select(id)
             except UnknownOverlayException:
-                warnings.append((i,
+                warnings.append((id,
                     'Overlay "%s" could not be found in the remote lists.\n'
-                    'Please check if it has been renamed and re-add if necessary.', {'repo_name':i}))
+                    'Please check if it has been renamed and re-add if necessary.', {'repo_name':id}))
             else:
                 current_src = odb.sources[0].src
                 available_srcs = set(e.src for e in ordb.sources)
@@ -206,9 +206,9 @@ class LaymanAPI(object):
                         candidates = '  %s' % tuple(available_srcs)[0]
                     else:
                         plural = 's'
-                        candidates = '\n'.join(('  %d. %s' % (i + 1, v)) for i, v in enumerate(available_srcs))
+                        candidates = '\n'.join(('  %d. %s' % (id + 1, v)) for id, v in enumerate(available_srcs))
 
-                    warnings.append((i,
+                    warnings.append((id,
                         'The source of the overlay "%(repo_name)s" seems to have changed.\n'
                         'You currently sync from\n'
                         '\n'
@@ -220,17 +220,17 @@ class LaymanAPI(object):
                         '\n'
                         'as correct location%(plural)s.\n'
                         'Please consider removing and re-adding the overlay.' , {
-                            'repo_name':i,
+                            'repo_name':id,
                             'current_src':current_src,
                             'candidates':candidates,
                             'plural':plural,
                             }))
 
             try:
-                self._installed_db.sync(i, self.config['quiet'])
-                success.append((i,'Successfully synchronized overlay "' + i + '".'))
+                self._installed_db.sync(id, self.config['quiet'])
+                success.append((id,'Successfully synchronized overlay "' + id + '".'))
             except Exception, error:
-                fatals.append((i,
+                fatals.append((id,
                     'Failed to sync overlay "' + i + '".\nError was: '
                     + str(error)))
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     b0fec599217155459e26aba627f3297a7e857a09
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 01:20:56 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:49:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b0fec599

add new layman API file and class to be used by api consumers, but could also be used by the cli if they desire to migrate to it.  That would eliminate the duplication in hte action.py file.  Unfortunately, the action classes were not suitable for api consumers.  They worked efficiently as one time cli use only. I also have subclassed the debug.py's Message class to override some print statements for data capture instead.  This may not survive when the api is completed.  create_fd() is handy for creating opened file descriptors to use for output re-direction.

---
 layman/api.py |  354 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 354 insertions(+), 0 deletions(-)

diff --git a/layman/api.py b/layman/api.py
new file mode 100644
index 0000000..062a96b
--- /dev/null
+++ b/layman/api.py
@@ -0,0 +1,354 @@
+#!python
+# -*- coding: utf-8 -*-
+#######################################################################
+# LAYMAN - A UTILITY TO SELECT AND UPDATE GENTOO OVERLAYS
+#######################################################################
+# Distributed under the terms of the GNU General Public License v2
+#
+# Copyright:
+#             (c) 2010 Brian Dolbec
+#             Distributed under the terms of the GNU General Public License v2
+#
+# Author(s):
+#              Brian Dolbec <dol-sen@sourceforge.net>
+#
+
+from sys import stderr, stdin, stdout
+import os, types
+
+from layman.config import Config
+#from layman.action import Sync
+
+from layman.dbbase import UnknownOverlayException
+from layman.db import DB, RemoteDB
+#from layman.utils import path, delete_empty_directory
+from layman.debug import Message, OUT
+
+# give them some values for now, these are from the packagekit backend
+# TODO  establish some proper errors for the api.
+ERROR_REPO_NOT_FOUND = -1
+ERROR_INTERNAL_ERROR = -2
+UNKNOWN_REPO_ID = "Repo ID '%s' " + \
+        "is not listed in the current available overlays list"
+
+# In order to redirect output you need to get a Message class instance with the
+# stderr, stdout, stddebug directed to where you want.
+# eg:  output = Message('layman', err=mystderr, dbg=mydebug, out=myoutput)
+# there are many more options available, refer to debug.py Message class
+
+
+class LaymanAPI(object):
+    """class to hold and run a layman instance for use by API consumer apps, guis, etc.
+    """
+    ## hell, even the current cli should probably be converted to use this one.
+    ## It is a near duplicate of the actions classes.
+
+    def __init__(self, config=None, report_errors=False, output=None):
+        """@param configfile, optional config file to use instead of the default
+        """
+        
+        self.output = output if output  else OUT
+       
+        self.config = config if config else Config(output=output)
+        
+        self.report_errors = report_errors
+        
+        # get installed and available dbs
+        self._installed_db = None
+        self._installed_ids = None
+        self._available_db = None
+        self._available_ids = None
+        # call reload() for now to initialize the 2 db's
+        self.reload()
+        # change it to delayed loading (similar to delayed imports)
+        # to simplify some of the code and make it automagic.
+
+
+    def is_repo(self, id):
+        """validates that the id given is a known repo id
+        
+        @param id: repo id
+        @type id: str
+        @rtype boolean
+        """
+        return id in self._available_ids
+
+
+    def is_installed(self, id):
+        """checks the repo id is a known installed repo id
+        
+        @param id: repo id
+        @type id: str
+        @rtype boolean
+        """
+        return id in self._installed_ids
+
+
+    def delete_repo(self, repos):
+        """delete the selected repo from the system
+        
+       @type repos: list
+        @param repos: ['repo-id1', ...]
+        @param output: method to handle output if desired
+        @rtype dict
+        """
+        results = {}
+        for id in repos:
+            if not self.is_installed(id):
+                results[i] = True
+                break
+            if not self.is_repo(id):
+                self.error(1, UNKNOWN_REPO_ID %id)
+                results[i] = False
+                break
+            try:
+                self._installed_db.delete(self._installed_db.select(id))
+                results[i] = True
+            except Exception, e:
+                self.error(ERROR_INTERNAL_ERROR,
+                        "Failed to disable repository '"+id+"':\n"+str(e))
+                results[i] = False
+            self.get_installed(reload=True)
+        return results
+
+
+    def add_repo(self, repos):
+        """installs the seleted repo id
+        
+        @type repos: list
+        @param repos: ['repo-id1', ...]
+        @param output: method to handle output if desired
+        @rtype dict
+        """
+        results = {}
+        for id in repos:
+            if self.is_installed(id):
+                results[i] = True
+                break
+            if not self.is_repo(id):
+                self.error(1, UNKNOWN_REPO_ID %id)
+                results[i] = False
+                break
+            try:
+                self._installed_db.add(self._available_db.select(id), quiet=True)
+                results[i] = True
+            except Exception, e:
+                self.error(ERROR_INTERNAL_ERROR,
+                        "Failed to enable repository '"+id+"' : "+str(e))
+                results[i] = False
+            self.get_installed(reload=True)
+        return results
+
+
+    def get_info(self, repos):
+        """retirves the recorded information about the repo specified by id
+        
+        @type repos: list
+        @param repos: ['repo-id1', ...]
+        @rtype list of tuples [(str, bool, bool),...]
+        @return: (info, official, supported)
+        """
+        result = []
+
+        for i in repos:
+            if not self.is_repo(id):
+                self.error(1, UNKNOWN_REPO_ID %id)
+                result.append(('', False, False))
+            try:
+                overlay = self._available_db.select(i)
+            except UnknownOverlayException, error:
+                self.error(2, "Error: %s" %str(error))
+                result.append(('', False, False))
+            else:
+                # Is the overlay supported?
+                info = overlay.__str__()
+                official = overlay.is_official()
+                supported = overlay.is_supported()
+                result.append((info, official, supported))
+
+        return result
+
+
+    def sync(self, repos):
+        """syncs the specified repo(s) specified by repos
+        
+        @type repos: list
+        @param repos: ['repo-id1', ...]
+        @rtype bool
+        """
+        # currently uses a modified Sync class with a few added parameters,
+        # but should be re-written into here for a better fit and output
+        #_sync = Sync(self.config, repos, db=self._installed_db, rdb=self._available_db)
+        #_sync.run()
+        
+        fatals = []
+        warnings = []
+        success  = []
+        for i in repos:
+            try:
+                odb = self._installed_db.select(i)
+            except UnknownOverlayException, error:
+                fatals.append((i, str(error)))
+                continue
+
+            try:
+                ordb = self._available_db.select(i)
+            except UnknownOverlayException:
+                warnings.append((i,
+                    'Overlay "%s" could not be found in the remote lists.\n'
+                    'Please check if it has been renamed and re-add if necessary.', {'repo_name':i}))
+            else:
+                current_src = odb.sources[0].src
+                available_srcs = set(e.src for e in ordb.sources)
+                if ordb and odb and not current_src in available_srcs:
+                    if len(available_srcs) == 1:
+                        plural = ''
+                        candidates = '  %s' % tuple(available_srcs)[0]
+                    else:
+                        plural = 's'
+                        candidates = '\n'.join(('  %d. %s' % (i + 1, v)) for i, v in enumerate(available_srcs))
+
+                    warnings.append((i,
+                        'The source of the overlay "%(repo_name)s" seems to have changed.\n'
+                        'You currently sync from\n'
+                        '\n'
+                        '  %(current_src)s\n'
+                        '\n'
+                        'while the remote lists report\n'
+                        '\n'
+                        '%(candidates)s\n'
+                        '\n'
+                        'as correct location%(plural)s.\n'
+                        'Please consider removing and re-adding the overlay.' , {
+                            'repo_name':i,
+                            'current_src':current_src,
+                            'candidates':candidates,
+                            'plural':plural,
+                            }))
+
+            try:
+                self._installed_db.sync(i, self.config['quiet'])
+                success.append((i,'Successfully synchronized overlay "' + i + '".'))
+            except Exception, error:
+                fatals.append((i,
+                    'Failed to sync overlay "' + i + '".\nError was: '
+                    + str(error)))
+
+        return (warnings, success, fatals)
+
+
+    def fetch_remote_list(self):
+        """Fetches the latest remote overlay list"""
+        try:
+            self._available_db.cache()
+        except Exception, error:
+            self.error(-1,'Failed to fetch overlay list!\n Original Error was: '
+                    + str(error))
+            return False
+        return True
+
+
+    def get_available(self, reload=False):
+        """returns the list of available overlays"""
+        if not self._available_db or reload:
+            self._available_db = RemoteDB(self.config)
+            self._available_ids = sorted(self._available_db.overlays)
+        return self._available_ids[:]
+
+
+    def get_installed(self, reload=False):
+        """returns the list of installed overlays"""
+        if not self._installed_db or reload:
+            self._installed_db = DB(self.config)
+            self._installed_ids = sorted(self._installed_db.overlays)
+        return self._installed_ids[:]
+
+
+    def reload(self):
+        """reloads the installed and remote db's to the data on disk"""
+        result = self.get_available(reload=True)
+        result = self.get_installed(reload=True)
+
+
+    def error(self, num, message):
+        """outputs the error to the pre-determined output
+        defaults to stderr.  This method may be removed, is here for now
+        due to code taken from the packagekit backend.
+        """
+        if self.report_errors:
+            print >>stderr, "Error: %d," %num, message
+
+
+class Output(Message):
+    """a subclass of debug.py's Message to overide several output functions
+    for data capture.  May not be in final api"""
+    
+    def __init__(self, error=stderr):
+        self.stderr = error
+        self.captured = []
+        Message.__init__(self, err=error)
+
+    def notice (self, note):
+        self.captured.append(note)
+
+    def info (self, info, level = 4):
+
+        if type(info) not in types.StringTypes:
+            info = str(info)
+
+        if level > self.info_lev:
+            return
+
+        for i in info.split('\n'):
+            self.captured.append(self.maybe_color('green', '* ') + i)
+
+    def status (self, message, status, info = 'ignored'):
+
+        if type(message) not in types.StringTypes:
+            message = str(message)
+
+        lines = message.split('\n')
+
+        if not lines:
+            return
+
+        for i in lines[0:-1]:
+            self.captured.append(self.maybe_color('green', '* ') + i)
+
+        i = lines[-1]
+
+        if len(i) > 58:
+            i = i[0:57]
+
+        if status == 1:
+            result = '[' + self.maybe_color('green', 'ok') + ']'
+        elif status == 0:
+            result = '[' + self.maybe_color('red', 'failed') + ']'
+        else:
+            result = '[' + self.maybe_color('yellow', info) + ']'
+
+        self.captured.append( self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i))  \
+              + ' ' + result)
+
+    def warn (self, warn, level = 4):
+
+        if type(warn) not in types.StringTypes:
+            warn = str(warn)
+
+        if level > self.warn_lev:
+            return
+
+        for i in warn.split('\n'):
+            self.captured.append(self.maybe_color('yellow', '* ') + i)
+
+
+def create_fd():
+    """creates file descriptor pairs an opens them ready for
+    use in place of stdin, stdout, stderr.
+    """
+    fd_r, fd_w = os.pipe()
+    w = os.fdopen(fd_w, 'w')
+    r = os.fdopen(fd_r, 'r')
+    return (r, w, fd_r, fd_w)
+    
+    



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     c387c4eff9eb13ece3108cf1b5818d0ba6551f1f
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 01:07:41 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:46:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c387c4ef

Add an output parameter to Message class and change the prints that weren't already re-directed to re-direct to it

---
 layman/debug.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/layman/debug.py b/layman/debug.py
index 41d084c..e5a5d61 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -44,6 +44,7 @@ class Message:
     #       next time.
 
     def __init__(self, module = '',
+                 out = sys.stdout,
                  err = sys.stderr,
                  dbg = sys.stderr,
                  debugging_level = 4,
@@ -54,6 +55,7 @@ class Message:
                  mth = None,
                  obj = None,
                  var = None):
+
         if mth == None: mth = ['*']
         if obj == None: obj = ['*']
         if var == None: var = ['*']
@@ -67,6 +69,9 @@ class Message:
         # Where should the error output go? This can also be a file
         self.error_out = err
 
+        # Where should the normal output go? This can also be a file
+        self.std_out = out
+
         # The higher the level the more information you will get
         self.warn_lev = warn_level
 
@@ -298,7 +303,7 @@ class Message:
     ## Output Functions
 
     def notice (self, note):
-        print note
+        print >> self.std_out, note
 
     def info (self, info, level = 4):
 
@@ -309,7 +314,7 @@ class Message:
             return
 
         for i in info.split('\n'):
-            print self.maybe_color('green', '* ') + i
+            print  >> self.std_out, self.maybe_color('green', '* ') + i
 
     def status (self, message, status, info = 'ignored'):
 
@@ -322,7 +327,7 @@ class Message:
             return
 
         for i in lines[0:-1]:
-            print self.maybe_color('green', '* ') + i
+            print  >> self.std_out, self.maybe_color('green', '* ') + i
 
         i = lines[-1]
 
@@ -336,7 +341,7 @@ class Message:
         else:
             result = '[' + self.maybe_color('yellow', info) + ']'
 
-        print self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i))  \
+        print  >> self.std_out, self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i))  \
               + ' ' + result
 
     def warn (self, warn, level = 4):
@@ -348,7 +353,7 @@ class Message:
             return
 
         for i in warn.split('\n'):
-            print self.maybe_color('yellow', '* ') + i
+            print  >> self.std_out, self.maybe_color('yellow', '* ') + i
 
     def error (self, error):
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8c0b76134494339ff75bb5c3e8332c69f257838a
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 00:21:17 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:46:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8c0b7613

Add an input parameter, 'output' to delete_empty_directory so that it can be overriden if desired

---
 layman/utils.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/layman/utils.py b/layman/utils.py
index 62014d9..18bf442 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -103,20 +103,20 @@ def path(path_elements):
 
     return pathname
 
-def delete_empty_directory(mdir):
+def delete_empty_directory(mdir, output=OUT):
     if os.path.exists(mdir) and not os.listdir(mdir):
         # Check for sufficient privileges
         if os.access(mdir, os.W_OK):
-            OUT.info('Deleting _empty_ directory "%s"' % mdir, 2)
+            output.info('Deleting _empty_ directory "%s"' % mdir, 2)
             try:
                 os.rmdir(mdir)
             except OSError, error:
-                OUT.warn(str(error))
+                output.warn(str(error))
         else:
-            OUT.warn('Insufficient permissions to delete _empty_ folder "%s".' % mdir)
+            output.warn('Insufficient permissions to delete _empty_ folder "%s".' % mdir)
             import getpass
             if getpass.getuser() != 'root':
-                OUT.warn('Hint: You are not root.')
+                output.warn('Hint: You are not root.')
 
 #===============================================================================
 #



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8d5c2c9f9a64dd99f65bf3791cb88ca400339c45
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 00:36:22 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:46:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8d5c2c9f

change to use the config['output'] variable

---
 layman/db.py     |   18 ++++++++++--------
 layman/dbbase.py |    9 +++++----
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index cdaeb62..f827292 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -30,7 +30,7 @@ from   layman.utils             import path, delete_empty_directory
 from   layman.dbbase            import DbBase
 from   layman.makeconf          import MakeConf
 
-from   layman.debug             import OUT
+#from   layman.debug             import OUT
 
 #===============================================================================
 #
@@ -44,6 +44,7 @@ class DB(DbBase):
     def __init__(self, config):
 
         self.config = config
+        self.output = config['output']
 
         self.path = config['local_list']
 
@@ -60,7 +61,7 @@ class DB(DbBase):
                           ignore, 
                           quiet)
 
-        OUT.debug('DB handler initiated', 6)
+        self.output.debug('DB handler initiated', 6)
 
     # overrider
     def _broken_catalog_hint(self):
@@ -122,7 +123,7 @@ class DB(DbBase):
                 make_conf.add(overlay)
             else:
                 mdir = path([self.config['storage'], overlay.name])
-                delete_empty_directory(mdir)
+                delete_empty_directory(mdir, self.output)
                 if os.path.exists(mdir):
                     raise Exception('Adding overlay "%s" failed!'
                                 ' Possible remains of the operation have NOT'
@@ -154,7 +155,7 @@ class DB(DbBase):
         >>> a = DB(config)
         >>> config['local_list'] = write
         >>> b = DB(config)
-        >>> OUT.color_off()
+        >>> .color_off()
 
         >>> m = MakeConf(config, b.overlays)
         >>> m.path = here + '/tests/testfiles/make.conf'
@@ -217,6 +218,7 @@ class RemoteDB(DbBase):
     def __init__(self, config, ignore_init_read_errors=False):
 
         self.config = config
+        self.output = config['output']
 
         self.proxies = {}
 
@@ -277,10 +279,10 @@ class RemoteDB(DbBase):
 
             # Check for sufficient privileges
             if os.path.exists(mpath) and not os.access(mpath, os.W_OK):
-                OUT.warn('You do not have permission to update the cache (%s).' % mpath)
+                self.output.warn('You do not have permission to update the cache (%s).' % mpath)
                 import getpass
                 if getpass.getuser() != 'root':
-                    OUT.warn('Hint: You are not root.')
+                    self.output.warn('Hint: You are not root.')
                 continue
 
             try:
@@ -320,7 +322,7 @@ class RemoteDB(DbBase):
 
 
             except IOError, error:
-                OUT.warn('Failed to update the overlay list from: '
+                self.output.warn('Failed to update the overlay list from: '
                          + url + '\nError was:\n' + str(error))
 
     def path(self, url):
@@ -328,7 +330,7 @@ class RemoteDB(DbBase):
 
         base = self.config['cache']
 
-        OUT.debug('Generating cache path.', 6)
+        self.output.debug('Generating cache path.', 6)
 
         return base + '_' + hashlib.md5(url).hexdigest() + '.xml'
 

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 5743d4f..50ec4ed 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -32,7 +32,7 @@ import sys, os, os.path
 import xml
 import xml.etree.ElementTree as ET # Python 2.5
 
-from   layman.debug              import OUT
+#from   layman.debug              import OUT
 from   layman.utils              import indent
 from   layman.overlays.overlay   import Overlay
 
@@ -80,10 +80,11 @@ class DbBase:
         self.quiet = quiet
         self.paths = paths
         self.ignore = ignore
+        self.output = config['output']
 
         self.overlays = {}
 
-        OUT.debug('Initializing overlay list handler', 8)
+        self.output.debug('Initializing overlay list handler', 8)
 
         for path in self.paths:
             if not os.path.exists(path):
@@ -142,11 +143,11 @@ class DbBase:
                 document.findall('repo')
 
         for overlay in overlays:
-            OUT.debug('Parsing overlay entry', 8)
+            self.output.debug('Parsing overlay entry', 8)
             try:
                 ovl = Overlay(overlay, self.config, self.ignore, self.quiet)
             except Exception, error:
-                OUT.warn(str(error), 3)
+                self.output.warn(str(error), 3)
             else:
                 self.overlays[ovl.name] = ovl
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/
@ 2011-02-14  6:00 Brian Dolbec
  0 siblings, 0 replies; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  6:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3b6f983f8d764e974c38ae4b4eccbfd63553ff2d
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Jul  7 00:17:34 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Feb 11 10:46:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3b6f983f

add new __init__ input parameters, output (replaces OUT import), stdout, stdin, stderr.  These are then added to the config dictionary for all other modules to use.  This creates a single point to assign them and makes it possible to re-assign them from the defaults in the case of API consumers.

---
 layman/config.py |   50 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index 750364a..5b84c17 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -46,7 +46,7 @@ _USAGE = """
 class Config(object):
     '''Handles the configuration.'''
 
-    def __init__(self, args=None):
+    def __init__(self, args=None, output=None, stdout=None, stdin=None, stderr=None):
         '''
         Creates and describes all possible polymeraZe options and creates
         a debugging object.
@@ -64,6 +64,11 @@ class Config(object):
         if args == None:
             args = sys.argv
 
+        self.stdout = stdout if stdout else sys.stdout
+        self.stderr = stderr if stderr else sys.stderr
+        self.stdin = stdin if stdin else sys.stdin
+        self.output = output if output else OUT
+
         self.defaults = {'config'    : '/etc/layman/layman.cfg',
                          'storage'   : '/var/lib/layman',
                          'cache'     : '%(storage)s/cache',
@@ -233,7 +238,7 @@ class Config(object):
         #-----------------------------------------------------------------
         # Debug Options
 
-        OUT.cli_opts(self.parser)
+        self.output.cli_opts(self.parser)
 
         # Parse the command line first since we need to get the config
         # file option.
@@ -246,16 +251,25 @@ class Config(object):
             self.parser.error("Unhandled parameters: %s" % ', '.join(('"%s"' % e) for e in remain_args[1:]))
 
         # handle debugging
-        OUT.cli_handle(self.options)
+        self.output.cli_handle(self.options)
+
+        # add output to the options
+        self.options.__dict__['output'] = self.output
+
+        # add the std in/out/err to the options
+        self.options.__dict__['stdout'] = self.stdout
+        self.options.__dict__['stdin'] = self.stdin
+        self.options.__dict__['stderr'] = self.stderr
+        
 
         if self.options.__dict__['nocolor']:
-            OUT.color_off()
+            self.output.color_off()
 
         # Fetch only an alternate config setting from the options
         if not self.options.__dict__['config'] is None:
             self.defaults['config'] = self.options.__dict__['config']
 
-            OUT.debug('Got config file at ' + self.defaults['config'], 8)
+            self.output.debug('Got config file at ' + self.defaults['config'], 8)
 
         # Now parse the config file
         self.config = ConfigParser.ConfigParser(self.defaults)
@@ -263,14 +277,14 @@ class Config(object):
 
         # handle quietness
         if self['quiet']:
-            OUT.set_info_level(1)
-            OUT.set_warn_level(1)
+            self.output.set_info_level(1)
+            self.output.set_warn_level(1)
             self.defaults['quietness'] = 0
         elif 'quietness' in self.keys():
-            OUT.set_info_level(int(self['quietness']))
-            OUT.set_warn_level(int(self['quietness']))
+            self.output.set_info_level(int(self['quietness']))
+            self.output.set_warn_level(int(self['quietness']))
 
-        OUT.debug('Reading config file at ' + self.defaults['config'], 8)
+        self.output.debug('Reading config file at ' + self.defaults['config'], 8)
 
         self.config.read(self.defaults['config'])
 
@@ -286,13 +300,13 @@ class Config(object):
             if overlays:
                 return  overlays
 
-        OUT.debug('Retrieving option', 8)
+        self.output.debug('Retrieving option', 8)
 
         if (key in self.options.__dict__.keys()
             and not self.options.__dict__[key] is None):
             return self.options.__dict__[key]
 
-        OUT.debug('Retrieving option', 8)
+        self.output.debug('Retrieving option', 8)
 
         if self.config.has_option('MAIN', key):
             if key == 'nocheck':
@@ -302,34 +316,34 @@ class Config(object):
                     return False
             return self.config.get('MAIN', key)
 
-        OUT.debug('Retrieving option', 8)
+        self.output.debug('Retrieving option', 8)
 
         if key in self.defaults.keys():
             return self.defaults[key]
 
-        OUT.debug('Retrieving option', 8)
+        self.output.debug('Retrieving option', 8)
 
         return None
 
     def keys(self):
         '''Special handler for the configuration keys.'''
 
-        OUT.debug('Retrieving keys', 8)
+        self.output.debug('Retrieving keys', 8)
 
         keys = [i for i in self.options.__dict__.keys()
                 if not self.options.__dict__[i] is None]
 
-        OUT.debug('Retrieving keys', 8)
+        self.output.debug('Retrieving keys', 8)
 
         keys += [name for name, _ in self.config.items('MAIN')
                  if not name in keys]
 
-        OUT.debug('Retrieving keys', 8)
+        self.output.debug('Retrieving keys', 8)
 
         keys += [i for i in self.defaults.keys()
                  if not i in keys]
 
-        OUT.debug('Retrieving keys', 8)
+        self.output.debug('Retrieving keys', 8)
 
         return keys
 



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:overlord_merge commit in: layman/
@ 2011-02-14  0:54 Brian Dolbec
  2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     d308b929d9fb4a0c69d331079f9a8b3ebbb2164a
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 14 00:50:45 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Feb 14 00:50:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d308b929

more DebugMessage class cleanup/transition to subclassing Message

---
 layman/debug.py |   39 ++++++++++++++-------------------------
 1 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/layman/debug.py b/layman/debug.py
index d7af5aa..f5c247b 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -23,13 +23,10 @@ from   layman.constants  import (codes, DEBUG_LEVEL, DEBUG_VERBOSITY,
 
 from output import Message
 
-#################################################################################
-##
-## Message Class
-##
-#################################################################################
 
 class DebugMessage(Message):
+    """fully Debug enabled subclass of output.py's Message
+    """
     #FIXME: Think about some simple doctests before you modify this class the
     #       next time.
 
@@ -37,8 +34,8 @@ class DebugMessage(Message):
                  out = sys.stdout,
                  err = sys.stderr,
                  dbg = sys.stderr,
-                 debugging_level = DEBUG_LEVEL,
-                 debugging_verbosity = DEBUG_VERBOSITY,
+                 debug_level = DEBUG_LEVEL,
+                 debug_verbosity = DEBUG_VERBOSITY,
                  info_level = INFO_LEVEL,
                  warn_level = WARN_LEVEL,
                  col = True,
@@ -50,6 +47,8 @@ class DebugMessage(Message):
         if obj == None: obj = ['*']
         if var == None: var = ['*']
 
+        Message.__init__(self)
+
         # A description of the module that is being debugged
         self.debug_env = module
 
@@ -57,24 +56,24 @@ class DebugMessage(Message):
         self.debug_out = dbg
 
         # Where should the error output go? This can also be a file
-        self.error_out = err
+        #self.error_out = err
 
         # Where should the normal output go? This can also be a file
-        self.std_out = out
+        #self.std_out = out
 
         # The higher the level the more information you will get
-        self.warn_lev = warn_level
+        #self.warn_lev = warn_level
 
         # The higher the level the more information you will get
-        self.info_lev = info_level
+        #self.info_lev = info_level
 
         # The highest level of debugging messages acceptable for output
         # The higher the level the more output you will get
-        self.debug_lev = debugging_level
+        #self.debug_lev = debugging_level
 
         # The debugging output can range from very verbose (3) to
         # very compressed (1)
-        self.debug_vrb = debugging_verbosity
+        self.debug_vrb = debug_verbosity
 
         # Which methods should actually be debugged?
         # Use '*' to indicate 'All methods'
@@ -92,17 +91,9 @@ class DebugMessage(Message):
         self.show_class_variables = False
 
         # Should the output be colored?
-        self.use_color = col
-
-        self.has_error = False
+        #self.use_color = col
 
-        Message.__init__(self,
-                out = self.std_out,
-                err = self.error_out,
-                info_level = self.info_level,
-                warn_level = self.warn_level,
-                col = self.col
-                )
+        #self.has_error = False
 
 
     ############################################################################
@@ -252,8 +243,6 @@ class DebugMessage(Message):
         if variables:
             self.debug_var = variables
 
-    def set_debug_level(self, debugging_level = DEBUG_LEVEL):
-        self.debug_lev = debugging_level
 
     def set_debug_verbosity(self, debugging_verbosity = DEBUG_VERBOSITY):
         self.debug_vrb = debugging_verbosity



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:overlord_merge commit in: layman/
@ 2011-02-14  0:54 Brian Dolbec
  2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     cc15f2551e105540850101572ccba275a6fc1ace
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 14 00:53:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Feb 14 00:53:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=cc15f255

fix the incorrect exit code settings which are opposite the True/False that the api returns

---
 layman/cli.py       |    7 ++++---
 layman/constants.py |    3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/layman/cli.py b/layman/cli.py
index 3277c1b..8f94f4a 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -27,7 +27,8 @@ import os, sys
 from layman.api import LaymanAPI
 from layman.utils import (decode_selection, encoder, get_encoding,
     pad, terminal_width)
-from layman.constants import NOT_OFFICIAL_MSG, NOT_SUPPORTED_MSG
+from layman.constants import (NOT_OFFICIAL_MSG, NOT_SUPPORTED_MSG,
+    FAILURE, SUCCEED)
 
 
 
@@ -180,9 +181,9 @@ class Main(object):
         os.umask(old_umask)
 
         if not result:
-            sys.exit(0)
+            sys.exit(FAILURE)
         else:
-            sys.exit(1)
+            sys.exit(SUCCEED)
 
 
     def Fetch(self):

diff --git a/layman/constants.py b/layman/constants.py
index 6962867..6f53de3 100644
--- a/layman/constants.py
+++ b/layman/constants.py
@@ -50,3 +50,6 @@ WARN_LEVEL = 4
 INFO_LEVEL = 4
 DEBUG_LEVEL = 4
 DEBUG_VERBOSITY = 2
+
+FAILURE = 1
+SUCCEED = 0



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:overlord_merge commit in: layman/
@ 2011-02-14  0:54 Brian Dolbec
  2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     503c1586ac80109089f0bf6d0a1a0a579a19a6d7
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 14 00:49:30 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Feb 14 00:49:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=503c1586

fix a missed color_off(), add myself to the copyright, whitespace cleaning

---
 layman/config.py |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/layman/config.py b/layman/config.py
index e515155..6f8f658 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -10,6 +10,7 @@
 # Copyright:
 #             (c) 2005 - 2009 Gunnar Wrobel
 #             (c) 2009        Sebastian Pipping
+#             (c) 2010 - 2011 Brian Dolbec
 #             Distributed under the terms of the GNU General Public License v2
 #
 # Author(s):
@@ -30,18 +31,14 @@ __version__ = "$Id: config.py 286 2007-01-09 17:48:23Z wrobel $"
 import sys, ConfigParser
 import os
 
-from   optparse                 import OptionParser, OptionGroup
+from optparse import OptionParser, OptionGroup
 
-#from   layman.debug             import OUT
-from   layman.output            import OUT
+#from layman.debug import OUT
+from layman.output import OUT
 
-from   layman.version           import VERSION
+from layman.constants import OFF
+from layman.version import VERSION
 
-#===============================================================================
-#
-# Class Config
-#
-#-------------------------------------------------------------------------------
 
 _USAGE = """
   layman (-a|-d|-s|-i) (OVERLAY|ALL)
@@ -375,7 +372,7 @@ class ArgsParser(object):
 
 
         if self.options.__dict__['nocolor']:
-            self.output.color_off()
+            self.output.set_colorize(OFF)
 
         # Fetch only an alternate config setting from the options
         if not self.options.__dict__['config'] is None:



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:overlord_merge commit in: layman/
@ 2011-02-14  0:54 Brian Dolbec
  2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     ac8a52948f107265718dabe97e144a7cc4a70091
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Feb 14 00:47:14 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Feb 14 00:47:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ac8a5294

fix a long line, clean an unused import, fix the sync return value better

---
 layman/api.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index f3d68b6..63682f6 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -17,7 +17,6 @@ from sys import stderr
 import os
 
 from layman.config import BareConfig
-#from layman.action import Sync
 
 from layman.dbbase import UnknownOverlayException, UnknownOverlayMessage
 from layman.db import DB, RemoteDB
@@ -320,7 +319,8 @@ class LaymanAPI(object):
                         candidates = '  %s' % tuple(available_srcs)[0]
                     else:
                         plural = 's'
-                        candidates = '\n'.join(('  %d. %s' % (ovl + 1, v)) for ovl, v in enumerate(available_srcs))
+                        candidates = '\n'.join(('  %d. %s' % (ovl + 1, v)) \
+                         for ovl, v in enumerate(available_srcs))
 
                     warnings.append((ovl,
                         'The source of the overlay "%(repo_name)s" seems to have changed.\n'
@@ -363,11 +363,10 @@ class LaymanAPI(object):
                 self.output.error('\nErrors:\n------\n')
                 for ovl, result in fatals:
                     self.output.error(result + '\n')
-                return False
 
         self.sync_results = (success, warnings, fatals)
 
-        return True
+        return fatals != []
 
 
     def fetch_remote_list(self):



^ permalink raw reply related	[flat|nested] 246+ messages in thread
* [gentoo-commits] proj/layman:overlord_merge commit in: layman/
@ 2011-02-14  0:54 Brian Dolbec
  2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
  0 siblings, 1 reply; 246+ messages in thread
From: Brian Dolbec @ 2011-02-14  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     6a85b05289ae2bb9f5da1748985322e83d064f60
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Feb 13 09:31:54 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Feb 13 09:31:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6a85b052

simplify debug.py to subclass the simplified Message class

---
 layman/debug.py |  151 ++++++++----------------------------------------------
 1 files changed, 23 insertions(+), 128 deletions(-)

diff --git a/layman/debug.py b/layman/debug.py
index 7c42974..d7af5aa 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -18,8 +18,10 @@ import sys, inspect, types
 
 from   optparse      import OptionGroup
 
-from   layman.constants  import codes
+from   layman.constants  import (codes, DEBUG_LEVEL, DEBUG_VERBOSITY,
+    INFO_LEVEL, WARN_LEVEL, OFF)
 
+from output import Message
 
 #################################################################################
 ##
@@ -27,7 +29,7 @@ from   layman.constants  import codes
 ##
 #################################################################################
 
-class Message:
+class DebugMessage(Message):
     #FIXME: Think about some simple doctests before you modify this class the
     #       next time.
 
@@ -35,10 +37,10 @@ class Message:
                  out = sys.stdout,
                  err = sys.stderr,
                  dbg = sys.stderr,
-                 debugging_level = 4,
-                 debugging_verbosity = 2,
-                 info_level = 4,
-                 warn_level = 4,
+                 debugging_level = DEBUG_LEVEL,
+                 debugging_verbosity = DEBUG_VERBOSITY,
+                 info_level = INFO_LEVEL,
+                 warn_level = WARN_LEVEL,
                  col = True,
                  mth = None,
                  obj = None,
@@ -94,6 +96,14 @@ class Message:
 
         self.has_error = False
 
+        Message.__init__(self,
+                out = self.std_out,
+                err = self.error_out,
+                info_level = self.info_level,
+                warn_level = self.warn_level,
+                col = self.col
+                )
+
 
     ############################################################################
     # Add command line options
@@ -170,9 +180,9 @@ class Message:
 
         if (options.__dict__.has_key('debug')
             and options.__dict__['debug']):
-            self.debug_on()
+            self.set_debug_level(DEBUG_LEVEL)
         else:
-            self.debug_off()
+            self.set_debug_level(OFF)
             return
 
         if (options.__dict__.has_key('debug_class_vars')
@@ -183,9 +193,9 @@ class Message:
 
         if (options.__dict__.has_key('debug_nocolor')
             and options.__dict__['debug_nocolor']):
-            self.color_off()
+            self.set_colorize(False)
         else:
-            self.color_on()
+            self.set_colorize(True)
 
         if (options.__dict__.has_key('debug_level') and
             options.__dict__['debug_level']):
@@ -242,46 +252,12 @@ class Message:
         if variables:
             self.debug_var = variables
 
-    def maybe_color (self, col, text):
-        if self.use_color:
-            return codes[col] + text + codes['reset']
-        return text
-
-    def set_info_level(self, info_level = 4):
-        self.info_lev = info_level
-
-    def info_off(self):
-        self.set_info_level(0)
-
-    def info_on(self, info_level = 4):
-        self.set_info_level(info_level)
-
-    def set_warn_level(self, warn_level = 4):
-        self.warn_lev = warn_level
-
-    def warn_off(self):
-        self.set_warn_level(0)
-
-    def warn_on(self, warn_level = 4):
-        self.set_warn_level(warn_level)
-
-    def set_debug_level(self, debugging_level = 4):
+    def set_debug_level(self, debugging_level = DEBUG_LEVEL):
         self.debug_lev = debugging_level
 
-    def set_debug_verbosity(self, debugging_verbosity = 2):
+    def set_debug_verbosity(self, debugging_verbosity = DEBUG_VERBOSITY):
         self.debug_vrb = debugging_verbosity
 
-    def debug_off(self):
-        self.set_debug_level(0)
-
-    def debug_on(self):
-        self.set_debug_level()
-
-    def color_off(self):
-        self.use_color = False
-
-    def color_on(self):
-        self.use_color = True
 
     def class_variables_off(self):
         self.show_class_variables = False
@@ -292,88 +268,7 @@ class Message:
     #############################################################################
     ## Output Functions
 
-    def notice (self, note):
-        print >> self.std_out, note
-
-    def info (self, info, level = 4):
-
-        #print "info =", info
-
-        if type(info) not in types.StringTypes:
-            info = str(info)
-
-        if level > self.info_lev:
-            return
-
-        for i in info.split('\n'):
-            print  >> self.std_out, self.maybe_color('green', '* ') + i
-
-    def status (self, message, status, info = 'ignored'):
-
-        if type(message) not in types.StringTypes:
-            message = str(message)
-
-        lines = message.split('\n')
-
-        if not lines:
-            return
-
-        for i in lines[0:-1]:
-            print  >> self.std_out, self.maybe_color('green', '* ') + i
-
-        i = lines[-1]
-
-        if len(i) > 58:
-            i = i[0:57]
-
-        if status == 1:
-            result = '[' + self.maybe_color('green', 'ok') + ']'
-        elif status == 0:
-            result = '[' + self.maybe_color('red', 'failed') + ']'
-        else:
-            result = '[' + self.maybe_color('yellow', info) + ']'
-
-        print  >> self.std_out, self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i))  \
-              + ' ' + result
-
-    def warn (self, warn, level = 4):
-
-        #print "DEBUG.warn()"
-
-        if type(warn) not in types.StringTypes:
-            warn = str(warn)
-
-        if level > self.warn_lev:
-            return
-
-        for i in warn.split('\n'):
-            print  >> self.std_out, self.maybe_color('yellow', '* ') + i
-
-    def error (self, error):
-
-        if type(error) not in types.StringTypes:
-            error = str(error)
-
-        for i in error.split('\n'):
-            # NOTE: Forced flushing ensures that stdout and stderr
-            # stay in nice order.  This is a workaround for calls like
-            # "layman -L |& less".
-            sys.stdout.flush()
-            print >> self.error_out, self.maybe_color('red', '* ') + i
-            self.error_out.flush()
-        self.has_error = True
-
-    def die (self, error):
-
-        if type(error) not in types.StringTypes:
-            error = str(error)
-
-        for i in error.split('\n'):
-            self.error(self.maybe_color('red', 'Fatal error: ') + i)
-        self.error(self.maybe_color('red', 'Fatal error(s) - aborting'))
-        sys.exit(1)
-
-    def debug (self, message, level = 4):
+    def debug (self, message, level = DEBUG_LEVEL):
         '''
         This is a generic debugging method.
         '''



^ permalink raw reply related	[flat|nested] 246+ messages in thread

end of thread, other threads:[~2020-04-24 20:59 UTC | newest]

Thread overview: 246+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-14  6:00 [gentoo-commits] proj/layman:master commit in: layman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2020-04-24 20:59 Brian Dolbec
2020-04-24 20:59 Brian Dolbec
2017-03-22  6:36 Brian Dolbec
2017-02-02 17:12 Brian Dolbec
2017-02-02  1:12 Devan Franchini
2017-02-02  1:12 Devan Franchini
2016-11-10  2:59 Devan Franchini
2016-05-10 22:13 Brian Dolbec
2016-05-02  3:30 Devan Franchini
2016-03-10  0:00 Devan Franchini
2016-03-09 23:37 Devan Franchini
2016-02-29  6:21 Devan Franchini
2016-01-29 10:21 Brian Dolbec
2015-12-31  1:03 Devan Franchini
2015-12-26 23:24 Brian Dolbec
2015-11-29  3:26 Devan Franchini
2015-11-29  3:12 Devan Franchini
2015-10-17  3:20 Devan Franchini
2015-10-16 18:49 Devan Franchini
2015-10-16 18:49 Devan Franchini
2015-09-23 15:25 Devan Franchini
2015-09-05  6:03 Devan Franchini
2015-08-28  1:48 Devan Franchini
2015-08-28  1:48 Devan Franchini
2015-08-28  1:48 Devan Franchini
2015-08-04  1:05 Devan Franchini
2015-07-19  3:53 Devan Franchini
2015-07-17 17:05 Devan Franchini
2015-07-17 17:05 Devan Franchini
2015-07-17 17:05 Devan Franchini
2015-07-15 16:15 Devan Franchini
2015-07-15 15:53 Devan Franchini
2015-07-13 23:05 Devan Franchini
2015-07-13 13:26 Devan Franchini
2015-07-09 17:23 Devan Franchini
2015-07-09 16:18 Devan Franchini
2015-06-16  3:45 Devan Franchini
2015-06-14  4:12 Devan Franchini
2015-06-13  4:53 Devan Franchini
2015-06-13  2:38 Devan Franchini
2015-06-13  2:31 Devan Franchini
2015-05-13 21:32 Devan Franchini
2015-05-13 21:27 Devan Franchini
2015-05-13 20:38 Devan Franchini
2015-05-13 20:05 Devan Franchini
2015-05-13 19:58 Devan Franchini
2015-04-22 17:40 Devan Franchini
2015-04-20 17:15 Devan Franchini
2015-03-27 23:42 Devan Franchini
2015-03-26 22:50 Devan Franchini
2015-03-26 22:06 Devan Franchini
2015-03-24 23:08 Devan Franchini
2015-03-24 22:56 Devan Franchini
2015-03-24 22:20 Devan Franchini
2015-03-24 16:08 Devan Franchini
2015-03-07 22:40 Devan Franchini
2015-03-07 22:40 Devan Franchini
2015-03-07 22:10 Devan Franchini
2015-03-07 22:02 Devan Franchini
2015-02-21 18:41 Devan Franchini
2015-02-17  5:07 Brian Dolbec
2015-02-09 18:25 Devan Franchini
2015-02-08  4:20 Brian Dolbec
2015-02-08  4:20 Brian Dolbec
2015-02-08  2:58 Devan Franchini
2015-02-08  1:57 Brian Dolbec
2015-02-08  0:33 Devan Franchini
2015-02-05  2:56 Devan Franchini
2015-02-05  2:31 Devan Franchini
2015-02-05  2:20 Devan Franchini
2015-02-03  2:43 Devan Franchini
2014-12-08  4:15 Devan Franchini
2014-12-04 20:46 Devan Franchini
2014-11-13 19:03 Brian Dolbec
2014-11-13 18:43 Brian Dolbec
2014-11-13 18:43 Brian Dolbec
2014-11-13 18:08 Brian Dolbec
2014-11-13 18:08 Brian Dolbec
2014-11-13 18:08 Brian Dolbec
2014-11-13 18:08 Brian Dolbec
2014-11-02 21:14 Devan Franchini
2014-09-28 22:42 Devan Franchini
2014-09-20 17:47 Devan Franchini
2014-09-19 18:13 Devan Franchini
2014-09-19 18:13 Devan Franchini
2014-08-28 22:54 Brian Dolbec
2014-08-28 22:01 Devan Franchini
2014-08-28 22:01 Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-17  4:01 ` Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-15 23:16 ` Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-16 22:46 ` Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-15 22:33 ` Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-19  1:49 Devan Franchini
2014-08-15 23:27 ` Devan Franchini
2014-08-17 20:55 Devan Franchini
2014-08-19  1:49 ` Devan Franchini
2014-08-17 14:15 Brian Dolbec
2014-08-16 18:06 Brian Dolbec
2014-08-15 23:59 Devan Franchini
2014-08-19  1:49 ` Devan Franchini
2014-06-16  3:40 Brian Dolbec
2014-06-16  3:40 Brian Dolbec
2014-06-16  3:40 Brian Dolbec
2014-06-16  3:37 [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2014-05-07 22:18 Devan Franchini
2014-03-10  3:18 Brian Dolbec
2013-12-29  2:30 Brian Dolbec
2013-08-18 14:48 Brian Dolbec
2013-07-29  1:46 Brian Dolbec
2013-01-11 18:29 Brian Dolbec
2012-12-16 18:13 Brian Dolbec
2012-11-28  4:14 Brian Dolbec
2012-11-28  4:02 Brian Dolbec
2012-11-28  4:02 Brian Dolbec
2012-11-18 22:15 Brian Dolbec
2012-11-18 22:15 Brian Dolbec
2012-11-18 22:15 Brian Dolbec
2012-11-01  4:00 Brian Dolbec
2012-10-30  8:30 Brian Dolbec
2012-10-17  6:21 Brian Dolbec
2012-10-17  6:21 Brian Dolbec
2012-10-13 22:20 Brian Dolbec
2012-10-13 22:20 Brian Dolbec
2012-10-08  5:37 Brian Dolbec
2012-10-07 23:40 Brian Dolbec
2012-10-07 23:40 Brian Dolbec
2012-06-07  4:49 Brian Dolbec
2012-06-07  4:49 Brian Dolbec
2012-06-07  4:49 Brian Dolbec
2012-04-14  2:14 Brian Dolbec
2012-04-09 19:47 Brian Dolbec
2012-04-01 21:54 Brian Dolbec
2012-03-26  3:43 Brian Dolbec
2012-03-04 15:36 Brian Dolbec
2011-12-27  2:20 Brian Dolbec
2011-10-27  4:42 Brian Dolbec
2011-10-26 23:19 Brian Dolbec
2011-10-14  3:14 Brian Dolbec
2011-09-24  6:07 Brian Dolbec
2011-08-25  3:33 Brian Dolbec
2011-08-21  7:53 Brian Dolbec
2011-08-21  7:53 Brian Dolbec
2011-08-21  7:53 Brian Dolbec
2011-08-20 17:06 Brian Dolbec
2011-08-20 17:06 Brian Dolbec
2011-08-11  3:24 Brian Dolbec
2011-08-11  3:24 Brian Dolbec
2011-08-11  3:24 Brian Dolbec
2011-08-11  3:24 Brian Dolbec
2011-08-09  2:46 Brian Dolbec
2011-08-07 21:21 Brian Dolbec
2011-08-07  7:12 Brian Dolbec
2011-08-07  7:12 Brian Dolbec
2011-08-07  7:12 Brian Dolbec
2011-08-07  6:00 Brian Dolbec
2011-08-07  2:29 Brian Dolbec
2011-08-06 20:30 Brian Dolbec
2011-08-06 18:29 Brian Dolbec
2011-08-06 18:29 Brian Dolbec
2011-07-28 21:33 Brian Dolbec
2011-07-23  6:45 Brian Dolbec
2011-07-20 18:34 Brian Dolbec
2011-07-12 20:01 Brian Dolbec
2011-07-12 19:57 Brian Dolbec
2011-07-12 19:57 Brian Dolbec
2011-07-12 19:02 Brian Dolbec
2011-07-12 19:02 Brian Dolbec
2011-05-18  5:19 Brian Dolbec
2011-05-18  5:13 Brian Dolbec
2011-05-14 13:06 Brian Dolbec
2011-05-05  9:44 Brian Dolbec
2011-05-02  5:25 Brian Dolbec
2011-05-01  2:18 Brian Dolbec
2011-05-01  0:53 Brian Dolbec
2011-05-01  0:26 Brian Dolbec
2011-04-30 22:37 Brian Dolbec
2011-04-30 22:37 Brian Dolbec
2011-04-30  6:37 Brian Dolbec
2011-04-30  6:37 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-02-19 11:01 Brian Dolbec
2011-02-19 11:01 Brian Dolbec
2011-02-19 11:01 Brian Dolbec
2011-02-19 11:01 Brian Dolbec
2011-02-19  4:49 Brian Dolbec
2011-02-19  4:47 Brian Dolbec
2011-02-19  4:10 Brian Dolbec
2011-02-19  4:07 Brian Dolbec
2011-02-17 21:53 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  0:54 [gentoo-commits] proj/layman:overlord_merge " Brian Dolbec
2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2011-02-14  0:54 [gentoo-commits] proj/layman:overlord_merge " Brian Dolbec
2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2011-02-14  0:54 [gentoo-commits] proj/layman:overlord_merge " Brian Dolbec
2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2011-02-14  0:54 [gentoo-commits] proj/layman:overlord_merge " Brian Dolbec
2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2011-02-14  0:54 [gentoo-commits] proj/layman:overlord_merge " Brian Dolbec
2011-02-14  6:00 ` [gentoo-commits] proj/layman:master " Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox