summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-09-14 13:18:29 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-09-14 15:22:19 +0200
commit24e8f24e1e94ec3816b0bfc7a05d1c4e3f73248e (patch)
tree0d40411af7333733aa11b56516a065892b6d7148 /apt-pkg/acquire-item.cc
parent63c7141275c8c5c0f6e60f5242785e50cabaf2a0 (diff)
add by-hash sources.list option and document all of by-hash
This changes the semantics of the option (which is renamed too) to be a yes/no value with the special additional value "force" as this allows by-hash to be disabled even if the repository indicates it would be supported and is more in line with our other yes/no options like pdiff which disable themselves if no support can be detected. The feature wasn't documented so far and hasn't reached a (un)stable release yet, so changing it without trying too hard to keep compatibility seems okay.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index c5b701fdc..1b76f1b7a 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1247,7 +1247,7 @@ string pkgAcqMetaClearSig::Custom600Headers() const
return Header;
}
/*}}}*/
-bool pkgAcqMetaClearSig::VerifyDone(std::string const &Message,
+bool pkgAcqMetaClearSig::VerifyDone(std::string const &Message, /*{{{*/
pkgAcquire::MethodConfig const * const Cnf)
{
Item::VerifyDone(Message, Cnf);
@@ -1257,6 +1257,7 @@ bool pkgAcqMetaClearSig::VerifyDone(std::string const &Message,
return true;
}
+ /*}}}*/
// pkgAcqMetaClearSig::Done - We got a file /*{{{*/
void pkgAcqMetaClearSig::Done(std::string const &Message,
HashStringList const &Hashes,
@@ -2480,13 +2481,9 @@ void pkgAcqIndex::Init(string const &URI, string const &URIDesc,
// AcqIndex::AdjustForByHash - modify URI for by-hash support /*{{{*/
void pkgAcqIndex::InitByHashIfNeeded()
{
- // TODO:
- // - (maybe?) add support for by-hash into the sources.list as flag
- // - make apt-ftparchive generate the hashes (and expire?)
- std::string HostKnob = "APT::Acquire::" + ::URI(Desc.URI).Host + "::By-Hash";
- if(_config->FindB("APT::Acquire::By-Hash", false) == true ||
- _config->FindB(HostKnob, false) == true ||
- TransactionManager->MetaIndexParser->GetSupportsAcquireByHash())
+ std::string const useByHash = Target.Option(IndexTarget::BY_HASH);
+ if(useByHash == "force" || (StringToBool(useByHash) == true &&
+ TransactionManager->MetaIndexParser->GetSupportsAcquireByHash()))
{
HashStringList const Hashes = GetExpectedHashes();
if(Hashes.usable())