aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-06-27 15:45:19 -0700
committerZac Medico <zmedico@gentoo.org>2012-06-27 15:45:19 -0700
commit54932ac1af5761fd055e90b358d380e828a95d54 (patch)
tree847ff0e160f9e085cd97b80d5aef9e226e00b587 /pym/portage/cache
parentBacktrackParameter: fix runtime_pkg_mask copy (diff)
downloadportage-54932ac1af5761fd055e90b358d380e828a95d54.tar.gz
portage-54932ac1af5761fd055e90b358d380e828a95d54.tar.bz2
portage-54932ac1af5761fd055e90b358d380e828a95d54.zip
egencache: prune empty cache directoriesv2.2.0_alpha114
Diffstat (limited to 'pym/portage/cache')
-rw-r--r--pym/portage/cache/fs_template.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/pym/portage/cache/fs_template.py b/pym/portage/cache/fs_template.py
index a82e8623a..8f0636ed0 100644
--- a/pym/portage/cache/fs_template.py
+++ b/pym/portage/cache/fs_template.py
@@ -1,14 +1,14 @@
-# Copyright: 2005 Gentoo Foundation
+# Copyright 2005-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
# Author(s): Brian Harring (ferringb@gentoo.org)
-# License: GPL2
+import os as _os
import sys
from portage.cache import template
from portage import os
from portage.proxy.lazyimport import lazyimport
lazyimport(globals(),
- 'portage.data:portage_gid',
'portage.exception:PortageException',
'portage.util:apply_permissions',
)
@@ -22,10 +22,6 @@ class FsBased(template.database):
attempt to ensure files have the specified owners/perms"""
def __init__(self, *args, **config):
- """throws InitializationError if needs args aren't specified
- gid and perms aren't listed do to an oddity python currying mechanism
- gid=portage_gid
- perms=0665"""
for x, y in (("gid", -1), ("perms", -1)):
if x in config:
@@ -78,7 +74,17 @@ class FsBased(template.database):
if self._perms != -1:
os.umask(um)
-
+ def _prune_empty_dirs(self):
+ all_dirs = []
+ for parent, dirs, files in os.walk(self.location):
+ for x in dirs:
+ all_dirs.append(_os.path.join(parent, x))
+ while all_dirs:
+ try:
+ _os.rmdir(all_dirs.pop())
+ except OSError:
+ pass
+
def gen_label(base, label):
"""if supplied label is a path, generate a unique label based upon label, and supplied base path"""
if label.find(os.path.sep) == -1: