1 |
commit: 6593a3562703348b5008847d92e820a75efaf921 |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Tue Jul 24 16:56:54 2012 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Tue Jul 24 16:56:54 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6593a356 |
7 |
|
8 |
PackageInfo: _remove_auto:ebuild_written, fix get |
9 |
|
10 |
geändert: roverlay/packageinfo.py |
11 |
|
12 |
--- |
13 |
roverlay/packageinfo.py | 31 +++++++++++++++++++++++++++++-- |
14 |
1 files changed, 29 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py |
17 |
index 829b798..07b2e77 100644 |
18 |
--- a/roverlay/packageinfo.py |
19 |
+++ b/roverlay/packageinfo.py |
20 |
@@ -183,8 +183,9 @@ class PackageInfo ( object ): |
21 |
# this doesn't work if the package is in a sub directory |
22 |
# of the repo's distdir |
23 |
return self._info ['origin'].distdir |
24 |
- else: |
25 |
+ elif 'package_file' in self._info: |
26 |
return os.path.dirname ( self._info ['package_file'] ) |
27 |
+ # else fallback/KeyError |
28 |
|
29 |
elif key_low == 'has_suggests': |
30 |
# 'has_suggests' not in self._info -> assume False |
31 |
@@ -234,6 +235,12 @@ class PackageInfo ( object ): |
32 |
# --- end of __setitem__ (...) --- |
33 |
|
34 |
def update_now ( self, **info ): |
35 |
+ """Updates the package info data with temporarily enabling write access. |
36 |
+ Data will be readonly after calling this method. |
37 |
+ |
38 |
+ arguments: |
39 |
+ * **info -- |
40 |
+ """ |
41 |
if len ( info ) == 0: return |
42 |
with self._update_lock: |
43 |
self.set_writeable() |
44 |
@@ -374,7 +381,27 @@ class PackageInfo ( object ): |
45 |
after entering status 'ebuild_status' (like ebuild in overlay and |
46 |
written -> don't need the ebuild string etc.) |
47 |
""" |
48 |
- print ( "PackageInfo._remove_auto: method stub, request ignored." ) |
49 |
+ with self._update_lock: |
50 |
+ |
51 |
+ if ebuild_status == 'ebuild_written': |
52 |
+ # selectively copying required keys to a new info dict |
53 |
+ |
54 |
+ to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' ) |
55 |
+ |
56 |
+ # needs python >= 2.7 |
57 |
+ info_new = { k : self.get ( k ) for k in to_keep } |
58 |
+ |
59 |
+ # also add an ebuild stub to the new dict (workaround, FIXME) |
60 |
+ info_new ['ebuild'] = True |
61 |
+ |
62 |
+ if 'physical_only' in self._info: |
63 |
+ info_new ['physical_only'] = self._info ['physical_only'] |
64 |
+ |
65 |
+ info_old = self._info |
66 |
+ self._info = info_new |
67 |
+ del info_old |
68 |
+ # -- if |
69 |
+ # -- lock |
70 |
# --- end of _remove_auto (...) --- |
71 |
|
72 |
def _use_filepath ( self, _filepath ): |