Upgrade Notifications for Kubuntu and Ubuntu Studio
Julian Andres Klode
julian.klode at canonical.com
Fri Sep 9 10:09:32 UTC 2022
On Thu, Sep 08, 2022 at 08:46:31PM -0700, Erich Eickmeyer wrote:
> Hi Aleix,
>
> On Thursday, September 8, 2022 1:30:02 PM PDT Aleix Pol wrote:
> > Note that Discover is just using PackageKit, so it's a problem to address
> > there.
> >
> > If despite having Discover be "very, very flawed" you want to have a
> > discussion one day about how to make it fit for your purpose, I'll be
> > happy to join and see what can be done.
> >
>
> That was not meant as an insult to your work, and I'm terribly sorry if it
> arrived that way. Honestly, Discover is a fine piece of software, especially as
> a software store and I quite enjoy using it as such. However, I think you're
> right, my observations toward the "very, very flawed" might be better directed
> at PackageKit since it doesn't have the capability to do autoremove like I'm
> suggesting for software updates.
It's not hard to implement, it's basically
bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
bool doAutoRemoveKernels = _config->FindB("APT::Get::AutomaticRemove::Kernels", false);
bool hideAutoRemove = _config->FindB("APT::Get::HideAutoRemove");
std::unique_ptr<APT::CacheFilter::Matcher> kernelAutoremovalMatcher;
if (doAutoRemoveKernels && !doAutoRemove)
{
kernelAutoremovalMatcher = APT::KernelAutoRemoveHelper::GetProtectedKernelsFilter(Cache, true);
}
Cache->MarkAndSweep();
SortedPackageUniverse Universe(Cache);
// look over the cache to see what can be removed
for (auto const &Pkg: Universe)
{
if (Cache[Pkg].Garbage)
{
if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
if(Debug)
std::cout << "We could delete " << APT::PrettyPkg(Cache, Pkg) << std::endl;
if (doAutoRemove || (kernelAutoremovalMatcher != nullptr && (*kernelAutoremovalMatcher)(Pkg)))
{
if(Pkg.CurrentVer() != 0 &&
Pkg->CurrentState != pkgCache::State::ConfigFiles)
Cache->MarkDelete(Pkg, purgePkgs, 0, false);
else
Cache->MarkKeep(Pkg, false, false);
}
at the right place after calling Upgrade().
Though I don't know maybe it needs the following code bits too where we recover
packages we now have broken.
// we could have removed a new dependency of a garbage package,
// so check if a reverse depends is broken and if so install it again.
Probably it makes sense to extract the non-CLI bits of DoAutoremove() in apt-private
to apt-pkg, so PackageKit and others just have one function to call to do any autoremovals
that should be done by policy.
--
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer i speak de, en
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kubuntu-devel/attachments/20220909/61ba4592/attachment.sig>
More information about the kubuntu-devel
mailing list