summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
Commit message (Collapse)AuthorAgeFilesLines
* apt-get: allow non-root --print-uris build-depJulian Andres Klode2015-08-141-1/+3
| | | | Closes: #283400
* Make auto-remove and auto-clean aliases for the versions without -Julian Andres Klode2015-08-141-0/+2
| | | | | | | | Some people type them instead of autoremove and autoclean, so make them happy. Closes: #274159 Makes-Happy: Ansgar
* Deprecate SPtrArray<T> and convert everyone to unique_ptr<T[]>Julian Andres Klode2015-08-131-1/+1
| | | | More standardization
* Mark SPtr as deprecated, and convert users to std::unique_ptrJulian Andres Klode2015-08-131-3/+3
| | | | Switch to std::unique_ptr, as this is safer than SPtr.
* apt-get: Do not include apt-pkg/indexrecords.hJulian Andres Klode2015-08-111-1/+0
| | | | | | It's gone. Gbp-Dch: ignore
* no value for MultiArch field is 'no', not 'none'David Kalnischkies2015-08-101-2/+2
| | | | Git-Dch: Ignore
* remove the compatibility markers for 4.13 abiDavid Kalnischkies2015-08-101-33/+0
| | | | | | | | We aren't and we will not be really compatible again with the previous stable abi, so lets drop these markers (which never made it into a released version) for good as they have outlived their intend already. Git-Dch: Ignore
* show or-groups in not-installed recommends and suggests listsDavid Kalnischkies2015-08-101-4/+4
| | | | | | | | Further abstracting our new ShowList allows to use it for containers of strings as well giving us the option to implement an or-groups display for the recommends and suggests lists which is a nice trick given that it also helps with migrating the last remaining other cases of old ShowList.
* headers are for declarations onlyDavid Kalnischkies2015-08-101-0/+1
| | | | | | | | Housekeeping. This used to be embedded in apt-get directly, then moved to into our (then new) private lib and now header and code get a proper separation. Git-Dch: Ignore
* rename 'apt-get files' to 'apt-get indextargets'David Kalnischkies2015-08-101-5/+5
| | | | | | | | 'files' is a bit too generic as a name for a command usually only used programmatically (if at all) by developers, so instead of "wasting" this generic name for this we use "indextargets" which is actually the name of the datastructure the displayed data is stored in. Along with this rename the config options are renamed accordingly.
* add c++11 override marker to overridden methodsDavid Kalnischkies2015-08-101-1/+1
| | | | | | | | | C++11 adds the 'override' specifier to mark that a method is overriding a base class method and error out if not. We hide it in the APT_OVERRIDE macro to ensure that we keep compiling in pre-c++11 standards. Reported-By: clang-modernize -add-override -override-macros Git-Dch: Ignore
* merge indexRecords into metaIndexDavid Kalnischkies2015-08-101-21/+14
| | | | | | | | | | | | | | | | | | | | | | | | indexRecords was used to parse the Release file – mostly the hashes – while metaIndex deals with downloading the Release file, storing all indexes coming from this release and … parsing the Release file, but this time mostly for the other fields. That wasn't a problem in metaIndex as this was done in the type specific subclass, but indexRecords while allowing to override the parsing method did expect by default a specific format. APT isn't really supporting different types at the moment, but this is a violation of the abstraction we have everywhere else and, which is the actual reason for this merge: Options e.g. coming from the sources.list come to metaIndex naturally, which needs to wrap them up and bring them into indexRecords, so the acquire system is told about it as they don't get to see the metaIndex, but they don't really belong in indexRecords as this is just for storing data loaded from the Release file… the result is a complete mess. I am not saying it is a lot prettier after the merge, but at least adding new options is now slightly easier and there is just one place responsible for parsing the Release file. That can't hurt.
* support lang= and target= sources.list optionsDavid Kalnischkies2015-08-101-2/+2
| | | | | | | | | | | | | | | We support arch= for a while, now we finally add lang= as well and as a first simple way of controlling which targets to acquire also target=. This asked for a redesign of the internal API of parsing and storing information about 'deb' and 'deb-src' lines. As this API isn't visible to the outside no damage done through. Beside being a nice cleanup (= it actually does more in less lines) it also provides us with a predictable order of architectures as provides in the configuration rather than based on string sorting-order, so that now the native architecture is parsed/displayed first. Observeable e.g. in apt-get output.
* fix memory leaks reported by -fsanitizeDavid Kalnischkies2015-08-101-5/+3
| | | | | | | | 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
* provide a public interface for acquiring changelogsDavid Kalnischkies2015-06-151-165/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Provided is a specialized acquire item which given a version can figure out the correct URI to try by itself and if not provides an error message alongside with static methods to get just the URI it would try to download if it should just be displayed or similar such. The URI is constructed as follows: Release files can provide an URI template in the "Changelogs" field, otherwise we lookup a configuration item based on the "Label" or "Origin" of the Release file to get a (hopefully known) default value for now. This template should contain the string CHANGEPATH which is replaced with the information about the version we want the changelog for (e.g. main/a/apt/apt_1.1). This middleway was choosen as this path part was consistent over the three known implementations (+1 defunct), while the rest of the URI varies widely between them. The benefit of this construct is that it is now easy to get changelogs for Debian packages on Ubuntu and vice versa – even at the moment where the Changelogs field is present nowhere. Strictly better than what apt-get had before as it would even fail to get changelogs from security… Now it will notice that security identifies as Origin: Debian and pick this setting (assuming again that no Changelogs field exists). If on the other hand security would ship its changelogs in a different location we could set it via the Label option overruling Origin. Closes: 687147, 739854, 784027, 787190
* implement default apt-get file --release-info modeDavid Kalnischkies2015-06-151-3/+23
| | | | | | | | | | Selecting targets based on the Release they belong to isn't to unrealistic. In fact, it is assumed to be the most used case so it is made the default especially as this allows to bundle another thing we have to be careful with: Filenames and only showing targets we have acquired. Closes: 752702
* implement 'apt-get files' to access index targetsDavid Kalnischkies2015-06-111-0/+87
| | | | | | | | | | | | | Downloading additional files is only half the job. We still need a way to allow external tools to know where the files are they requested for download given that we don't want them to choose their own location. 'apt-get files' is our answer to this showing by default in a deb822 format information about each IndexTarget with the potential to filter the records based on lines and an option to change the output format. The command serves also as an example on how to get to this information via libapt.
* drop incorrect parameter implicitely converted to boolDavid Kalnischkies2015-05-111-2/+2
| | | | | | | | | | The helper expects to be told if it should generate messages, not where these messages should be printed – as it isn't printing such messages, but puts them in _error. apt-get uses in other methods a helper specialisation which does also print stuff to a stream through, so this is likely a copy&paste error. Git-Dch: Ignore
* add a simple unit test for acquire progressDavid Kalnischkies2015-04-101-3/+3
| | | | | | | This isn't testing much of the 'complex' parts, but its better than nothing for now. Git-Dch: Ignore
* stop displaying time of build in online helpJérémy Bobbio2015-03-161-5/+4
| | | | | | | | | | | | | | | | | | As part of the “reproducible builds” effort [1], we have noticed that apt could not be built reproducibly. One issue is that it uses the __DATE__ and __TIME__ macros of the C preprocessor to display the time of build in the online help. We believe this information not to be really useful to users as they can always look at the package data and metadata to figure it out. The attached patch simply removes this information. All non-documentation packages can then be built reproducibly with our current experimental framework. [David: changed the string slightly to be untranslateable as well] Closes: 774342
* merge debian/sid into debian/experimentalDavid Kalnischkies2015-03-161-4/+4
|\
| * use 'best' hash for source authenticationDavid Kalnischkies2014-11-101-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. This is a cherry-pick of 1262d35 with some dirty tricks to preserve ABI. LP: 1098738
| * apt-get: Create the temporary downloaded changelog inside tmpdirGuillem Jover2014-10-021-1/+1
| | | | | | | | | | | | | | | | The code is creating a secure temporary directory, but then creates the changelog alongside the tmpdir in the same base directory. This defeats the secure tmpdir creation, making the filename predictable. Inject a '/' between the tmpdir and the changelog filename.
* | use pkgAcquire::GetLock instead of own codeDavid Kalnischkies2014-11-091-20/+2
| | | | | | | | | | | | | | | | | | Do the same with less code in apt-get. This especially ensures that the lock file (and the parent directories) exist before we are trying to lock. It also means that clean now creates the directories if they are missing so we returned to a proper clean state now. Git-Dch: Ignore
* | streamline display of --help in all toolsDavid Kalnischkies2014-11-091-20/+2
| | | | | | | | | | | | | | By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit.
* | guard ABI changes for SourcePkg/Ver in pkgCacheDavid Kalnischkies2014-11-081-4/+48
| | | | | | | | Git-Dch: Ignore
* | better non-virtual metaIndex.LocalFileName() implementationDavid Kalnischkies2014-11-081-28/+2
| | | | | | | | | | | | | | | | We can't add a new virtual method without breaking the ABI, but we can freely add new methods, so for older ABIs we just implement this method with a dynamic_cast, so that clients can be more ignorant about the API here and especially don't need to pull a very dirty trick by assuming internal knowledge (like apt-get did here).
* | chown finished partial files earlierDavid Kalnischkies2014-10-231-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partial files are chowned by the Item baseclass to let the methods work with them. Now, this baseclass is also responsible for chowning the files back to root instead of having various deeper levels do this. The consequence is that all overloaded Failed() methods now call the Item::Failed base as their first step. The same is done for Done(). The effect is that even in partial files usually don't belong to _apt anymore, helping sneakernets and reducing possibilities of a bad method modifying files not belonging to them. The change is supported by the framework not only supporting being run as root, but with proper permission management, too, so that privilege dropping can be tested with them.
* | check for available space, excluding root reserved blocksDavid Kalnischkies2014-10-151-25/+3
| | | | | | | | | | | | | | | | | | | | | | We are checking the space requirements for ages, but the check uses the free blocks count, which includes the blocks reserved for usage by root. Now that we use an unprivileged user it has no access to these blocks anymore – and more importantly these blocks are a reserve, they shouldn't be used by apt without special encouragement by the user as it would be bad to have dpkg run out of diskspace and maintainerscripts like man-db skip certain actions if not enough space is available freely.
* | don't drop privileges if _apt has not enough rightsDavid Kalnischkies2014-10-151-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Privilege dropping breaks download/source/changelog commands as they require the _apt user to have write permissions in the current directory, which is e.g. the case in /tmp, but not in /root, so we disable the privilege dropping if we deal with such a directory based on idea and code by Michael Vogt. The alternative would be to download always to a temp directory and move it then done, but this breaks partial file support. To resolve this, we could move to one of our partial/ directories, but this would require a lock which would block root from using two of these commands in parallel. As both seems unacceptable we instead let the user choose what to do: Either a directory is setupped for _apt, downloading as root is accepted or – which is potentially even better – an unprivileged user is used for the commands.
* | Merge remote-tracking branch 'upstream/debian/experimental' into ↵Michael Vogt2014-10-071-1/+1
|\ \ | | | | | | | | | | | | | | | | | | feature/acq-trans Conflicts: apt-pkg/acquire-item.cc
| * | apt-get: Create the temporary downloaded changelog inside tmpdirGuillem Jover2014-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The code is creating a secure temporary directory, but then creates the changelog alongside the tmpdir in the same base directory. This defeats the secure tmpdir creation, making the filename predictable. Inject a '/' between the tmpdir and the changelog filename.
* | | ensure partial dirs are 0700 and owned by _apt:rootDavid Kalnischkies2014-10-071-14/+4
|/ / | | | | | | | | | | | | | | | | Reworks the API involved in creating and setting up the fetcher to be a bit more pleasent to look at and work with as e.g. an empty string for no lock isn't very nice. With the lock we can also stop creating all our partial directories "just in case". This way we can also be a bit more aggressive with the partial directory itself as with a lock, we know we will gone need it.
* | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-291-1/+1
|\| | | | | | | | | Conflicts: apt-pkg/acquire-item.cc
| * generalize Acquire::GzipIndexMichael Vogt2014-09-211-1/+1
| |
* | cleanup partial directory of lists in apt-get cleanDavid Kalnischkies2014-09-271-6/+20
| | | | | | | | | | | | | | | | Not really the intended usecase for apt-get clean, but users expect it to help them in recovery and it can't really hurt as this directory should be empty if everything was fine and proper anyway. Closes: #762889
* | allow fetcher setup without directory creationDavid Kalnischkies2014-09-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | apt-get download and changelog as well as apt-helper reuse the acquire system for their own proposes without requiring the directories the fetcher wants to create, which is a problem if you run them as non-root and the directories do not exist as it greets you with: E: Archives directory /var/cache/apt/archives/partial is missing. - Acquire (13: Permission denied) Closes: 762898
* | store source name and version in binary cacheDavid Kalnischkies2014-09-271-42/+22
| | | | | | | | | | | | | | Accessing the package records to acquire this information is pretty costly, so that information wasn't used so far in many places. The most noticeable user by far is EDSP at the moment, but there are ideas to change that which this commit tries to enable.
* | mark pkg(All|Dist)Upgrade as deprecatedDavid Kalnischkies2014-09-271-1/+1
| | | | | | | | | | | | | | | | The comment above their definition marks them already as such, so this is only a formalisation of the deprecation and fixes the occurances we have in our own code together with removing a magic number. Git-Dch: Ignore
* | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-051-16/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc configure.ac debian/changelog doc/apt-verbatim.ent doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pt.po po/ar.po po/ast.po po/bg.po po/bs.po po/ca.po po/cs.po po/cy.po po/da.po po/de.po po/dz.po po/el.po po/es.po po/eu.po po/fi.po po/fr.po po/gl.po po/hu.po po/it.po po/ja.po po/km.po po/ko.po po/ku.po po/lt.po po/mr.po po/nb.po po/ne.po po/nl.po po/nn.po po/pl.po po/pt.po po/pt_BR.po po/ro.po po/ru.po po/sk.po po/sl.po po/sv.po po/th.po po/tl.po po/tr.po po/uk.po po/vi.po po/zh_CN.po po/zh_TW.po test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
| * add dpkg::source-options for dpkg-source invocationDavid Kalnischkies2014-08-261-16/+17
| | | | | | | | | | | | | | | | | | | | | | dpkg-source can be told to enforce signature checks with --require-valid-signature, but while this isn't feasible as default for Debian itself at the moment, a local admin should be able to use it. This commit also fixes the size limit on the construction of the command being called for dpkg-source and dpkg-buildpackage. Closes: 757534
* | Only allow "apt-get build-dep path" when path starts with ./ or /Michael Vogt2014-07-081-2/+7
| | | | | | | | | | | | This avoid the subtle problem that someone might have a directory with the same package name as the build-depends he/she is trying to fetch. Also print a note that the specific file/dir is used.
* | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-06-181-0/+9
|\| | | | | | | | | Conflicts: debian/changelog
| * Show unauthenticated warning for source packages as wellMichael Vogt2014-06-021-0/+9
| | | | | | | | | | | | | | | | | | This will show the same unauthenticated warning for source packages as for binary packages and will not download a source package if it is unauthenticated. This can be overridden with --allow-unauthenticated Closes: #749795
* | Merge remote-tracking branch 'upstream/debian/sid' into debian/experimentalMichael Vogt2014-05-291-1/+0
|\| | | | | | | | | Conflicts: test/integration/test-bug-747261-arch-specific-conflicts
| * fix screen width detection for apt/apt-get listsSebastian Schmidt2014-05-221-1/+0
| | | | | | | | | | | | | | 3163087b moved SigWinch(int) from apt-get.cc to private-output.cc without moving #include <sys/ioctl.h>, making SigWinch a nop. Closes: 748430, 747942
* | use HashStringList in the acquire systemDavid Kalnischkies2014-05-091-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | It is not very extensible to have the supported Hashes hardcoded everywhere and especially if it is part of virtual method names. It is also possible that a method does not support the 'best' hash (yet), so we might end up not being able to verify a file even though we have a common subset of supported hashes. And those are just two of the cases in which it is handy to have a more dynamic selection. The downside is that this is a MAJOR API break, but the HashStringList has a string constructor for compatibility, so with a bit of luck the few frontends playing with the acquire system directly are okay.
* | use 'best' hash for source authenticationDavid Kalnischkies2014-05-091-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. LP: 1098738
* | Merge remote-tracking branch 'mvo/feature/build-dep-dsc2' into ↵Michael Vogt2014-05-081-2/+25
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | debian/experimental Conflicts: apt-pkg/deb/debindexfile.cc apt-pkg/deb/debindexfile.h apt-pkg/deb/debsrcrecords.cc
| * | add support for apt-get build-dep unpacked-source-dirMichael Vogt2014-04-251-1/+10
| | |