Inside _post_src_install_uid_fix() (since we're already walking the files
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Aug 2009 18:55:44 +0000 (18:55 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Aug 2009 18:55:44 +0000 (18:55 -0000)
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

index e2f459fc4fe7bd1cc3924d5b724554b867711739..af100194dbc0696a0886979bdd1ed5f5c79d3e33 100644 (file)
@@ -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" % \