summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc19
-rw-r--r--test/integration/framework24
-rwxr-xr-xtest/integration/test-bug-879591-dont-warn-for-hidden-but-good-components25
3 files changed, 58 insertions, 10 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?)"),
diff --git a/test/integration/framework b/test/integration/framework
index f7c68859f..cfd621105 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -909,10 +909,17 @@ insertpackage() {
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and serve no other purposeā€¦}"
+ local SECTION="${8:-other}"
+
+ if [ "$SECTION" = "${SECTION#*/}" ]; then
+ DISTSECTION="main"
+ else
+ DISTSECTION="${SECTION%/*}"
+ fi
local ARCHS=""
for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do
if [ "$RELEASE" = 'installed' ]; then
- insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7"
+ insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8"
continue
fi
for arch in $(getarchitecturesfromcommalist "$ARCH"); do
@@ -922,17 +929,17 @@ insertpackage() {
ARCHS="$arch"
fi
for BUILDARCH in $ARCHS; do
- local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}"
+ local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}"
mkdir -p "$PPATH"
{
echo "Package: $NAME
Priority: $PRIORITY
-Section: other
+Section: $SECTION
Installed-Size: 42
Maintainer: Joe Sixpack <joe@example.org>"
test "$arch" = 'none' || echo "Architecture: $arch"
echo "Version: $VERSION
-Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb"
+Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb"
test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES"
echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)"
echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)"
@@ -941,12 +948,12 @@ Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb"
} >> "${PPATH}/Packages"
done
done
- mkdir -p "aptarchive/dists/${RELEASE}/main/source" "aptarchive/dists/${RELEASE}/main/i18n"
- touch "aptarchive/dists/${RELEASE}/main/source/Sources"
+ mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n"
+ touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources"
echo "Package: $NAME
Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)
Description-en: $DESCRIPTION
-" >> "aptarchive/dists/${RELEASE}/main/i18n/Translation-en"
+" >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en"
done
}
@@ -991,6 +998,7 @@ insertinstalledpackage() {
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and serve no other purposeā€¦}"
+ local SECTION="${8:-other}"
local FILE='rootdir/var/lib/dpkg/status'
local INFO='rootdir/var/lib/dpkg/info'
@@ -998,7 +1006,7 @@ insertinstalledpackage() {
echo "Package: $NAME
Status: $STATUS
Priority: $PRIORITY
-Section: other
+Section: $SECTION
Installed-Size: 42
Maintainer: Joe Sixpack <joe@example.org>
Version: $VERSION" >> "$FILE"
diff --git a/test/integration/test-bug-879591-dont-warn-for-hidden-but-good-components b/test/integration/test-bug-879591-dont-warn-for-hidden-but-good-components
new file mode 100755
index 000000000..6eb4e04a6
--- /dev/null
+++ b/test/integration/test-bug-879591-dont-warn-for-hidden-but-good-components
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'stable' 'foo' 'all' '1'
+insertpackage 'stable' 'bar' 'all' '1' '' '' '' 'main/debian-installer/others'
+insertpackage 'stable-backports' 'foo' 'all' '1+sb'
+insertpackage 'stable-backports' 'bar' 'all' '1+sb' '' '' '' 'main/debian-installer/others'
+
+find aptarchive/dists -path '*/debian-installer/i18n/Translation-en*' -delete
+
+setupaptarchive --no-update
+sed -i -e '/^Codename: / a\
+Components: main contrib' $(find ./aptarchive -name 'Release')
+signreleasefiles
+
+testsuccess aptget update
+
+sed -i -e 's# main\w*$# main main/debian-installer#' rootdir/etc/apt/sources.list.d/*
+
+testsuccess aptget update