1276 Commits

Author SHA1 Message Date
David Kalnischkies 472376be68 Use pkgTagSection::Key in more places in src:apt
The speed critical paths were converted earlier, but the remaining
could benefit a tiny bit from this as well especially as we have the
facility now available and can therefore brush up the code in various
places in the process as well.

Also takes the time to add the hidden Exists method advertised in
the headers, but previously not implemented.
2022-04-01 14:16:19 +02:00
Julian Andres Klode 56adf743b0 Warn if the legacy trusted.gpg keyring is used for verification
With apt-key going away, people need to manage key files, rather
than keys, so they need to know if any keys are in the legacy keyring.
2022-02-22 18:25:06 +01:00
Ville Skyttä fd785ddfea Fix "was already not hold" message grammar 2022-01-24 20:46:34 +02:00
Walter Lozano e7511e1955 Use short options for cmp
In order to be consistent with other uses of cmp and to improve compatiblity
with other implementations, like busybox one, change long options to short
ones.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
2021-11-26 11:33:06 -03:00
Ville Skyttä 48d4b06013 Use command -v instead of which
`which` has been deprecated in debianutils 5.0+. The recommended
replacement, `command -v`, is mandated by Debian policy these days, in
addition to being required by POSIX and its predecessor specs at least
since 1994.

Not found commands cause no output from `command -v` per POSIX, so
remove the redundant 2>&1's while at it.
2021-11-04 00:02:41 +02:00
David Kalnischkies e267d1ee54 Inhibit autoremove calculation in apt-mark and apt show
As we never display the information in these code paths there isn't a
lot of point in calculating it first saving us some precious CPU cycles.

References: d6f3458bad
2021-08-28 22:21:35 +02:00
Julian Andres Klode a6cb741a2c Merge branch 'pu/upgradecounter' into 'main'
Count uninstallable packages in "not upgraded"

See merge request apt-team/apt!169
2021-04-29 08:28:08 +00:00
David Kalnischkies d6f3458bad Call MarkAndSweep only manually in apt-get for autoremove
An interactive tool like aptitude needs these flags current far more
often than we do as a user can see them in apt only in one very well
defined place – the autoremove display block – so we don't need to run
it up to four times while a normal "apt install" is processed as that is
just busywork.

The effect on runtime is minimal, as a single run doesn't take too long
anyhow, but it cuts down tremendously on debug output at the expense of
requiring some manual handholding.

This is opt-in so that aptitude doesn't need to change nor do we need to
change our own tools like "apt list" where it is working correctly as
intended.

A special flag and co is needed as we want to prevent the ActionGroup
inside pkgDepCache::Init to be inhibited already so we need to insert
ourselves while the DepCache is still in the process of being built.
This is also the reason why the debug output in some tests changed to
all unmarked, but that is fine as the marking could have been already
obsoleted by the actions taken, just inhibited by a proper action group.
2021-04-26 13:00:24 +02:00
David Kalnischkies f90b892e6a Count uninstallable packages in "not upgraded"
If a first step of the solver can figure out that a package is
uninstallable it might reset the candidate so that later steps are
prevented from exploring this dead end. While that helps the resolver it
can confuse the display of the found solution as this will include an
incorrect count of packages not upgraded in this solution.

It was possible before, but happens a fair bit more with the April/May
resolver changes last year so finally doing proper counting is a good
idea.

Sadly this is a bit harder than just getting the number first and than
subtracting the packages we upgraded from it as the user can influence
candidates via the command line and a package which could be upgraded,
but is removed instead shouldn't count as not upgraded as we clearly did
something with it. So we keep a list of packages instead of a number
which also help in the upgrade cmds as those want to show the list.

Closes: #981535
2021-04-25 16:25:57 +02:00
David Kalnischkies 97be873d78 Proper URI encoding for config requests to our test webserver
Our http method encodes the URI again which results in the double
encoding we have unwrap in the webserver (we did already, but we skip
the filename handling now which does the first decode).
2020-12-18 19:02:05 +01:00
Julian Andres Klode 681f74a8bd pkgnames: Do not exclude virtual packages with --all-names
We accidentally excluded virtual packages by excluding every
group that had a package, but where the package had no versions.

Rewrite the code so the lookup consistently uses VersionList()
instead of FirstVersion and FindPkg("any") - those are all the
same, and this is easier to read.
2020-10-26 14:39:44 +01:00
Julian Andres Klode 9cc002939a pkgnames: Correctly set the default for AllNames to false
We passed "false" instead of false, and that apparently got
cast to bool, because it's a non-null pointer.

LP: #1876495
2020-10-26 14:33:55 +01:00
Julian Andres Klode 11530bab64 Merge branch 'pu/less-slaves' into 'master'
Remove master/slave terminology

See merge request apt-team/apt!124
2020-08-04 10:12:30 +00:00
Julian Andres Klode 1afe7c8b87 Merge branch 'pu/apt-key-deprecated' into 'master'
Fully deprecate apt-key, schedule removal for Q2/2022

See merge request apt-team/apt!119
2020-08-04 10:07:10 +00:00
Julian Andres Klode 9f78677281 CMake: Rename add_slaves() to add_links()
Sorry!
2020-07-14 16:04:56 +02:00
Julian Andres Klode b5faca7a90 Replace some magic 64*1024 with APT_BUFFER_SIZE 2020-06-23 16:12:41 +02:00
Julian Andres Klode f9f0ae2bbb apt-key: Allow depending on gpg instead of gnupg
Maintainer scripts that need to use apt-key del might as well
depend on gpg, they don't need the full gnupg suite.
2020-05-06 12:52:57 +02:00
Julian Andres Klode ee284d5917 Fully deprecate apt-key, schedule removal for Q2/2022
People are still using apt-key add and friends, despite that not
being guaranteed to work. Let's tell them to stop doing so.

We might still want a list command at a future point, but this
needs deciding, and a blanket ban atm seems like a sensible step
until we figured that out.
2020-05-06 12:33:39 +02:00
Julian Andres Klode e93dbf2800 apt-helper: Add analyze-pattern helper
The analyze-pattern helper parses a pattern and then renders
the parsed pattern, allowing you to analyze how the parser
interpreted the string.

This can be useful to analyse (yes, analyse-pattern also works)
why a pattern is different from aptitude or why it does not
work as expected.

It can also be used to check if apt has pattern support, although
that will miss out on the version shipped in eoan, but who really
cares about that longer term anyway?
2020-03-12 21:04:50 +01:00
Julian Andres Klode 0d775d8f2a cdrom: Remove old udev dlopen stuff 2020-02-26 14:10:47 +01:00
Julian Andres Klode 4fad726229 Make map_pointer<T> typesafe
Instead of just using uint32_t, which would allow you to
assign e.g. a map_pointer<Version> to a map_pointer<Package>,
use our own smarter struct that has strict type checking.

We allow creating a map_pointer from a nullptr, and we allow
comparing map_pointer to nullptr, which also deals with comparisons
against 0 which are often used, as 0 will be implictly converted
to nullptr.
2020-02-24 18:29:07 +01:00
Julian Andres Klode c3587c0d9d Replace map_pointer_t with map_pointer<T>
This is a first step to a type safe cache, adding typing
information everywhere. Next, we'll replace map_pointer<T>
implementation with a type safe one.
2020-02-24 17:08:34 +01:00
Julian Andres Klode c5dd63e3b6 Merge branch 'master' into 'master'
apt-mark: don't lie about successful marks

See merge request apt-team/apt!94
2020-02-18 12:43:16 +00:00
Julian Andres Klode 8c1a37e127 Remove includes of (md5|sha1|sha2).h headers
Remove it everywhere, except where it is still needed.
2020-01-14 13:10:36 +01:00
Tris Emmy Wilson 009b144dc4 apt-mark: don't lie about successful marks
This commit fixes an issue where apt-mark would say it had made a change
before actually making the change. For example, when running as a user
without permission to write to extended_states, the package is not
marked but apt-mark claims it is:

    ~ % apt-mark manual rxvt-unicode
    rxvt-unicode set to manually installed.
    E: Could not create [...snip...] (13: Permission denied)
    E: Failed to write temporary StateFile /var/lib/apt/extended_states

This commit moves reporting of "[package] set to [manually |
automatically] installed" after saving extended_states and confirming it
was successful.
2020-01-09 12:44:22 -06:00