summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-06 18:55:44 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-06 18:55:44 +0000
commitee7e8b193dccd31c6f0d5bb45dfe0acaa2817f3b (patch)
tree45ca8420a689ea1d37e333a9291be7d0012ea097
parentConvert unicode if necessary before writing to stdout. (diff)
downloadportage-ee7e8b193dccd31c6f0d5bb45dfe0acaa2817f3b.tar.gz
portage-ee7e8b193dccd31c6f0d5bb45dfe0acaa2817f3b.tar.bz2
portage-ee7e8b193dccd31c6f0d5bb45dfe0acaa2817f3b.zip
Inside _post_src_install_uid_fix() (since we're already walking the files
here), compute total size of installed files and save it as SIZE in the vardb. This will be useful for the packagekit backend. svn path=/main/trunk/; revision=13933
-rw-r--r--pym/portage/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index e2f459fc4..af100194d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -5169,10 +5169,14 @@ def _post_src_install_uid_fix(mysettings):
# os.path.join when called by os.walk.
destdir = destdir.encode('utf_8', 'replace')
+ size = 0
+
for parent, dirs, files in os.walk(destdir):
for fname in chain(dirs, files):
fpath = os.path.join(parent, fname)
mystat = os.lstat(fpath)
+ if stat.S_ISREG(mystat.st_mode):
+ size += mystat.st_size
if mystat.st_uid != portage_uid and \
mystat.st_gid != portage_gid:
continue
@@ -5186,6 +5190,9 @@ def _post_src_install_uid_fix(mysettings):
mode=mystat.st_mode, stat_cached=mystat,
follow_links=False)
+ open(os.path.join(mysettings['PORTAGE_BUILDDIR'],
+ 'build-info', 'SIZE'), 'w').write(str(size) + '\n')
+
if bsd_chflags:
# Restore all of the flags saved above.
os.system("mtree -e -p %s -U -k flags < %s > /dev/null" % \