Commits

Rodrigo Bistolfi committed 2826d75

packages.py: fixed minor errors, handle missing packages

Comments (0)

Files changed (1)

vinstall/controller/packages.py

 
 from vinstall.core import Application, Render, Controller, model
 from vinstall.backend import utils
-import os, shutil, glob
+from itertools import chain
+import os, shutil, glob, subprocess
 
 
 class PackageSelection(Controller):
         selected bulks
 
         """
-        required_bulks = [ i[0] for i in self.bulks_required ]
+        required_bulks = [ i[0] for i in self.required_bulks ]
         optional_bulks = [ self.optional_bulks[i][0] for i, e in enumerate(bulks) if e ]
         bulks = chain(required_bulks, optional_bulks)
         for b in bulks:
 
         """
         command = "/usr/sbin/installpkg %s --root=%s" % (package, "/mnt/TARGET")
-        if self._check_continue():
-            subprocess.check_call(command.split())
+        subprocess.check_call(command.split())
 
     def preinstall(self):
         """Run before installing packages
 
         """
         aaa = glob.glob("/mnt/SOURCE/packages/a/aaa_base-*.t?z")[0]
-        self.installpkg(aaa, "/mnt/TARGET")
+        self.installpkg(aaa)
 
     def postinstall(self):
         """Run after installing packages
 
         """
         vlconfig = glob.glob("/mnt/SOURCE/packages/a/vlconfig2-*.t?z")[0]
-        self.installpkg(vlconfig, "/mnt/TARGET")
+        self.installpkg(vlconfig)
 
     def install_kernel(self):
         """Install kernel packages
         excluded =("vlconfig2", "vlsetup", "aaa_base")
         basedir = "/mnt/SOURCE/veclinux"
         pkgbasedir = "/mnt/SOURCE/packages"
-        path = os.path.join(basedir, bulk)
+        path = os.path.join(basedir, bulk.upper())
         with open(path) as f:
             for packagename in f:
                 if packagename in excluded:
                     continue
                 #XXX do not use glob this way
                 fname = "%s/*/%s*t?z" % (pkgbasedir, packagename.strip())
-                yield glob.glob(fname)
+                fullpath = glob.glob(fname)
+                if fullpath:
+                    yield fullpath[0]
+                else:
+                    print "WARNING: missing package", packagename
 
     def mount_source(self):
         """Mount the install media, needed for looking for available packages