Suggested removal procedure 1) find all packages that provide multiversion(kernel) 2) out of these find packages that provide kernel-uname-r, and strip second dash and anything that follows from the package name for the purpose of applying keepspec 3) for each group of packages with the same name apply keepspec, non-matching packages are scheduled for removal 4) for each package that is scheduled for removal also schedule debuginfo and debugsource of the same version for removal 5) determine what additional packages would need to be removed to satisfy dependencies, and schedule additional packages that match autoremove regexp(*) 6) if dependencies cannot be satisfied because some packages that do not match autoremove regexp would have to be removed deschedule removal of some packages (**) Typically a package depending on a KMP that depend on an old kernel version would fall into this category. *) can be lifted from original perl script **) Note that with the original perl script some random package providing the dependency would be preserved. With libzypp it should be possible to select highest version that provides the dependency.