summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* get sources for packages in multiple releases againDavid Kalnischkies2016-01-262-12/+14
| | | | | | | | | In 321213f0dcdcdaab04e01663e7a047b261400c9c Andreas Cadhalpun corrected the incorrect overriding of earlier better-fitting results with later (semi-)matches – but that broke the case in which packages are in multiple releases in the same version (and the user has both releases configured). Closes: 812497
* parse version correctly from binary Source fieldDavid Kalnischkies2016-01-261-0/+20
| | | | | | | | | | | In commit a221efc331693f8905da870141756c892911c433 I promoted the source package name and version to the binary cache for faster access by e.g. EDSP, but due to changing the interpretation length to soon we always ignored the version part of the Source field, so that packages ended up having the binary version as source version – which while usually just fine it is wrong for binary rebuilds. Closes: 812492
* stablize gtest testcase environmentDavid Kalnischkies2016-01-263-4/+26
| | | | | | | | | Avoid the dependency on a specific current path for the tar test and ensure that _system is correctly initialized (gcc-6 runs into a segfault otherwise and with it fixed starts to depend on the multi-arch configuration of the running system… not good). Git-Dch: Ignore
* fix tests run via sudo checking the history fileDavid Kalnischkies2016-01-253-3/+23
| | | | Git-Dch: Ignore
* reimplement build-dep via apts normal resolverDavid Kalnischkies2016-01-256-32/+128
| | | | | | | | | | | | | | | | | | | | | | | | build-dep was implemented by parsing the build-dependencies of a package and figuring out which packages to install/remove based on this. That means that for the first level of dependencies build-dep was implementing its very own resolver with all the benefits (aka: bugs) this gives us for not using the existing resolver for all levels. Making this work involves generating a dummy binary package with fitting Depends and Conflicts and as we can't create them out of thin air the cache generation needs to be involved so we end up writing a Packages file which we want to parse – after we have parsed the other Packages files already. With .dsc/.deb files we could add them before we started parsing anything. With a bit of care we can avoid generating too much data we have to throw away again (as many parts assume that e.g. the count of packages doesn't change midair), so that on a speed front there shouldn't be much of a difference, but output can be slightly confusing as if we have a completely valid cache on disk the "Reading package lists... Done" is printed two times – but apt is pretty quick about it in that case. Closes: #137560, #444930, #489911, #583914, #728317, #812173
* always create pkg at the time pkg:arch is createdDavid Kalnischkies2016-01-252-5/+12
| | | | | | | | | To resolve dependencies like "pkg:arch" we create a package with the name "pkg:arch" and the architecture "any". We create these packages only if a dependency needs it as these kind of dependencies aren't that common. This commit ensured that in the even this architecture specific dependency is the only relation this package has we still create the underlying package to have them available in provides resolution.
* string_view: Drop constexpr constructor for standard compatibilityJulian Andres Klode2016-01-151-8/+8
| | | | | | | | | | | | | APT::StringView is supposed to be a temporary measure, until support for the standardized string_view is widely available. Introducing additional unstandardized features just makes porting to the standard version harder. The constexpr constructor also won't have any real effect on most systems, as the compiler will happily optimise the strlen() call away for constant strings. Gbp-Dch: ignore
* provide a constexpr char[] overload for APT::StringViewDavid Kalnischkies2016-01-151-0/+88
| | | | | | The commit also adds a few trivial tests Git-Dch: Ignore
* revert file-hash based action-merging in acquireDavid Kalnischkies2016-01-151-0/+0
| | | | | | | | | | | | | | | Introduced in 9d2a8a7388cf3b0bbbe92f6b0b30a533e1167f40 apt tries to merge actions like downloading the same (as judged by hashes) file into doing it once. The implementation was very simple in that it isn't planing at all. Turns out that it works 90% of the time just fine, but has issues in more complicated situations in which items can be in different stages downloading different files emitting potentially the "wrong" hash – like while pdiffs are worked on we might end up copying the patch instead of the result file giving us very strange errors in return. Reverting the change until we can implement a better planing solution seems to be the best course of action even if its sad. Closes: 810046
* fix M-A:foreign provides creation for unknown archsDavid Kalnischkies2016-01-142-2/+10
| | | | | | | | Architectures for packages which do not belong to the native nor a foreign architecture (dubbed barbarian for now) which are marked M-A:foreign still provide in their own architecture even if not for others. Also, other M-A:foreign (and allowed) packages provide in these barbarian architectures.
* Do not show multiple identical apt-cache showsrc entriesMichael Vogt2016-01-141-0/+25
| | | | Closes: #734922
* test-apt-acquire-additional-files: Set file mode of touched filesJulian Andres Klode2016-01-121-0/+4
| | | | | | | | | This prevents a test suite failure on systems with weird umasks. Also set umask 000 at the beginning so we can actually check for that anywhere. Gbp-Dch: ignore
* Only enable pipelining if server is HTTP/1.1Julian Andres Klode2016-01-121-2/+3
| | | | | | | Just enabling it for anyone breaks with HTTP/1.0 servers and proxies sometimes. Closes: #810796
* remove uncompressed leftover partial file before pdiff bootstrapDavid Kalnischkies2016-01-081-0/+6
| | | | | | | The code already deals with compressed leftovers, but forgot the uncompressed files. The opertunity is picked to reorder this code and add debug messages about the actions taken as well as produce such a leftover file in the associated testcase.
* use filesize of compressed pdiffs for the limit if possibleDavid Kalnischkies2016-01-081-2/+6
| | | | | | | | | | | | With the addition of the $HASH-Download field in the .diff/Index we got the size of the compressed patches for 'free', so if that information is available we can use it for a more fitting calculation of the size requirements of the patches vs. the complete file. Note that this predicts a too small size in the transition case in which the information isn't available for all patches, but figuring this out would be a lot of code for practically nothing as only one update can ever be in such a transition phase.
* tests: limit autotest-functionname generation to sane charactersDavid Kalnischkies2016-01-081-3/+3
| | | | | | | | Some (older) versions of bash seem to be allergic to a method named "aptautotest_grep_^apt" (note the caret). Unlikely that we are going to write autotests for such commands so we could just skip those, but lets instead just use "normal" characters in the names and strip the rest as we already did with the (arguable more common) '-'.
* support '-' and no parameter for stdin in apt-helper cat-fileDavid Kalnischkies2016-01-081-19/+5
| | | | | | This way it works more similar to the compressor binaries, which we can relief in this way from their job in the test framework avoiding the need of adding e.g. liblz4-tool to the test dependencies.
* keep compressed indexes in a low-cost formatDavid Kalnischkies2016-01-086-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading and storing are two different operations were different compression types can be preferred. For downloading we provide the choice via Acquire::CompressionTypes::Order as there is a choice to be made between download size and speed – and limited by whats available in the repository. Storage on the other hand has all compressions currently supported by apt available and to reduce runtime of tools accessing these files the compression type should be a low-cost format in terms of decompression. apt traditionally stores its indexes uncompressed on disk, but has options to keep them compressed. Now that apt downloads additional files we also deal with files which simply can't be stored uncompressed as they are just too big (like Contents for apt-file). Traditionally they are downloaded in a low-cost format (gz) as repositories do not provide other formats, but there might be even lower-cost formats and for download we could introduce higher-cost in the repositories. Downloading an entire index potentially requires recompression to another format, so an update takes potentially longer – but big files are usually updated via pdiffs which has to de- and re-compress anyhow and does it on the fly anyhow, so there is no extra time needed and in general it seems to be benefitial to invest the time in update to save time later on file access.
* tests: try to pick up compressors from config automaticallyDavid Kalnischkies2016-01-083-18/+20
| | | | | | Less hardcoding should help while introducing new compressors. Git-Dch: Ignore
* allow pdiff bootstrap from all supported compressorsDavid Kalnischkies2016-01-082-10/+29
| | | | | | | There is no reason to enforce that the file we start the bootstrap with is compressed with a compressor which is available online. This allows us to change the on-disk format as well as deals with repositories adding/removing support for a specific compressor.
* use one 'store' method to rule all (de)compressorsDavid Kalnischkies2016-01-081-2/+2
| | | | | | | | | | | Adding a new compressor method meant adding a new method as well – even if that boilt down to just linking to our generalized decompressor with a new name. That is unneeded busywork if we can instead just call the generalized decompressor and let it figure out which compressor to use based on the filenames rather than by program name. For compatibility we ship still 'gzip', 'bzip2' and co, but they are just links to our "new" 'store' method.
* test-apt-cache: Adjust for hashtable size changeJulian Andres Klode2016-01-031-3/+3
| | | | Gbp-Dch: ignore
* Add new APT::Keep-Downloaded-Packages optionMichael Vogt2016-01-021-0/+43
| | | | | | | | | | This option controls if downloaded packages should be kept after a successful install or if they should be deleted. The default for "apt-get" is that they are kept (just like before). However the default for "apt" is that they get deleted. Closes: #160743
* properly parse comments in apt_preferences and deb822-style sourcesDavid Kalnischkies2016-01-022-0/+27
| | | | | | | | | | apt_preferences and deb822-style sources used the specialized class pkgUserTagSection to deal with comments before/after a given stanza, but it couldn't deal with comments in the stanza at all. codesearch suggests that nobody else does and a vastely superior way of working with potentially commented files is implemented now, so we can officially discourage the use of the old incomplete hack class.
* support comments in debian/control parsingDavid Kalnischkies2016-01-021-0/+35
| | | | | | | | | Now (55153bf94ff28a23318e79aa48242244c4d82b3c) that pkgTagFile can be told to deal with all sorts of comments we can use this mode to parse dsc (as by catch) and debian/control files properly even in the wake of multiline fields spliced with comments like Build-Depends. Closes: 806775
* add optional support for comments in pkgTagFileDavid Kalnischkies2016-01-021-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | APT usually deals with perfectly formatted files generated automatically be other programs – and as it has to parse multiple MBs of such files it tries to be fast rather than forgiving. This was always a problem if we reused this parser for files with a deb822 syntax which are mostly written by hand however, like apt_preferences or the deb822-style sources as these can include stray newlines and more importantly comments all over the place. As a stopgap we had pkgUserTagSection which deals at least with comments before and after a given stanza, but comments in between weren't really supported and now that we support parsing debian/control for e.g. build-dep we face the full comment problem e.g. with comments inbetween multi-line fields (like Build-Depends). We can't easily deal with this on the pkgTagSection level as the interface gives access to 'raw' char-pointers for performance reasons so we would need to optionally add a buffer here on which we could remove comments to hand out pointers into this buffer instead. The interface is quite large already and supports writing stanzas as well, which does not support comments at all either. So while in future it might make sense to have a parser setup which deals with and keeps comments in this commit we opt for the simpler solution for now: We officially declare that pkgTagSection does not support comments and instead expect the caller to deal with them, which in our case is pkgTagFile: pkgTagFile is extended with an additional mode which can deal with comments by dropping them from the buffer which will later form the input of pkgTagSection. The actual implementation is slightly more complex than this sentence suggests at first on one hand to have good performance and on the other to allow jumping directly to stanzas with offsets collected in a previous run (like our cache generation does it for example).
* Fix test case that was broken by switch of hash functionJulian Andres Klode2015-12-291-5/+5
| | | | This test relies on the ordering of the hash function.
* deal with empty values properly in deb822 parserDavid Kalnischkies2015-12-271-1/+4
| | | | | | | | Regression introduced in 8710a36a01c0cb1648926792c2ad05185535558e, but such fields are unlikely in practice as it is just as simple to not have a field at all with the same result of not having a value. Closes: 808102
* allow repositories to forbid arch:all for specific index targetsDavid Kalnischkies2015-12-271-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | Debian has a Packages file for arch:all already, but the arch:any files contain arch:all packages as well, so downloading it would be a total waste of resources. Getting this solved is on the list of things to do, but it is also the hardest part – for index targets like Contents the situation is much easier and less server/client implementations are involved so we might not want to stall them. A repository can now declare via: No-Support-for-Architecture-all: Packages that even if an arch:all Packages exists, it shouldn't be downloaded, so that support for Contents files can be added now. See also 1dd20368486820efb6ef4476ad739e967174bec4 for the implementation of downloading arch:all index targets, which this is limiting. The field uses the name of the target from the apt configuration for simplicity and is negative by design as this field is intended to be supported/needed only for a "short" time (one or two Debian releases). While this commit theoretically supports any target, its expected to only see "Packages" as a value in reality.
* ensure we got a lock in clean operationDavid Kalnischkies2015-12-231-0/+10
| | | | | | We try to acquired the locks, but we didn't stop if we failed to get it… Closes: 808561
* tests: support gpg2 properly in all testcasesDavid Kalnischkies2015-12-194-44/+48
| | | | | | | | | The output changes slightly between different versions, which we already dealt with in the main testcase for apt-key, but there are two more which do not test both versions explicitly and so still had gpg1 output to check against as this is the default at the moment. Git-Dch: Ignore
* avoid evaluating shell in paths used in apt-keyDavid Kalnischkies2015-12-192-3/+21
| | | | | | | | | | | | apt-key creates internally a script (since ~1.1) which it will call to avoid dealing with an array of different options in the code itself, but while writing this script it wraps the values in "", which will cause the shell to evaluate its content upon execution. To make 'use' of this either set a absolute gpg command or TMPDIR to something as interesting as: "/tmp/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f1)\$!" If such paths can be encountered in reality is a different question…
* tests: support spaces in path and TMPDIRDavid Kalnischkies2015-12-19207-518/+495
| | | | | | | This doesn't allow all tests to run cleanly, but it at least allows to write tests which could run successfully in such environments. Git-Dch: Ignore
* Fix FileUtlTest.GetTempDir failure when run as rootPino Toscano2015-12-191-3/+7
| | | | | | | | | | | Testing /usr as TMPDIR assumes that GetTempDir() cannot use it because it cannot write to it; this is true for non-root users, but not so much for root. Since root can access everything, perform this particular test case only when not running as root. Closes: #808383
* test-apt-download-progress: Run the https test multiple timesJulian Andres Klode2015-12-141-2/+7
| | | | | This filters out errors due to timing issues. Early exits if enough pulses occured.
* pkgcache: Make hash arch-independent using fixed size integerJulian Andres Klode2015-12-141-1/+1
| | | | | | | | This helps writing test cases. Also adapt the test case that expected 64-bit. Nothing changes performance wise, the distribution of the hash values remains intact.
* tagfile: Hardcode error message for out of range integer valuesJulian Andres Klode2015-12-141-1/+1
| | | | | | This makes the test suite work on 32 bit-long platforms. Gbp-Dch: ignore
* test framework: More noopchroot fixesJulian Andres Klode2015-12-141-6/+11
| | | | | | | | | | | Use asprintf() so we have easy error detection and do not depend on PATH_MAX. Do not add another separator to the generated path, in both cases the path inside the chroot is guaranteed to have a leading / already. Also pass -Wall to gcc.
* test framework: Unset no_proxy as wellJulian Andres Klode2015-12-141-1/+1
| | | | | | This caused test-bug-717891-abolute-uris-for-proxies to fail Gbp-Dch: ignore
* test framework: Unset http proxy variables in setupenvironmentJulian Andres Klode2015-12-141-0/+1
| | | | | | This breaks a lot of test cases Gbp-Dch: ignore
* test framework: Correctly generate new paths in noopchrootJulian Andres Klode2015-12-141-6/+5
| | | | | | The allocated buffer was one byte too small. Allocate a buffer of PATH_MAX instead and use snprintf(), as suggested by Martin Pitt.
* test-apt-download-progress: Limit rate to 600kJulian Andres Klode2015-12-141-2/+2
| | | | | | This reduces the chance that the test fails. Gbp-Dch: ignore
* test-apt-download-progress: Allow smaller progress changeJulian Andres Klode2015-12-141-1/+1
| | | | | | | Instead of checking for [10%, 100%), check for (0%, 100%), that is everything < 100% and >0%. Gbp-Dch: ignore
* test-sourceslist-lang-plusminus-options: Use amd64 architectureJulian Andres Klode2015-12-141-1/+1
| | | | | | This should make the test work on non-amd64 systems Gbp-Dch: ignore
* non-existing directories don't need to be cleanedDavid Kalnischkies2015-12-142-2/+27
| | | | | | | | | | Trying to clean up directories which do not exist seems rather silly if you think about it, so let apt think about it and stop it. Depends a bit on the caller if this is fixing anything for them as they might try to acquire a lock or doing other clever things as apt does. Closes: 807477
* support regex and co in 'apt-cache policy $pkg' againDavid Kalnischkies2015-12-141-0/+9
| | | | | | | | | | Regression of 1e064088bf7b3e29cd36d30760fb3e4143a1a49a (1.1~exp4) which moved code around and renamed methods heavily ending up calling the wrong method matching packagenames only instead of calling the full array. Most commands work with versions, so this managed to fly under the radar for quite a while. Closes: 807870
* show a more descriptive error for weak Release filesDavid Kalnischkies2015-12-142-0/+53
| | | | | | | | | | | | | | If we can't work with the hashes we parsed from the Release file we display now an error message if the Release file includes only weak hashes instead of downloading the indexes and failing to verify them with "Hash Sum mismatch" even through the hashes didn't mismatch (they were just weak). If for some (unlikely) reason we have got weak hashes only for individual targets we will show a warning to this effect (again, befor downloading and failing the index itself). Closes: 806459
* Convert package names from Packages files to lower caseJulian Andres Klode2015-12-111-0/+21
| | | | | | | | | dpkg does that when reading package files, so we should do the same. This only deals with parsing names from binary package paragraphs, it does not look at source package names and/or the list of binaries in a dsc file. Closes: #807012
* test: Fix testcases relying on mixed case package namesJulian Andres Klode2015-12-111-23/+23
| | | | Gbp-Dch: ignore
* Do not swap required and important in pkgCache::Priority()Julian Andres Klode2015-12-101-0/+16
| | | | | | | | required and important were swapped, leading to wrong output. Closes: #807523 Thanks: Manuel A. Fernandez Montecelo for discovering this