summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-05-24 11:07:26 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2023-05-24 11:22:44 +0200
commit4e35e5079f589700b4b5f1fc00787144bc1c58bf (patch)
tree4cb33d5e8059d3719b3d045c733c9555212b4233 /apt-pkg
parent48cbc5413fb2a0e490c2282b9df65da96ad7a9f2 (diff)
Ensure that Snapshots: no doesn't get overriden by host-name config
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/debmetaindex.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index ddc246349..4bd7dfa78 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -1261,9 +1261,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/
#define APT_EMPTY_SERVER \
if (server.empty() == false) \
{ \
- if (server != "no") \
- return server; \
- return ""; \
+ return server; \
}
#define APT_CHECK_SERVER(X, Y) \
if (not Rls->Get##X().empty()) \
@@ -1321,12 +1319,10 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/
// Lookup a fallback based on the host. For a.b.c, this will try a.b.c, .b.c, and .c to allow generalization for cc.archive.ubuntu.com
for (std::string Host = ArchiveURI.Host; not Host.empty() && Server.empty(); Host = Host.find(".", 1) != Host.npos ? Host.substr(Host.find(".", 1)) : "")
Server = _config->Find("Acquire::Snapshots::URI::Host::" + Host);
- if (Server == "no")
- Server = "";
}
- if (Server.empty())
+ if (Server.empty() || Server == "no")
{
- if (filename.empty())
+ if (Server != "no" && filename.empty())
return _error->Error("Cannot identify snapshot server for %s %s - run update without snapshot id first", URI.c_str(), Dist.c_str());
return _error->Error("Snapshots not supported for %s %s", URI.c_str(), Dist.c_str());
}