may be use apt-cache --installed
regards
jean-chistophe
I have a need to find the upgradable package with the most
dependencies.
ÿ So far I've got this, in /bin/sh:
allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d
/ )"
max=0
countlist=""
for package in $allpkgs ; do
ÿÿ dependencies=$(apt-get --simulate upgrade "$package" | grep
upgraded,
cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bitÿÿ [ "$dependencies" -gt "$max" ] && max="$dependencies"
ÿÿ countlist="$countlist $dependencies $pkgname"
done
It works, but is definitely not fast. Is there a faster way?
I have a need to find the upgradable package with the most dependencies.
So far I've got this, in /bin/sh:
allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d / )" max=0
countlist=""
for package in $allpkgs ; do
dependencies=$(apt-get --simulate upgrade "$package" | grep upgraded,
| cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bit
[ "$dependencies" -gt "$max" ] && max="$dependencies"
countlist="$countlist $dependencies $pkgname"
done
It works, but is definitely not fast. Is there a faster way?
I have a need to find the upgradable package with the most
dependencies.
ÿ So far I've got this, in /bin/sh:
allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d
/ )"
max=0
countlist=""
for package in $allpkgs ; do
ÿÿ dependencies=$(apt-get --simulate upgrade "$package" | grep
upgraded,
cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bitÿÿ [ "$dependencies" -gt "$max" ] && max="$dependencies"
ÿÿ countlist="$countlist $dependencies $pkgname"
done
It works, but is definitely not fast. Is there a faster way?
I have a need to find the upgradable package with the mosthttps://x0.at/FdVb.txt
dependencies.
ÿ So far I've got this, in /bin/sh:
allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d
/ )"
max=0
countlist=""
for package in $allpkgs ; do
ÿÿ dependencies=$(apt-get --simulate upgrade "$package" | grep
upgraded,
cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bitÿÿ [ "$dependencies" -gt "$max" ] && max="$dependencies"
ÿÿ countlist="$countlist $dependencies $pkgname"
done
It works, but is definitely not fast. Is there a faster way?
I have a need to find the upgradable package with the mosthttps://x0.at/FdVb.txt
dependencies.
ÿ So far I've got this, in /bin/sh:
allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d
/ )"
max=0
countlist=""
for package in $allpkgs ; do
ÿÿ dependencies=$(apt-get --simulate upgrade "$package" | grep
upgraded,
cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bitÿÿ [ "$dependencies" -gt "$max" ] && max="$dependencies"
ÿÿ countlist="$countlist $dependencies $pkgname"
done
It works, but is definitely not fast. Is there a faster way?
On 7/7/26 15:21, Robert Heller wrote:
At Tue, 7 Jul 2026 14:18:25 -0400 Eben King <eben@gmx.us> wrote:
Why do you need to do this? And why does speed matter?
I have a need to find the upgradable package with the most dependencies.
Generally, I dislike it when lots of things change at the same time, so rather than going through my upgradable packages periodically and
updating the lot of them, I run a cron job that, once a day, upgrades a package chosen at random from the list of upgradable packages. I got to thinking it might be bad to update some parts of a package and not
others, so I want to upgrade those at the top of their tree of dependencies.
It needs to be fast because I want to cause as little disturbance as possible. Technically it doesn't, it'll work as it is, it just scratches
and itch to get it done with.
Generally, I dislike it when lots of things change at the same time,
so rather than going through my upgradable packages periodically and updating the lot of them, I run a cron job that, once a day, upgrades
a package chosen at random from the list of upgradable packages. I
got to thinking it might be bad to update some parts of a package and
not others, so I want to upgrade those at the top of their tree of dependencies.
On 7/7/26 15:57, jean-christophe wrote:
----------------------------------------------------------------------- jean-christophe@debian:~/Documents/codes/bash$ apt-get --versionOn mar., 2026-07-07 at 14:18 -0400, Eben King wrote:
I have a need to find the upgradable package with the most
dependencies.
...
It works, but is definitely not fast. Is there a faster way?
https://x0.at/FdVb.txt
is there some faster way in /bin/sh
me say not depencies
could you test ?
eben@cerberus:~$ apt-cache policy | grep -E '^\s*Installed:\s*(.+)$'
1
"1" is the exit status.ÿ Maybe we have different versions of apt-get?
eben@cerberus:~$ apt-get ---version
apt 2.6.1 (amd64)
Supported modules:
*Ver: Standard .deb
*Pkg:ÿ Debian dpkg interface (Priority 30)
ÿ Pkg:ÿ Debian APT solver interface (Priority -1000)
ÿ Pkg:ÿ Debian APT planner interface (Priority -1000)
ÿ S.L: 'deb' Debian binary tree
ÿ S.L: 'deb-src' Debian source tree
ÿ Idx: Debian Source Index
ÿ Idx: Debian Package Index
ÿ Idx: Debian Translation Index
ÿ Idx: Debian dpkg status file
ÿ Idx: Debian deb file
ÿ Idx: Debian dsc file
ÿ Idx: Debian control file
ÿ Idx: EDSP scenario file
ÿ Idx: EIPP scenario file
I got to thinking it might be bad to update some parts of a package
and not others...
On 7/7/26 15:21, Robert Heller wrote:
At Tue, 7 Jul 2026 14:18:25 -0400 Eben King <eben@gmx.us> wrote:
I have a need to find the upgradable package with the most dependencies.Why do you need to do this? And why does speed matter?
Generally, I dislike it when lots of things change at the same time
I got to thinking it might be bad to update some parts of a package
and not others, so I want to upgrade those at the top of their tree of dependencies.
On 7/7/26 15:21, Robert Heller wrote:
At Tue, 7 Jul 2026 14:18:25 -0400 Eben King wrote:
I have a need to find the upgradable package with the most dependencies.Why do you need to do this?ÿ And why does speed matter?
Generally, I dislike it when lots of things change at the same time, so rather than going through my upgradable packages periodically and
updating the lot of them, I run a cron job that, once a day, upgrades a package chosen at random from the list of upgradable packages.
dependencies=$(apt-get --simulate upgrade "$package" | grep upgraded, | cut -f 1 -d ' ')
On Tue, Jul 07, 2026 at 04:05:22PM -0400, Eben King wrote:
On 7/7/26 15:21, Robert Heller wrote:
At Tue, 7 Jul 2026 14:18:25 -0400 Eben King <eben@gmx.us> wrote:
I have a need to find the upgradable package with the most dependencies.Why do you need to do this? And why does speed matter?
Generally, I dislike it when lots of things change at the same time
Unless you are on testing or unstable surely almost all updates are
security updates and you want them all pretty much as soon as possible?
I got to thinking it might be bad to update some parts of a package
and not others, so I want to upgrade those at the top of their tree of dependencies.
As packages are not divisible entities for upgrade purposes, I assume
you mean the situation where package foo depends upon package bar and
both of them are due an upgrade, you are saying that you would prefer to upgrade foo so as to not get a version of bar that is unexpected by the non-upgraded foo.
The thing is, this is unnecessary and won't work as you would want
anyway. If foo just lists a dependency on bar then any version of bar will
be good enough for foo. So there should be no harm in upgrading bar and
doing so won't force an upgrade of foo unless there is also a dependency the other way that lists a specific version requirement.
Normally you'd just do "apt full-upgrade" or whatever and let everything
be upgraded but in this instance there should be no harm in upgrading
only bar with something like "apt install --only-upgrade bar". Apart
from that there is a security update pending for foo that you've decided
not to apply.
I am not sure what would happen if you told apt to upgrade only foo, and
the incoming foo package had a versioned dependency on an upgraded bar package but you had not allowed the upgrade of any other package.
Thanks,
Andy
I am not sure what would happen if you told apt to upgrade only foo, and
the incoming foo package had a versioned dependency on an upgraded bar package but you had not allowed the upgrade of any other package.
eben@cerberus:~$ apt-cache policy | grep -E '^\s*Installed:\s*(.+)$'
1
"1" is the exit status.ÿ Maybe we have different versions of apt-get?
eben@cerberus:~$ apt-get ---version
apt 2.6.1 (amd64)
Supported modules:
*Ver: Standard .deb
*Pkg:ÿ Debian dpkg interface (Priority 30)
ÿ Pkg:ÿ Debian APT solver interface (Priority -1000)
ÿ Pkg:ÿ Debian APT planner interface (Priority -1000)
ÿ S.L: 'deb' Debian binary tree
ÿ S.L: 'deb-src' Debian source tree
ÿ Idx: Debian Source Index
ÿ Idx: Debian Package Index
ÿ Idx: Debian Translation Index
ÿ Idx: Debian dpkg status file
ÿ Idx: Debian deb file
ÿ Idx: Debian dsc file
ÿ Idx: Debian control file
ÿ Idx: EDSP scenario file
ÿ Idx: EIPP scenario file
eben@cerberus:~$ apt-cache policy | grep -E
'^\s*Installed:\s*(.+)$'
1
"1" is the exit status.ÿ Maybe we have different versions of apt-
get?
try with that : https://x0.at/P0Kv.txt
May I suggest you look at the unattended-upgrades package? It will
do a lot of what you want once a day.
Yes, it looks to do basically what I want. I have installed it, so
now I have to figure out how to use it. Thanks.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 497102:26:22 |
| Calls: | 182 |
| Files: | 744 |
| D/L today: |
65 files (9,837K bytes) |
| Messages: | 73,659 |