[PATCH 2/2] Simplify kernel package selection.

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

 



---
 yuminstall.py |   64 +++++++++++++++++++-------------------------------------
 1 files changed, 22 insertions(+), 42 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index eff50ba..c754b59 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1229,58 +1229,38 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
                 return None
             return pkgs[0]
 
-        foundkernel = False
-        kpkg = getBestKernelByArch("kernel", self.ayum)
-
-        # FIXME: this is a bit of a hack.  we shouldn't hard-code and
-        # instead check by provides.  but alas.
-        for k in ("kernel", "kernel-smp", "kernel-PAE"):
-            if len(self.ayum.tsInfo.matchNaevr(name=k)) > 0:
-                self.selectModulePackages(anaconda, k)
-                foundkernel = True
-
-        if not foundkernel and (isys.smpAvailable() or isys.htavailable()):
+        def selectKernel(pkgname):
             try:
-                ksmp = getBestKernelByArch("kernel-smp", self.ayum)
+                pkg = getBestKernelByArch(pkgname, self.ayum)
             except PackageSackError:
-                ksmp = None
-                log.debug("no kernel-smp package")
+                log.debug("no %s package" % pkgname)
+                return False
 
-            if ksmp and ksmp.returnSimple("arch") == kpkg.returnSimple("arch"):
-                foundkernel = True
-                log.info("selected kernel-smp package for kernel")
-                self.ayum.install(po=ksmp)
-                self.selectModulePackages(anaconda, ksmp.name)
+            if not pkg:
+                return False
 
-                if len(self.ayum.tsInfo.matchNaevr(name="gcc")) > 0:
-                    log.debug("selecting kernel-smp-devel")
-                    self.selectPackage("kernel-smp-devel.%s" % (kpkg.arch,))
+            log.info("selected %s package for kernel" % pkg.name)
+            self.ayum.install(po=pkg)
+            self.selectModulePackages(anaconda, pkg.name)
 
-        if not foundkernel and isys.isPaeAvailable():
-            try:
-                kpae = getBestKernelByArch("kernel-PAE", self.ayum)
-            except PackageSackError:
-                kpae = None
-                log.debug("no kernel-PAE package")
+            if len(self.ayum.tsInfo.matchNaevr(name="gcc")) > 0:
+                log.debug("selecting %s-devel" % pkg.name)
+                self.selectPackage("%s-devel.%s" % (pkg.name, pkg.arch))
+
+            return True
+
+        foundkernel = False
 
-            if kpae and kpae.returnSimple("arch") == kpkg.returnSimple("arch"):
+        if isys.smpAvailable() or isys.htavailable():
+            if selectKernel("kernel-smp"):
                 foundkernel = True
-                log.info("select kernel-PAE package for kernel")
-                self.ayum.install(po=kpae)
-                self.selectModulePackages(anaconda, kpae.name)
 
-                if len(self.ayum.tsInfo.matchNaevr(name="gcc")) > 0:
-                    log.debug("selecting kernel-PAE-devel")
-                    self.selectPackage("kernel-PAE-devel.%s" % (kpkg.arch,))
+        if not foundkernel and isys.isPaeAvailable():
+            if selectKernel("kernel-PAE"):
+                foundkernel = True
 
         if not foundkernel:
-            log.info("selected kernel package for kernel")
-            self.ayum.install(po=kpkg)
-            self.selectModulePackages(anaconda, kpkg.name)
-
-            if len(self.ayum.tsInfo.matchNaevr(name="gcc")) > 0:
-                log.debug("selecting kernel-devel")
-                self.selectPackage("kernel-devel.%s" % (kpkg.arch,))
+            selectKernel("kernel")
 
     def selectFSPackages(self, storage):
         for device in storage.fsset.devices:
-- 
1.6.1.3

_______________________________________________
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