X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0b45b6e5de1ba4224ced67a9952e009d0f4139a0..5832913a49d4f7c75527264a935cc0ce00627f1d:/ftparchive/writer.cc diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index c34a04d1a..eb17521eb 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -992,6 +992,7 @@ ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) : AddPattern("Release"); AddPattern("Contents-*"); AddPattern("Index"); + AddPattern("Index.*"); AddPattern("icons-*.tar"); AddPattern("icons-*.tar.*"); AddPattern("Components-*.yml"); @@ -1003,6 +1004,7 @@ ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) : time_t const now = time(NULL); time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0); + map BoolFields; map Fields; Fields["Origin"] = ""; Fields["Label"] = ""; @@ -1016,19 +1018,32 @@ ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) : Fields["Components"] = ""; Fields["Description"] = ""; Fields["Signed-By"] = ""; - if (_config->FindB("APT::FTPArchive::DoByHash", false) == true) - Fields["Acquire-By-Hash"] = "true"; - - for(map::const_iterator I = Fields.begin(); - I != Fields.end(); - ++I) + BoolFields["Acquire-By-Hash"] = _config->FindB("APT::FTPArchive::DoByHash", false); + BoolFields["NotAutomatic"] = false; + BoolFields["ButAutomaticUpgrades"] = false; + + // Read configuration for string fields, but don't output them + for (auto &&I : Fields) { - string Config = string("APT::FTPArchive::Release::") + (*I).first; - string Value = _config->Find(Config, (*I).second.c_str()); - if (Value == "") - continue; + string Config = string("APT::FTPArchive::Release::") + I.first; + I.second = _config->Find(Config, I.second); + } - std::string const out = I->first + ": " + Value + "\n"; + // Read configuration for bool fields, and add them to Fields if true + for (auto &&I : BoolFields) + { + string Config = string("APT::FTPArchive::Release::") + I.first; + I.second = _config->FindB(Config, I.second); + if (I.second) + Fields[I.first] = "yes"; + } + + // All configuration read and stored in Fields; output + for (auto &&I : Fields) + { + if (I.second.empty()) + continue; + std::string const out = I.first + ": " + I.second + "\n"; Output->Write(out.c_str(), out.length()); }