Logo Search packages:      
Sourcecode: yum-utils version File versions  Download package

def package-cleanup::PackageCleanup::_remove_old_kernels (   self,
  count,
  keepdevel 
) [private]
Remove old kernels, keep at most count kernels (and always keep the running
 kernel

Definition at line 264 of file package-cleanup.py.

                                                   :
        """Remove old kernels, keep at most count kernels (and always keep the running
         kernel"""

        count = int(count)
        kernels = self._get_kernels()
        runningkernel = os.uname()[2]
        # Vanilla kernels dont have a release, only a version
        if '-' in runningkernel:
            (kver,krel) = runningkernel.split('-')
            if krel.split('.')[-1] == os.uname()[-1]:
                krel = ".".join(krel.split('.')[:-1])
        else:
            kver = runningkernel
            krel = ""
        remove = kernels[count:]
        
        toremove = []
        # Remove running kernel from remove list
        for kernel in remove:
            if kernel.version == kver and krel.startswith(kernel.release):
                print "Not removing kernel %s-%s because it is the running kernel" % (kver,krel)
            else:
                toremove.append(kernel)
        
            
        # Now extend the list with all kernel-devel pacakges that either
        # have no matching kernel installed or belong to a kernel that is to
        # be removed
        if not keepdevel: 
            toremove.extend(self._get_old_kernel_devel(kernels, toremove))

        for po in toremove:
            self.remove(po)



Generated by  Doxygen 1.6.0   Back to index