From 1a35028dd9ee4554a1a1f9f77a4dee615fb278ae Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Dec 2024 22:14:43 +0000 Subject: Drop SourceListWarnings::NonFreeFirmware messages They were implemented to help a tiny bit in notifying users even if they didn't read the Release notes (or didn't realize it would apply to them) that they likely have to change their sources.list entries, but that transition is now over for a while, so everyone who should have seen it has hopefully reacted to it and so all this code now does is waste space, time and idly waiting for false positives. --- apt-private/private-update.cc | 129 ------------------------------------------ 1 file changed, 129 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index 4f0296046..694480a96 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -21,32 +21,11 @@ #include #include -#include #include /*}}}*/ // DoUpdate - Update the package lists /*{{{*/ -static bool isDebianBookwormRelease(pkgCache::RlsFileIterator const &RlsFile) -{ - std::tuple const affected[] = { - {"Debian", "Debian", "bookworm"}, - {"Debian", "Debian", "sid"}, - }; - if (RlsFile.end() || RlsFile->Origin == nullptr || RlsFile->Label == nullptr || RlsFile->Codename == nullptr) - return false; - std::tuple const release{RlsFile.Origin(), RlsFile.Label(), RlsFile.Codename()}; - return std::find(std::begin(affected), std::end(affected), release) != std::end(affected); -} -static void suggestDebianNonFreeFirmware(char const *const repo, char const *const val, - char const *const from, char const *const to) -{ - // Both messages are reused from the ReleaseInfoChange feature in acquire-item.cc - _error->Notice(_("Repository '%s' changed its '%s' value from '%s' to '%s'"), repo, val, from, to); - std::string notes; - strprintf(notes, "https://www.debian.org/releases/bookworm/%s/release-notes/ch-information.html#non-free-split", _config->Find("APT::Architecture").c_str()); - _error->Notice(_("More information about this can be found online in the Release notes at: %s"), notes.c_str()); -} bool DoUpdate(CommandLine &CmdL) { if (CmdL.FileSize() != 1) @@ -125,114 +104,6 @@ bool DoUpdate() } } - if (_config->FindB("APT::Get::Update::SourceListWarnings::NonFreeFirmware", SLWarnings)) - { - // If a Debian source has a non-free component, suggest adding non-free-firmware - bool found_affected_release = false; - bool found_non_free = false; - bool found_non_free_firmware = false; - for (auto *S : *List) - { - if (not isDebianBookwormRelease(S->FindInCache(Cache, false))) - continue; - - for (auto PkgFile = Cache.GetPkgCache()->FileBegin(); not PkgFile.end(); ++PkgFile) - { - if (PkgFile.Flagged(pkgCache::Flag::NoPackages)) - continue; - found_affected_release = true; - const auto * const comp = PkgFile.Component(); - if (comp == nullptr) - continue; - if (strcmp(comp, "non-free") == 0) - found_non_free = true; - else if (strcmp(comp, "non-free-firmware") == 0) - { - found_non_free_firmware = true; - break; - } - } - if (found_non_free_firmware) - break; - } - if (not found_non_free_firmware && found_non_free && found_affected_release) - { - /* See if a well-known firmware package is installable from this codename - if so, we likely operate with new apt on an old snapshot not supporting non-free-firmware */ - bool suggest_non_free_firmware = true; - if (auto const Grp = Cache.GetPkgCache()->FindGrp("firmware-linux-nonfree"); not Grp.end()) - { - for (auto Pkg = Grp.PackageList(); not Pkg.end() && suggest_non_free_firmware; Pkg = Grp.NextPkg(Pkg)) - { - for (auto Ver = Pkg.VersionList(); not Ver.end(); ++Ver) - { - if (not Ver.Downloadable()) - continue; - for (auto VerFile = Ver.FileList(); not VerFile.end(); ++VerFile) - { - auto const PkgFile = VerFile.File(); - if (PkgFile.end()) - continue; - if (not isDebianBookwormRelease(PkgFile.ReleaseFile())) - continue; - suggest_non_free_firmware = false; - break; - } - if (not suggest_non_free_firmware) - break; - } - } - } - if (suggest_non_free_firmware) - suggestDebianNonFreeFirmware("Debian bookworm", "non-free component", "non-free", "non-free non-free-firmware"); - } - - if (not found_non_free_firmware && not found_non_free && found_affected_release) - { - /* Try to notify users who have installed firmware packages at some point, but - have not enabled non-free currently – they might want to opt into updates now */ - std::string_view const affected_pkgs[] = { - "amd64-microcode", "atmel-firmware", "bluez-firmware", "dahdi-firmware-nonfree", - "firmware-amd-graphics", "firmware-ast", "firmware-atheros", "firmware-bnx2", - "firmware-bnx2x", "firmware-brcm80211", "firmware-cavium", "firmware-intel-sound", - "firmware-intelwimax", "firmware-ipw2x00", "firmware-ivtv", "firmware-iwlwifi", - "firmware-libertas", "firmware-linux", "firmware-linux-nonfree", "firmware-misc-nonfree", - "firmware-myricom", "firmware-netronome", "firmware-netxen", "firmware-qcom-media", - "firmware-qcom-soc", "firmware-qlogic", "firmware-realtek", "firmware-realtek-rtl8723cs-bt", - "firmware-samsung", "firmware-siano", "firmware-sof-signed", "firmware-ti-connectivity", - "firmware-zd1211", "intel-microcode", "midisport-firmware", "raspi-firmware", - }; - bool suggest_non_free_firmware = false; - for (auto pkgname : affected_pkgs) - { - auto const Grp = Cache.GetPkgCache()->FindGrp(pkgname); - if (Grp.end()) - continue; - for (auto Pkg = Grp.PackageList(); not Pkg.end(); Pkg = Grp.NextPkg(Pkg)) - { - auto const Ver = Pkg.CurrentVer(); - if (Ver.end() || Ver.Downloadable()) - continue; - bool another = false; - for (auto V = Pkg.VersionList(); not V.end(); ++V) - if (V.Downloadable()) - { - another = true; - break; - } - if (another) - continue; - suggest_non_free_firmware = true; - break; - } - if (suggest_non_free_firmware) - break; - } - if (suggest_non_free_firmware) - suggestDebianNonFreeFirmware("Debian bookworm", "firmware component", "non-free", "non-free-firmware"); - } - } - if (_config->FindB("APT::Get::Update::SourceListWarnings::SignedBy", SLWarnings)) { for (auto *S : *List) -- cgit v1.2.3-70-g09d2