summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2018-05-28 17:02:17 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2018-05-28 17:57:25 +0200
commit484babb7d00f7550cbaa592b7cb0022d38217fad (patch)
tree94d68d28db2f4a11aa3b750d95d0ca20dc53b4e2 /apt-pkg/acquire-item.cc
parentc94988e75ea923afe0daae5747f974927325b186 (diff)
Don't show acquire warning for "hidden" components
Commit d7c92411dc1f4c6be098d1425f9c1c075e0c2154 introduced a warning for non-existent files from components not mentioned in Components to hint users at a mispelling or the disappearance of a component. The debian-installer subcomponent isn't actively advertised in the Release file through, so if apt ends up in acquiring a file which doesn't exist for this component (like Translation files) apt would produce a warning: W: Skipping acquire of configured file 'main/debian-installer/i18n/Translation-en' as repository 'http://deb.debian.org/debian buster InRelease' doesn't have the component 'main/debian-installer' (component misspelt in sources.list?) We prevent this in the future by checking if any file exists from this component which results in the warning to be produced still for the intended cases and silence it on the d-i case. This could potentially cause the warning not to be produced in cases it should be if some marginal file remains, but as this message is just a hint and the setup a bit pathological lets ignore it for now. There is also the possibility of having no file present as they would all be 0-length files and being a "hidden" component, but that would be easy to workaround from the repository side and isn't really actively used at the moment in the wild. Closes: #879591
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index a366b8981..0126b0f63 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -39,6 +39,7 @@
#include <random>
#include <sstream>
#include <string>
+#include <unordered_set>
#include <vector>
#include <errno.h>
#include <stddef.h>
@@ -1511,7 +1512,7 @@ void pkgAcqMetaClearSig::QueueIndexes(bool const verify) /*{{{*/
// at this point the real Items are loaded in the fetcher
ExpectedAdditionalItems = 0;
- std::set<std::string> targetsSeen;
+ std::unordered_set<std::string> targetsSeen, componentsSeen;
bool const hasReleaseFile = TransactionManager->MetaIndexParser != NULL;
bool hasHashes = true;
auto IndexTargets = TransactionManager->MetaIndexParser->GetIndexTargets();
@@ -1535,6 +1536,18 @@ void pkgAcqMetaClearSig::QueueIndexes(bool const verify) /*{{{*/
range_start = range_end;
} while (range_start != IndexTargets.end());
}
+ /* Collect all components for which files exist to prevent apt from warning users
+ about "hidden" components for which not all files exist like main/debian-installer
+ and Translation files */
+ if (hasReleaseFile == true)
+ for (auto const &Target : IndexTargets)
+ if (TransactionManager->MetaIndexParser->Exists(Target.MetaKey))
+ {
+ auto component = Target.Option(IndexTarget::COMPONENT);
+ if (component.empty() == false)
+ componentsSeen.emplace(std::move(component));
+ }
+
for (auto&& Target: IndexTargets)
{
// if we have seen a target which is created-by a target this one here is declared a
@@ -1566,7 +1579,9 @@ void pkgAcqMetaClearSig::QueueIndexes(bool const verify) /*{{{*/
if (TransactionManager->MetaIndexParser->Exists(Target.MetaKey) == false)
{
auto const component = Target.Option(IndexTarget::COMPONENT);
- if (component.empty() == false && TransactionManager->MetaIndexParser->HasSupportForComponent(component) == false)
+ if (component.empty() == false &&
+ componentsSeen.find(component) == std::end(componentsSeen) &&
+ TransactionManager->MetaIndexParser->HasSupportForComponent(component) == false)
{
new CleanupItem(Owner, TransactionManager, Target);
_error->Warning(_("Skipping acquire of configured file '%s' as repository '%s' doesn't have the component '%s' (component misspelt in sources.list?)"),