From ccac307ee161583f7f0fed957cef358b190f8b91 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Fri, 11 Jan 2013 13:16:52 +0400 Subject: [PATCH] Fix files count --- pym/cl_fill_builder.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pym/cl_fill_builder.py b/pym/cl_fill_builder.py index 77727f1..a56a518 100644 --- a/pym/cl_fill_builder.py +++ b/pym/cl_fill_builder.py @@ -23,7 +23,7 @@ from os import access, R_OK,W_OK from os import path from cl_distr import Distributive from cl_utils import getTupleVersion,genpassword,pathJoin,_toUNICODE, \ - getFilesCount,getCmdLineParam,countFiles + getFilesCount,getCmdLineParam,countFiles,listDirectory from operator import itemgetter from types import ListType from cl_datavars import iniParser @@ -278,8 +278,23 @@ class fillVars(object, varsShare): def get_os_builder_linux_filesnum(self): """Files number in image system""" + if self.Get('cl_builder_tree') == 'off': + sourceDirectory = self.Get('cl_builder_path') + portagePath = pathJoin(sourceDirectory,"usr/portage") + overlayPath = pathJoin(sourceDirectory,"var/lib/layman/calculate") + excludeCount = \ + reduce(lambda x,y:x + y, + map(countFiles, + map(lambda x: path.join(sourceDirectory,"var/lib/layman/calculate",x), + filter(lambda x: not x in ("distfiles", "eclass", ".git","profiles"), + listDirectory(overlayPath))) + \ + map(lambda x: path.join(sourceDirectory,"usr/portage",x), + filter(lambda x: not x in ("distfiles", "eclass", ".git","profiles"), + listDirectory(portagePath)))),0) + else: + excludeCount = 0 systemRoot = self.Get('cl_builder_path') - return str(countFiles(systemRoot)) + return str(countFiles(systemRoot)-excludeCount) def getVersionFromCalculateEnv(self,systemroot): """Get version from calculate ini"""