[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: finding apt dependencies



Why do you need to do this?  And why does speed matter?

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.
>   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?
>
>
>

--
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller@deepsoft.com       -- Webhosting Services



Reply to: