From ee7e8b193dccd31c6f0d5bb45dfe0acaa2817f3b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 6 Aug 2009 18:55:44 +0000 Subject: 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 --- pym/portage/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pym') 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" % \ -- cgit v1.2.3-1-g7c22