dlpkgs = map(lambda x: x.po, filter(lambda txmbr: txmbr.ts_state in ("i", "u"), self.tsInfo.getMembers()))
- # record the total size of installed pkgs
- pkgs_total_size = sum(map(lambda x: int(x.size), dlpkgs))
-
- # check needed size before actually download and install
- if checksize and pkgs_total_size > checksize:
- raise CreatorError("Size of specified root partition in kickstart file is too small to install all selected packages.")
-
# record all pkg and the content
for pkg in dlpkgs:
pkg_long_name = "%s-%s.%s.rpm" % (pkg.name, pkg.printVer(), pkg.arch)
total_count = len(dlpkgs)
cached_count = 0
+ download_total_size = 0L
msger.info("\nChecking packages cache and packages integrity ...")
for po in dlpkgs:
local = po.localPkg()
if not os.path.exists(local):
continue
if not self.verifyPkg(local, po, False):
+ download_total_size += po.downloadSize()
msger.warning("Package %s is damaged: %s" % (os.path.basename(local), local))
else:
cached_count +=1
+ # record the total size of installed pkgs
+ pkgs_total_size = sum(map(lambda x: int(x.installedsize), dlpkgs))
+
+ # check needed size before actually download and install
+ if checksize and pkgs_total_size + download_total_size > checksize:
+ raise CreatorError("No enough space used for downloading and installing")
+
msger.info("%d packages to be installed, %d packages gotten from cache, %d packages to be downloaded" % (total_count, cached_count, total_count - cached_count))
try:
repos = self.repos.listEnabled()
if not zypp.isKindPattern(item) and not self.inDeselectPackages(item):
dlpkgs.append(item)
- # record the total size of installed pkgs
- pkgs_total_size = sum(map(lambda x: int(x.installSize()), dlpkgs))
-
- # check needed size before actually download and install
- if checksize and pkgs_total_size > checksize:
- raise CreatorError("Size of specified root partition in kickstart file is too small to install all selected packages.")
-
# record all pkg and the content
localpkgs = self.localpkgs.keys()
for pkg in dlpkgs:
total_count = len(dlpkgs)
cached_count = 0
+ download_total_size = 0L
localpkgs = self.localpkgs.keys()
msger.info("Checking packages cache and packages integrity ...")
for po in dlpkgs:
local = self.getLocalPkgPath(po)
if os.path.exists(local):
if self.checkPkg(local) != 0:
+ download_total_size += po.downloadSize()
os.unlink(local)
else:
cached_count += 1
+
+ # record the total size of installed pkgs
+ install_total_size = sum(map(lambda x: int(x.installSize()), dlpkgs))
+ # check needed size before actually download and install
+ if checksize and download_total_size + install_total_size > checksize:
+ raise CreatorError("No enough space used for downloading and installing")
+
download_count = total_count - cached_count
msger.info("%d packages to be installed, %d packages gotten from cache, %d packages to be downloaded" % (total_count, cached_count, download_count))
try:
# with this program; if not, write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import os, sys
+import os, sys, errno
from mic import msger, creator
from mic.utils import cmdln, misc, errors
from mic.plugin import pluginmgr
except KeyboardInterrupt:
msger.error('\n^C catched, program aborted.')
+ # catch 'no space left' exception, etc
+ except IOError, e:
+ if e.errno == errno.ENOSPC:
+ msger.error('\nNo space left on device')
+ raise
+
except errors.Usage, usage:
msger.error(str(usage))