From 8d23827be3043daf7fed1b86da1d41578889eaeb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 3 Sep 2017 14:38:58 +0200 Subject: ftparchive: Do not pass through disabled hashes in Sources When writing a Sources files hashes that were already present in the .dsc were always copied through (or modified), even if disabled. Remove them instead when they are disabled, otherwise we end up with hashes for tarballs and stuff but not for dsc files (as the dsc obviously does not hash itself). Also adjust the tests: test-compressed-indexes relied on Files being present in showsrc, and test-apt-update-weak-hashes expected the tarball to be downloaded when an archive only has MD5 and we are requiring SHA256 because that used to work because the tarball was always included. Closes: #872963 --- ftparchive/writer.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ftparchive') diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index bdf9893c2..bb855d532 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -849,12 +849,20 @@ bool SourcesWriter::DoPackage(string FileName) Changes.push_back(pkgTagSection::Tag::Rewrite("Package", Package)); if (Files.empty() == false) Changes.push_back(pkgTagSection::Tag::Rewrite("Files", Files)); + else + Changes.push_back(pkgTagSection::Tag::Remove("Files")); if (ChecksumsSha1.empty() == false) Changes.push_back(pkgTagSection::Tag::Rewrite("Checksums-Sha1", ChecksumsSha1)); + else + Changes.push_back(pkgTagSection::Tag::Remove("Checksums-Sha1")); if (ChecksumsSha256.empty() == false) Changes.push_back(pkgTagSection::Tag::Rewrite("Checksums-Sha256", ChecksumsSha256)); + else + Changes.push_back(pkgTagSection::Tag::Remove("Checksums-Sha256")); if (ChecksumsSha512.empty() == false) Changes.push_back(pkgTagSection::Tag::Rewrite("Checksums-Sha512", ChecksumsSha512)); + else + Changes.push_back(pkgTagSection::Tag::Remove("Checksums-Sha512")); if (Directory != "./") Changes.push_back(pkgTagSection::Tag::Rewrite("Directory", Directory)); Changes.push_back(pkgTagSection::Tag::Rewrite("Priority", BestPrio)); -- cgit v1.2.3