summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* wrap every unlink call to check for != /dev/nullDavid Kalnischkies2015-11-0410-39/+38
| | | | | | | | | | | | | | | | 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
* ensure FileFd doesn't try to open /dev/null as atomic and coDavid Kalnischkies2015-11-041-6/+10
| | | | | | | | | | The wrapping will fail in the best case and actually end up deleting /dev/null in the worst case. Given that there is no point in trying to write atomically to /dev/null as you can't read from it again just ignore these flags if higher level code ends up trying to use them on /dev/null. Git-Dch: Ignore
* ignore newlines in dpkg-deb control output for installing debsDavid Kalnischkies2015-11-041-4/+13
| | | | | | | | | | | Leading or trailing newlines can be confusing for our parser as it expects two newlines to start/stop a new stanza. To solve this the lines we wanna add are printed first, ignore any leading newlines and then add the stanza as provided by dpkg-deb with or without trailing newlines as the parser will look at the first stanza only anyway and removing trailing newlines is considerably harder to do. Closes: 802553
* support arch:all data e.g. in separate Packages fileDavid Kalnischkies2015-11-046-4/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sanify API to get 'the' candidate versionDavid Kalnischkies2015-11-046-9/+35
| | | | | | | | | This was discussed a while ago on #debian-apt and now that I see myself making this mistake lets bite the bullet and fix it in the easy way out version: Using a new name which fits with a similar named setter and deprecate the old method instead of 'hostily' changing API. Closes: #803471
* centralize unlink checks in acquire-itemDavid Kalnischkies2015-11-041-16/+30
| | | | | | | | Removals in the acquire progress can be pretty important, so a failure should be silently ignored, so we wrap our unlink call in a slightly more forgiving wrapper checking things. Git-Dch: Ignore
* do not cleanup .diff/Index files on HitDavid Kalnischkies2015-11-041-0/+3
| | | | Git-Dch: Ignore
* move apts cmdline helper type into -privateDavid Kalnischkies2015-11-042-68/+5
| | | | | | | | Its not as simple as I initially thought to abstract this enough to make it globally usable, so lets not pollute global namespace with this for now. Git-Dch: Ignore
* new quiet level -qq for apt to hide progress outputDavid Kalnischkies2015-11-041-1/+1
| | | | | | | | | -q is for logging and -qqq (old -qq) basically kills every output expect errors, so there should be a way of declaring a middleground in which the output of e.g. 'update' isn't as verbose, but still shows some things. The test framework was actually making use of by accident as it ignored the quiet level in output setup for apt before. Eventually we should figure out some better quiet levels for all tools…
* deduplicate main methodsDavid Kalnischkies2015-11-042-2/+2
| | | | | | | | All mains pretty much do the same thing, so lets try a little harder to move the common parts into -private to have the real differences more visible. Git-Dch: Ignore
* split up help messages for simpler reuseDavid Kalnischkies2015-11-042-2/+71
| | | | | | | | | | | | | That is one huge commit with busy work only: Help messages used to be one big translateable string, which is a pain for translators and hard to reuse for us. This change there 'explodes' this single string into new string for each documented string trying hard to split up the translated messages as well. This actually restores many translations as previously adding a single command made all of the bug message fuzzy. The splitup also highlighted that its easy to forget a line, duplicate one and similar stuff. Git-Dch: Ignore
* add binary-specific options via Binary scopeDavid Kalnischkies2015-11-042-0/+55
| | | | | | Especially with apt now, it can be useful to set an option only for apt and not for apt-get. Using a binary-specific subtree which is merged into the root seems like a simple enough trick to achieve this.
* refer to apt-secure(8) in unsecure repositories warningDavid Kalnischkies2015-11-041-1/+1
| | | | | | The manpage is also slightly updated to work better as a central hub to push people from all angles into the right directions without writting a book disguised as an error message.
* rework errors and warnings around insecure repositoriesDavid Kalnischkies2015-11-041-22/+39
| | | | | | | | | | | | | | | | Insecure (aka unsigned) repositories are bad, period. We want to get right of them finally and as a first step we are printing scary warnings. This is already done, this commit just changes the messages to be more consistent and prevents them from being displayed if authenticity is guaranteed some other way (as indicated with trusted=yes). The idea is to first print the pure fact like "repository isn't signed" as a warning (and later as an error), while giving an explaination in a immediately following notice (which is displayed only in quiet level 0: so in interactive use, not in scripts and alike). Closes: 796549
* add ConnectionTimedOut to transient failreasons listDavid Kalnischkies2015-11-041-6/+10
| | | | | | All other reasons from methods/connect.cc were already included. Git-Dch: Ignore
* support .deb files in upgrade operations as wellDavid Kalnischkies2015-11-043-9/+40
| | | | | | The main part is refactoring through to allow hiding the magic needed to support .deb files in deeper layers of libapt so that frontends have less exposure to Debian specific classes like debDebPkgFileIndex.
* show progress info while 'downloading' a local .deb fileDavid Kalnischkies2015-11-043-3/+17
| | | | | Showing just "Get: [1234 B]" looks very strange, so we now print the filename and as usual the package name, version and architecture.
* unbreak the copy-method claiming hashsum mismatch since ~exp9David Kalnischkies2015-11-041-13/+22
| | | | | | | | | | | | | | | | Commit 653ef26c70dc9c0e2cbfdd4e79117876bb63e87d broke the camels back in sofar that everything works in terms of our internal use of copy:/, but external use is completely destroyed. This is kinda the reverse of what happened in "parallel" in the sid branch, where external use was mostly fine, internal and external exploded on the GzipIndexes option. We fix this now by rewriting our internal use by letting copy:/ only do what the name suggests it does: Copy files and not uncompress them on-the-fly. Then we teach copy and the uncompressors how to deal with /dev/null and use it as destination file in case we don't want to store the uncompressed files on disk. Closes: 799158
* allow all dpkg selections to be set via apt-mark and libaptDavid Kalnischkies2015-11-042-33/+73
| | | | | | As we have support for 'hold', we need support for undoing a hold which in effect means that we implemented most other states as well, just that they weren't exposed in the interface directly so far.
* provide public interface to hold/unhold packagesDavid Kalnischkies2015-11-045-7/+190
| | | | | | We had this code lying around in apt-mark for a while now, but other frontends need this (and similar) functionality as well, so its high time that we provide a public interface in libapt for this stuff.
* refactor dpkg execution in deb/debsystemDavid Kalnischkies2015-11-041-47/+61
| | | | | | We have a few places and there will be a few more still where we have to call dpkg to detect/set certain features or settings. Centralizing the calling infrastructure now seems like a good idea before we add another.
* add cacheset push_back wrapping for std::back_inserterDavid Kalnischkies2015-11-041-1/+27
| | | | | | | | | | | | As usual by now, not all containers wrapped by the cacheset containers support all methods, like push_back now, but they fail on use of these unusable methods only. Would be nice to not expose these methods for unsupporting containers at all, but that means either a lot of classes or a lot of std::enable_if magic, which seems like too big work for this small wrapper for now. Git-Dch: Ignore
* implement operator* for cacheset iteratorsDavid Kalnischkies2015-11-041-1/+20
| | | | | | | | | | | | | | | | Technically an abi-break as we change a template parameter to std::iterator for this, but this class is empty in all instances and just causes the right typedefs to be set – which were incorrect as detected by std::stable_partition as its implementation uses ::pointer and needs also a operator* implementation. In practice CacheSets have no external users (yet) and the difference is visible only at compile time (which was an error before and now works), not while linking. The changes to apt-mark are functionally identical to the code before, just that we use a std:: algorithm now instead of trying hard on our own.
* implement a public pkgSystem::ArchitecturesSupportedDavid Kalnischkies2015-11-045-83/+82
|
* implement a public pkgSystem::MultiArchSupportedDavid Kalnischkies2015-11-045-82/+130
| | | | | | Some codepaths need to check if the system (in our case usually dpkg) supports MultiArch or not. We had copy-pasted the check so far into these paths, but having it as a system check is better for reusability.
* orderlist: Replace qsort() by thread-safe std::sort()Julian Andres Klode2015-10-302-24/+20
| | | | Gbp-Dch: ignore
* algorithms: Replace qsort() by thread-safe std::sort()Julian Andres Klode2015-10-302-39/+45
| | | | Gbp-Dch: ignore
* dpkgpm: Convert users of localtime() to localtime_r()Julian Andres Klode2015-10-301-2/+4
| | | | | | The former is not thread-safe, whereas the latter is. Gbp-Dch: ignore
* cacheset: Fix compilation on new GCC in C++98 modeJulian Andres Klode2015-10-301-3/+3
| | | | | | | | | | | | | Since gcc 4.9, the API for erase slightly changed. In commit 3dddcdf2432e78f37c74d8c76c2c519a8d935ab2 the existing checks for __cplusplus where changed to check the gcc version, as the __cplusplus check did nothing, because gcc 4.8 already provided the standard value in there. Fix the code to check for the gcc version in two more places, and change the existing checks to use a convenience macro.
* srvrec: Do not expose C++11 tuple use in headerJulian Andres Klode2015-10-302-4/+8
| | | | This makes non-C++11 reverse deps wishing to use it FTBFS.
* dpkgpm: Use ptsname_r() instead of ptsname() to be thread-safeJulian Andres Klode2015-10-301-0/+5
| | | | | | | This function only exists on a limited number of platforms, so we add a configure check to make sure it exists. Gbp-Dch: ignore
* dpkgpm: Convert ctime() call to ctime_r()Julian Andres Klode2015-10-301-1/+2
| | | | | | ctime() is not thread-safe, ctime_r() is. Gbp-Dch: ignore
* aptconfiguration: Convert strtok() to strtok_r()Julian Andres Klode2015-10-301-2/+3
| | | | | | strtok() is not thread-safe, whereas strtok_r() is. Gbp-Dch: ignore
* GetSrvRecords: Make thread-safeJulian Andres Klode2015-10-301-2/+7
| | | | Gbp-Dch: ignore
* deblistparser: Make PrioList constJulian Andres Klode2015-10-232-3/+3
| | | | More safety, less writeable memory.
* Revert "Fix select timeout to be 50msec instead of 0.5msec" for acquireJulian Andres Klode2015-10-111-1/+1
| | | | | | | | | | | The acquire system actually uses usec pulse intervals, so the previous value was correct (500ms) whereas the new value is now 5s. It's a bit unfortunate that the two systems use different units for pulse intervals, but probably not much we can do about it. This partially reverts commit eaf21c2144fa8dc4be8581dc69cf88cb38e30ce2.
* Fix select timeout to be 50msec instead of 0.5msecMichael Vogt2015-09-302-2/+2
| | | | Closes: #799857
* fallback to well-known URI if by-hash failsDavid Kalnischkies2015-09-141-36/+50
| | | | | | | | | | | | | | | | | | | | | | | | | We uses a small trick to implement the fallback: We make it so, that by-hash is a special compression algorithm and apt already knows how to deal with fallback between compression algorithms. The drawback with implementing this fallback is that a) we are guessing again and more importantly b) by-hash is only tried for the first compression algorithm we want to acquire, not for all as before – but flipping between by-hash and well-known for each compression algorithm seems to be not really worth it as it seems unlikely that there will actually be mirrors who only mirror a subset of compressioned files, but have by-hash enabled. The user-experience is the usual fallback one: You see "Ign" lines in the apt update output. The fallback is implemented as a transition feature, so a (potentially huge) mirror network doesn't need a flagday. It is not meant as a "someday we might" or "we don't, but some of our mirrors might" option – we want to cut down on the 'Ign' lines front so that they become meaningful – if we wanted to spam everyone with them, we could enable by-hash by default for all repositories… sources.list and config options are better suited for this. Closes: 798919
* add by-hash sources.list option and document all of by-hashDavid Kalnischkies2015-09-146-12/+27
| | | | | | | | | | | | 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.
* do not ignore differently versioned self-providesDavid Kalnischkies2015-09-141-1/+2
| | | | Reported-By: Konomi on IRC
* srv test: do 100 pulls twice and compare listDavid Kalnischkies2015-09-141-0/+4
| | | | | | | The previous implementation was still a bit unstable in terms of failing at times. Lets try if we have more luck with this one. Git-Dch: Ignore
* fix alloc-dealloc-mismatch (operator new [] vs operator delete)David Kalnischkies2015-09-141-4/+4
| | | | | Reported-By: gcc -fsanitize=address -fno-sanitize=vptr Git-Dch: Ignore
* fix two memory leaks reported by gccDavid Kalnischkies2015-09-141-6/+9
| | | | | Reported-By: gcc -fsanitize=address -fno-sanitize=vptr Git-Dch: Ignore
* use std-algorithms instead of manual loops to avoid overflow warningDavid Kalnischkies2015-09-142-21/+26
| | | | | | Reported-By: gcc Understandable: no Git-Dch: Ignore
* do not report deprecate warnings for the None declarationDavid Kalnischkies2015-09-141-0/+2
| | | | | | | | This is defined for compatibility, warning about it is intended, but only in places where it is actually used, rather than at the place we declare it for compatability… Git-Dch: Ignore
* fix 'Dead assignment' by dropping unneeded booleanDavid Kalnischkies2015-09-141-3/+1
| | | | | Reported-By: scan-build Git-Dch: Ignore
* avoid using global PendingError to avoid failing too often too soonDavid Kalnischkies2015-09-1416-86/+101
| | | | | | | | | | | | | | | | | | | Our error reporting is historically grown into some kind of mess. A while ago I implemented stacking for the global error which is used in this commit now to wrap calls to functions which do not report (all) errors via return, so that only failures in those calls cause a failure to propergate down the chain rather than failing if anything (potentially totally unrelated) has failed at some point in the past. This way we can avoid stopping the entire acquire process just because a single source produced an error for example. It also means that after the acquire process the cache is generated – even if the acquire process had failures – as we still have the old good data around we can and should generate a cache for (again). There are probably more instances of this hiding, but all these looked like the easiest to work with and fix with reasonable (aka net-positive) effects.
* use a less generic special trigger filename for stdinDavid Kalnischkies2015-09-143-5/+9
| | | | Git-Dch: Ignore
* do not discard new manual-bits while applying EDSP solutionsDavid Kalnischkies2015-09-141-1/+5
| | | | | | | | | | | | | | In private-install.cc we call MarkInstall with FromUser=true, which sets the bit accordingly, but while applying the EDSP solution we call mark install on all packages with FromUser=false, so MarkInstall believes this install is an automatic one and sets it to auto – so that a new package which is explicitely installed via an external solver is marked as auto and is hence also up for garbage collection in a following call. Ideally MarkInstall wouldn't reset it, but the detection is hard to do without regressing in other cases – and ideally ideally MarkInstall wouldn't deal with the autobit at all – so we work around this on the calling side for now.
* implement autobit and pinning in EDSP solver 'apt'David Kalnischkies2015-09-145-9/+96
| | | | | | | | The parser creates a preferences as well as an extended states file based on the EDSP scenario file, which isn't the most efficient way of dealing with this as thes text files have to be parsed again by another layer of the code, but it needs the least changes and works good enough for now. The 'apt' solver is in the end just a test solver like dump.