1 |
commit: 78a446d0859fd1d3c2922d821fe0664099287312 |
2 |
Author: Manuel Mommertz <2kmm <AT> gmx <DOT> de> |
3 |
AuthorDate: Fri Jun 24 15:40:56 2016 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 24 21:35:15 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=78a446d0 |
7 |
|
8 |
eclean: Keep only packages with BUILD_TIME equal to installed one |
9 |
|
10 |
X-Gentoo-bug: 586658 |
11 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=586658 |
12 |
Acked-by: Paul Varner <fuzzyray <AT> gentoo.org> |
13 |
|
14 |
pym/gentoolkit/eclean/search.py | 22 +++++++++++++--------- |
15 |
1 file changed, 13 insertions(+), 9 deletions(-) |
16 |
|
17 |
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py |
18 |
index 7b261b8..ce796f5 100644 |
19 |
--- a/pym/gentoolkit/eclean/search.py |
20 |
+++ b/pym/gentoolkit/eclean/search.py |
21 |
@@ -562,24 +562,28 @@ def findPackages( |
22 |
if stat.S_ISLNK(st[stat.ST_MODE]): |
23 |
clean_me[cpv].append(os.path.realpath(path)) |
24 |
# keep only obsolete ones |
25 |
- if destructive: |
26 |
- dbapi = var_dbapi |
27 |
- if package_names: |
28 |
- cp_all = dict.fromkeys(dbapi.cp_all()) |
29 |
- else: |
30 |
- cp_all = {} |
31 |
+ if destructive and package_names: |
32 |
+ cp_all = dict.fromkeys(var_dbapi.cp_all()) |
33 |
else: |
34 |
- dbapi = port_dbapi |
35 |
cp_all = {} |
36 |
for cpv in list(clean_me): |
37 |
if exclDictMatchCP(exclude,portage.cpv_getkey(cpv)): |
38 |
# exclusion because of the exclude file |
39 |
del clean_me[cpv] |
40 |
continue |
41 |
- if dbapi.cpv_exists(cpv): |
42 |
- # exclusion because pkg still exists (in porttree or vartree) |
43 |
+ if not destructive and port_dbapi.cpv_exists(cpv): |
44 |
+ # exclusion because pkg still exists (in porttree) |
45 |
del clean_me[cpv] |
46 |
continue |
47 |
+ if destructive and var_dbapi.cpv_exists(cpv): |
48 |
+ buildtime = var_dbapi.aux_get(cpv, ['BUILD_TIME'])[0].encode('utf-8').strip() |
49 |
+ clean_me[cpv] = [path for path in clean_me[cpv] |
50 |
+ # only keep path if BUILD_TIME is identical with vartree |
51 |
+ if portage.xpak.tbz2(path).getfile('BUILD_TIME').strip() != buildtime] |
52 |
+ if not clean_me[cpv]: |
53 |
+ # nothing we can clean for this package |
54 |
+ del clean_me[cpv] |
55 |
+ continue |
56 |
if portage.cpv_getkey(cpv) in cp_all and port_dbapi.cpv_exists(cpv): |
57 |
# exlusion because of --package-names |
58 |
del clean_me[cpv] |