1 |
commit: 8817de9e401e9207036baa514b248baf749fe524 |
2 |
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 17 21:59:40 2014 +0000 |
4 |
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 19 03:49:58 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=8817de9e |
7 |
|
8 |
layman_.py: Adds checks to ensure repo location |
9 |
|
10 |
Previously it was made so that the initialization of the LaymanAPI |
11 |
wouldn't occur if it already existed. This could however lead to |
12 |
reporting the incorrect storage location for repositories reported |
13 |
by repos.conf. Checks have been added to ensure that the LaymanAPI |
14 |
will be re-initialized if the storage location reported by repos.conf |
15 |
differs from what was already previously reported. |
16 |
|
17 |
--- |
18 |
layman/layman_/layman_.py | 14 +++++++++++--- |
19 |
1 file changed, 11 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/layman/layman_/layman_.py b/layman/layman_/layman_.py |
22 |
index b24f33f..510e3aa 100644 |
23 |
--- a/layman/layman_/layman_.py |
24 |
+++ b/layman/layman_/layman_.py |
25 |
@@ -123,17 +123,25 @@ class PyLayman(SyncBase): |
26 |
SyncBase.__init__(self, 'layman', 'app-portage/layman') |
27 |
|
28 |
self._layman = None |
29 |
+ self.storage = '' |
30 |
+ self.current_storage = '' |
31 |
|
32 |
|
33 |
def _get_layman_api(self): |
34 |
|
35 |
# Make it so that we aren't initializing the |
36 |
- # LaymanAPI instance if it already exists. |
37 |
- if self._layman: |
38 |
+ # LaymanAPI instance if it already exists and |
39 |
+ # if the current storage location hasn't been |
40 |
+ # changed for the new repository. |
41 |
+ self.storage = self.repo.location.replace(self.repo.name, '') |
42 |
+ |
43 |
+ if self._layman and self.storage in self.current_storage: |
44 |
return self._layman |
45 |
|
46 |
config = BareConfig() |
47 |
+ |
48 |
self.message = Message(out=sys.stdout, err=sys.stderr) |
49 |
+ self.current_storage = self.storage |
50 |
|
51 |
options = { |
52 |
'config': config.get_option('config'), |
53 |
@@ -142,7 +150,7 @@ class PyLayman(SyncBase): |
54 |
'output': self.message, |
55 |
'nocolor': self.settings.get('NOCOLOR'), |
56 |
'root': self.settings.get('EROOT'), |
57 |
- 'storage': self.repo.location.replace(self.repo.name, ''), |
58 |
+ 'storage': self.current_storage, |
59 |
'verbose': self.settings.get('PORTAGE_VERBOSE'), |
60 |
'width': self.settings.get('COLUMNWIDTH'), |