[PATCH 07/10] Add kernel selection to YumPayload.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/packaging/__init__.py   |   11 ++++++++---
 pyanaconda/packaging/yumpayload.py |   31 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 61d0100..1002a2c 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -591,9 +591,14 @@ class ArchivePayload(ImagePayload):
 
 class PackagePayload(Payload):
     """ A PackagePayload installs a set of packages onto the target system. """
-    def preInstall(self, packages=None):
-        # TODO: kernel selection
-        super(PackagePayload, self).preInstall(packages=packages)
+    @property
+    def kernelPackages(self):
+        from pyanaconda.isys import isPaeAvailable
+        kernels = ["kernel"]
+        if isPaeAvailable():
+            kernels.insert(0, "kernel-PAE")
+
+        return kernels
 
 def payloadInitialize(storage, ksdata, payload):
     from pyanaconda.kickstart import selectPackages
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 6bf24f4..d3625c5 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -789,6 +789,8 @@ reposdir=%s
         for group in self.data.packages.excludedGroupList:
             self._deselectYumGroup(group.name)
 
+        self.selectKernelPackage()
+
     def checkSoftwareSelection(self):
         log.info("checking software selection")
 
@@ -840,6 +842,35 @@ reposdir=%s
 
             self._removeTxSaveFile()
 
+    def selectKernelPackage(self):
+        kernels = self.kernelPackages
+        selected = None
+        # XXX This is optimistic. I'm curious if yum will DTRT if I just say
+        #     "select this kernel" without jumping through hoops to figure out
+        #     which arch it should use.
+        for kernel in kernels:
+            try:
+                # XXX might need explicit arch specification
+                self._selectYumPackage(kernel)
+            except NoSuchPackage as e:
+                log.info("no %s package" % kernel)
+                continue
+            else:
+                log.info("selected %s" % kernel)
+                selected = kernel
+                # select module packages for this kernel
+
+                # select the devel package if gcc will be installed
+                if self._yum.tsInfo.matchNaevr(name="gcc"):
+                    log.info("selecting %s-devel" % kernel)
+                    # XXX might need explicit arch specification
+                    self._selectYumPackage("%s-devel" % kernel)
+
+                break
+
+        if not selected:
+            log.error("failed to select a kernel from %s" % kernels)
+
     def preInstall(self, packages=None):
         """ Perform pre-installation tasks. """
         super(YumPayload, self).preInstall(packages=packages)
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux