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))
 

Reply via email to