~ubuntu-branches/ubuntu/saucy/ubuntu-release-upgrader/saucy-proposed

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeCache.py

  • Committer: Package Import Robot
  • Author(s): Brian Murray, Brian Murray, Steve Langasek
  • Date: 2013-09-12 10:38:41 UTC
  • Revision ID: package-import@ubuntu.com-20130912103841-f0ztpee1cfw91hyg
Tags: 1:0.203
[ Brian Murray ]
* test/test_sources_list.py: resolve test failure regarding EOL upgrades
* DistUpgradeQuirks.py: pep8 cleanup, remove some additional unnecessary
  quirks
* DistUpgrade/patches/: remove pycompile patch

[ Steve Langasek ]
* Drop all quirks for upgrades prior to the karmic->lucid upgrade; all
  releases earlier than 10.04 are entirely EOLed, and in any case users
  should not be upgrading directly from such old releases to 13.10 or
  later without going through the intermediate LTS releases, so this is
  all dead code.
* Drop use of base-installer for detecting "recommended" kernels for the
  hardware.  So far this code was only ever used for a one-time transition
  when more specialized kernel flavors became available on i386 that were
  preferred over the -386 flavor, and in the meantime the code is causing
  wrong results on upgrade for users of UbuntuStudio, which ships a kernel
  flavor that's not known by base-installer.  LP: #1220898.

Show diffs side-by-side

added added

removed removed

Lines of Context:
531
531
        return False
532
532
 
533
533
 
534
 
    def getKernelsFromBaseInstaller(self):
535
 
        """get the list of recommended kernels from base-installer"""
536
 
        p = Popen(["/bin/sh", "./get_kernel_list.sh"],
537
 
                  stdout=PIPE, universal_newlines=True)
538
 
        res = p.wait()
539
 
        if res != 0:
540
 
            logging.warn("./get_kernel_list.sh returned non-zero exitcode")
541
 
            return ""
542
 
        kernels = p.communicate()[0]
543
 
        kernels = [x.strip() for x in kernels.split("\n")]
544
 
        kernels = [x for x in kernels if len(x) > 0]
545
 
        logging.debug("./get_kernel_list.sh returns: %s" % kernels)
546
 
        return kernels
547
 
 
548
 
    def _selectKernelFromBaseInstaller(self):
549
 
        """ use the get_kernel_list.sh script (that uses base-installer)
550
 
            to figure out what kernel is most suitable for the system
551
 
        """
552
 
        # check if we have a kernel from that list installed first
553
 
        kernels = self.getKernelsFromBaseInstaller()
554
 
        for kernel in kernels:
555
 
            if not kernel in self:
556
 
                logging.debug("%s not available in cache" % kernel)
557
 
                continue
558
 
            # this can happen e.g. on cdrom -> cdrom only upgrades
559
 
            # where on hardy we have linux-386 but on the lucid CD 
560
 
            # we only have linux-generic
561
 
            if (not self[kernel].candidate or
562
 
                not self[kernel].candidate.downloadable):
563
 
                logging.debug("%s not downloadable" % kernel)
564
 
                continue
565
 
            # check if installed
566
 
            if self[kernel].is_installed or self[kernel].marked_install:
567
 
                logging.debug("%s kernel already installed" % kernel)
568
 
                if self[kernel].is_upgradable and not self[kernel].marked_upgrade:
569
 
                    self.mark_upgrade(kernel, "Upgrading kernel from base-installer")
570
 
                return 
571
 
        # if we have not found a kernel yet, use the first one that installs
572
 
        for kernel in kernels:
573
 
            if self.mark_install(kernel, 
574
 
                                 "Selecting new kernel from base-installer"):
575
 
                if self._has_kernel_headers_installed():
576
 
                    prefix, sep, postfix = kernel.partition("-")
577
 
                    headers = "%s-header-%s" % (prefix, postfix)
578
 
                    self.mark_install(
579
 
                        headers,
580
 
                        "Selecting new kernel headers from base-installer")
581
 
                else:
582
 
                    logging.debug("no kernel-headers installed")
583
 
                return
584
 
 
585
534
    def _has_kernel_headers_installed(self):
586
535
        for pkg in self:
587
536
            if (pkg.name.startswith("linux-headers-") and
603
552
        dmesg = Popen(["dmesg"],stdout=PIPE).communicate()[0]
604
553
        if b"WARNING: NR_CPUS limit" in dmesg:
605
554
            logging.debug("UP kernel on SMP system!?!")
606
 
        # use base-installer to get the kernel we want (if it exists)
607
 
        if os.path.exists("./get_kernel_list.sh"):
608
 
            self._selectKernelFromBaseInstaller()
609
 
        else:
610
 
            logging.debug("skipping ./get_kernel_list.sh: not found")
611
555
        return True
612
556
 
613
557
    def checkPriority(self):