#1091472 Please provide an apt.conf option equivalent to -U

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Josh Triplett
Date:
2024-12-28 08:33:02 UTC
Severity:
normal
#1091472#3
Date:
2024-12-27 10:36:51 UTC
From:
To:
apt-get and apt support a -U option to update before running the
command. Please consider providing an option in apt.conf to always act
as if this option were provided. That would allow (for instance) CI
systems to make `apt install xyz` Just Work.

I would suggest an `Apt::Get::Update` option, with possible values
"true", "false", and (perhaps in the future) "binaries" (to update only
binary repos and not source repos).

#1091472#8
Date:
2024-12-27 12:20:18 UTC
From:
To:
This is controllable by the APT::Update option. All command-line options
are just syntactic sugar for apt.conf options. As the feature is experimental,
and not working correctly (it doesn't acquire and hold the locks
throughout but behaves exactly like update&&upgrade), it's not documented.

The goal is to fix the locking issue, add a separate stamp file, and
then switch the default to automatically update on missing sources or
if we haven't updated in 7 days.

#1091472#13
Date:
2024-12-27 13:38:07 UTC
From:
To:
Am Fri, Dec 27, 2024 at 02:36:51AM -0800, schrieb Josh Triplett:

Given how command line parsing works in apt, this already has a config
option… `APT::Update` (but Julian was faster than I was; lets sent the
mail anyway).

At the expense of just breaking mirrors as there is no cooldown or
anything that would stop apt from asking the mirror every time even if
you chain hundreds of install calls together like most people do in CI.

It is also kinda likely to break scripts or surprise you in other clever
ways as it quiet literally does what it says in the man page… so it e.g.
effects also an innocent "apt install --dry-run foo" call. And the man
page mentions other problems.

In my eyes, this needs more work before we can let that loose on the
general public, but obviously, that wasn't my call to make.

I wonder if you wouldn't be better served by a "if lists/ is empty, call
update first" rather than a "call it all the time" – to at least trim
away some of problems this "magic update call" causes.

Unlikely as they tend to come in pairs (or the deb-src as an addendum to
the deb if you prefer to look at it this way), but are secured by the
same Release file, so you can't just "half"-update from the repository
as apt wouldn't know anymore which files are current or not. Beside,
are Components, Icons, Translations, Contents, … and all the other
potential targets part of your 'binaries' set or not?

(There are bugs with the existing ways of entering such a "half" update
 state in the form of --no-list-cleanup already that will be hard enough
 to solve without adding more pain)


Best regards

David Kalnischkies

#1091472#18
Date:
2024-12-28 08:21:11 UTC
From:
To:
Ah, that would explain why I couldn't find it, thank you.

For my purposes, I'm fine with it behaving exactly like `apt update &&`.

Would it also update if a requested package name or version doesn't exist?

If so, that seems like a reasonable default.

#1091472#23
Date:
2024-12-28 08:23:57 UTC
From:
To:
Most CI scripts I've seen write one giant `apt-get install` line, not
one per package to be installed.

No, that wouldn't suffice, because the systems I'm working with would
preserve the old lists each time you update. So, it would need to also
update when outdated (e.g. more than N hours old).