add pkgsizes listings, and move debugging data to logdir

This commit is contained in:
Will Woods 2011-08-09 18:18:12 -04:00
parent 4f7584fe09
commit a6ea3d3747
2 changed files with 13 additions and 1 deletions

View File

@ -189,7 +189,8 @@ class Lorax(BaseLoraxClass):
buildstamp.write(joinpaths(self.inroot, ".buildstamp")) buildstamp.write(joinpaths(self.inroot, ".buildstamp"))
if self.debug: if self.debug:
rb.writepkglists(joinpaths(self.workdir, "pkglists")) rb.writepkglists(joinpaths(logdir, "pkglists"))
rb.writepkgsizes(joinpaths(logdir, "original-pkgsizes.txt"))
logger.info("doing post-install configuration") logger.info("doing post-install configuration")
rb.postinstall() rb.postinstall()
@ -208,6 +209,9 @@ class Lorax(BaseLoraxClass):
logger.info("cleaning unneeded files") logger.info("cleaning unneeded files")
rb.cleanup() rb.cleanup()
if self.debug:
rb.writepkgsizes(joinpaths(logdir, "final-pkgsizes.txt"))
logger.info("creating the runtime image") logger.info("creating the runtime image")
runtime = "images/install.img" runtime = "images/install.img"
compression = self.conf.get("compression", "type") compression = self.conf.get("compression", "type")

View File

@ -110,6 +110,14 @@ class RuntimeBuilder(object):
removelocales = locales.difference(keeplocales) removelocales = locales.difference(keeplocales)
self._runner.run("runtime-cleanup.tmpl", removelocales=removelocales) self._runner.run("runtime-cleanup.tmpl", removelocales=removelocales)
def writepkgsizes(self, pkgsizefile):
'''debugging data: write a big list of pkg sizes'''
fobj = open(pkgsizefile, "w")
getsize = lambda f: os.lstat(f).st_size if os.path.exists(f) else 0
for p in sorted(self.yum.doPackageLists(pkgnarrow='installed').installed):
pkgsize = sum(getsize(joinpaths(self.vars.root,f)) for f in p.filelist)
fobj.write("{0.name}.{0.arch}: {1}\n".format(p, pkgsize))
def generate_module_data(self): def generate_module_data(self):
root = self.vars.root root = self.vars.root
moddir = joinpaths(root, "lib/modules/") moddir = joinpaths(root, "lib/modules/")