summaryrefslogtreecommitdiff
path: root/ftparchive/writer.cc
AgeCommit message (Collapse)Author
2016-05-27prevent C++ locale number formatting in text APIsDavid Kalnischkies
Setting the C++ locale via std::locale::global(std::locale("")); which would otherwise default to the default C locale (aka: unaffected by setlocale) effects the formatting of numeric types in IO streams, which for output for humans is perfectly sensible, but breaks our many text interfaces used and parsed by us and others without expecting the numbers to be formatted. Closes: #825396
2016-05-01ftparchive: Support writing Signed-By fieldsJulian Andres Klode
2016-04-25add dep11 files to default Release patternsDavid Kalnischkies
2016-01-08include all compressed Packages/Sources files in Release fileDavid Kalnischkies
Having a hardcoded list of compression types here doesn't really provide us with anything beside added complexity each time someone adds a new compression type. That we don't need to be that specific is evident by Contents and Translation-* matchers which are a lot more generic and didn't generate problems anyhow.
2015-11-04wrap every unlink call to check for != /dev/nullDavid Kalnischkies
Unlinking /dev/null is bad, we shouldn't do that. Also, we should print at least a warning if we tried to unlink a file but didn't manage to pull it of (ignoring the case were the file is /dev/null or doesn't exist in the first place). This got triggered by a relatively unlikely to cause problem in pkgAcquire::Worker::PrepareFiles which would while temporary uncompressed files (which are set to keep compressed) figure out that to files are the same and prepare for sharing by deleting them. Bad move. That also shows why not printing a warning is a bad idea as this hide the error for in non-root test runs. Git-Dch: Ignore
2015-11-04support arch:all data e.g. in separate Packages fileDavid Kalnischkies
Based on a discussion with Niels Thykier who asked for Contents-all this implements apt trying for all architecture dependent files to get a file for the architecture all, which is treated internally now as an official architecture which is always around (like native). This way arch:all data can be shared instead of duplicated for each architecture requiring the user to download the same information again and again. There is one problem however: In Debian there is already a binary-all/ Packages file, but the binary-any files still include arch:all packages, so that downloading this file now would be a waste of time, bandwidth and diskspace. We therefore need a way to decide if it makes sense to download the all file for Packages in Debian or not. The obvious answer would be a special flag in the Release file indicating this, which would need to default to 'no' and every reasonable repository would override it to 'yes' in a few years time, but the flag would be there "forever". Looking closer at a Release file we see the field "Architectures", which doesn't include 'all' at the moment. With the idea outlined above that 'all' is a "proper" architecture now, we interpret this field as being authoritative in declaring which architectures are supported by this repository. If it says 'all', apt will try to get all, if not it will be skipped. This gives us another interesting feature: If I configure a source to download armel and mips, but it declares it supports only armel apt will now print a notice saying as much. Previously this was a very cryptic failure. If on the other hand the repository supports mips, too, but for some reason doesn't ship mips packages at the moment, this 'missing' file is silently ignored (= that is the same as the repository including an empty file). The Architectures field isn't mandatory through, so if it isn't there, we assume that every architecture is supported by this repository, which skips the arch:all if not listed in the release file.
2015-09-14use APT::FTPArchive hash settings as default for APT::FPArchive::$filetypeDavid Kalnischkies
2015-09-07Set APT::FTPArchive::DoByHash to false by defaultMichael Vogt
"apt-ftparchive release" will create the by-hash files if this mode is enabled. This maybe unexpected by existing users so make it a opt-in. Git-Dch: ignore
2015-09-07Ensure that no by-hash file for "Release/InRelease is written"Michael Vogt
Git-Dch: ignore Brown-paperbag: yes Thanks: Donkult
2015-09-04Add support for writing by-hash dirs in apt-ftparchiveMichael Vogt
This option is enabled via the APT::FTPArchive::DoByHash switch. It will also honor the option APT::FTPArchive::By-Hash-Keep that controls how many previous generation of by-hash files should be kept (defaults to 3). Merged from https://github.com/mvo5/apt/tree/feature/apt-ftparchive-by-hash
2015-08-13C++11: Switch from auto_ptr to unique_ptrJulian Andres Klode
This is nicer
2015-08-10fix memory leaks reported by -fsanitizeDavid Kalnischkies
Various small leaks here and there. Nothing particularily big, but still good to fix. Found by the sanitizers while running our testcases. Reported-By: gcc -fsanitize Git-Dch: Ignore
2015-05-11rewrite all TFRewrite instances to use the new pkgTagSection::WriteDavid Kalnischkies
While it is mostly busywork to rewrite all instances it actually fixes bugs as the data storage used by the new method is std::string rather than a char*, the later mostly created by c_str() from a std::string which the caller has to ensure keeps in scope – something apt-ftparchive actually didn't ensure and relied on copy-on-write behavior instead which c++11 forbids and hence the new default gcc abi doesn't use it.
2015-05-11fix 'Source' to 'Package' rename in apt-ftparchiveDavid Kalnischkies
This rename with value is ordered by the 'old' name 'Source', but should be ordered by the new name… by splitting the operation in a delete and a new field we can easily fix this problem locally for now.
2015-04-19calculate only expected hashes in methodsDavid Kalnischkies
Methods get told which hashes are expected by the acquire system, which means we can use this list to restrict what we calculate in the methods as any extra we are calculating is wasted effort as we can't compare it with anything anyway. Adding support for a new hash algorithm is therefore 'free' now and if a algorithm is no longer provided in a repository for a file, we automatically stop calculating it. In practice this results in a speed-up in Debian as we don't have SHA512 here (so far), so we practically stop calculating it.
2015-04-10reimplement the last uses of sprintfDavid Kalnischkies
Working with strings c-style is complicated and error-prune, so by converting to c++ style we gain some simplicity and avoid buffer overflows by later extensions. Git-Dch: Ignore
2015-03-16merge debian/sid into debian/experimentalDavid Kalnischkies
2015-01-10128 KiB DSC files ought to be enough for everyoneDavid Kalnischkies
Your mileage may vary, but don't worry: There is more than one way to do it, but our one size fits all is not a bigger hammer, but an entire roundhouse kick! So brace yourself for the tl;dr: The limit is gone.* Beware: This fixes also the problem that a double newline is unconditionally added 'later' which is an overcommitment in case the dsc filesize is limit-2 <= x <= limit. * limited to numbers fitting into an unsigned long long. Closes: 774893
2014-10-24promote filesize to a hashstringDavid Kalnischkies
It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
2014-05-09deal with hashes in ftparchive more dynamic as wellDavid Kalnischkies
Now that libapts acquire system happily passes around hashes and can be made to support new ones without an ABI break in the future, we can free ftparchive from all the deprecation warnings the last commit introduced for it. The goal here isn't to preserve ABI as we have none to keep here, but to help avoiding introduction problems of 'new' hashes later as bugs creep into the copy&paste parts, so short/less of them is good.
2014-05-08use a std::vector instead of hardcoded arrayDavid Kalnischkies
Arrays with predefined lengths are very fragile as they are likely forgotten in future changes and the size in this case is dynamic making it even more dangerous. Git-Dch: Ignore
2014-04-04Implement CacheDB for source packages in apt-ftparchiveMichael Vogt
2014-03-13cleanup headers and especially #includes everywhereDavid Kalnischkies
Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
2014-03-13warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies
Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
2013-08-08fix -Wall errorsMichael Vogt
2013-04-08merged lp:~mvo/apt/add-missing-dsc-hashesMichael Vogt
2013-03-18 - add method to open (maybe) clearsigned files transparentlyDavid Kalnischkies
* ftparchive/writer.cc: - use OpenMaybeClearSignedFile to be free from detecting and skipping clearsigning metadata in dsc files
2013-01-31merge patch apt_0.9.7.7ubuntu2~md1.debdiff, thanks to Marc DeslauriersMichael Vogt
2012-07-04* ftparchive/writer.cc:David Kalnischkies
- handle the APT::FTPArchive::Packages::SHA512 option correctly instead of overriding SHA256, thanks Christian Marillat! (Closes: #680252)
2012-05-21* ftparchive/writer.cc:David Kalnischkies
- include Contents-* files in Release files (Closes: #673647)
2012-02-18* apt-pkg/acquire-item.cc:David Kalnischkies
- drop support for i18n/Index file (introduced in 0.8.11) and use the Release file instead to get the Translations (Closes: #649314) * ftparchive/writer.cc: - add 'Translation-*' to the default patterns i18n/Index was never used outside debian - and even here it isn't used consistently as only 'main' has such a file. As the Release file now includes the Translation-* files we therefore drop support for i18n/Index. A version supporting it was never part of a debian release and still supporting it would mean that we get 99% of the time a 404 as response to the request anyway and confuse archive maintainers who want to provide all files APT tries to acquire.
2011-12-17try to avoid direct usage of .Fd() if possible and do read()s and coDavid Kalnischkies
on the FileFd instead
2011-12-14remove the second usage instance of ExecCompressor in ftparchiveDavid Kalnischkies
by again using the FileFd directly
2011-09-13merge with debian/experimentalDavid Kalnischkies
2011-09-13Support large files in the complete toolset. Indexes of thisDavid Kalnischkies
size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895)
2011-09-13reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies
2011-08-15merged from the debian-sid branchMichael Vogt
2011-08-11cppcheck complains about some possible speed improvements which could beDavid Kalnischkies
done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types.
2011-07-13* ftparchive/writer.cc:David Kalnischkies
- generate all checksums in one run over the file for Release
2011-06-29merge lp:~mvo/apt/abi-breakMichael Vogt
2011-06-08merge lp:~mvo/apt/sha512-template to add support for sha512Michael Vogt
2011-02-27 - load the supported compressors from configurationDavid Kalnischkies
- support adding new compressors by configuration
2011-02-25move sha512,256 into apt-pkg/sha2.{cc,h}, move gifford implementation to ↵Michael Vogt
sha2_internal.{cc,h}
2011-02-22add sha512 support to apt-ftparchiveMichael Vogt
2011-02-22* ftparchive/multicompress.cc, apt-inst/deb/debfile.cc:David Kalnischkies
- support xz compressor to create xz-compressed Indexes and be able to open data.tar.xz files * ftparchive/writer.cc: - include xz-compressed Packages and Sources files in Release file
2011-02-22* ftparchive/writer.cc:David Kalnischkies
- include xz-compressed Packages and Sources files in Release file
2011-02-22add options to disable specific checksums for IndexesDavid Kalnischkies
2011-02-22* ftparchive/writer.cc:David Kalnischkies
- ensure that Date and Valid-Until time strings are not localised
2011-01-24include Index files by default in the Release fileDavid Kalnischkies
2011-01-20* ftparchive/writer.cc:David Kalnischkies
- add config option to search for more patterns in release command