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

Bug#809441: apt: provide a global resource for upgradeable packages



Thilo Six schrieb/wrote:
> Package: apt
> Version: 1.0.9.8.2
> Severity: wishlist
> 
> Dear Maintainer,
> 
> in Debian there are several tools which calculate the number of
> available pkgs updates and the specific data
> <pkg> <version_old> <version_new>
> on their own.
> 
> This results in several tools here that all do the same thing over and over again.
> (Update notifier e.g. apper, byobu GNU screen wrapper, to include it in status
> line, and so on...)
> 
> Local i have a script which does this once everytime 'update' is run.
> I attach it.

I just wanted to add:
The idea behind it is to do the expensive calculating only once when needed,
e.g. after update, install, remove, purge ...

The additional files created by this script "$DEB_AVAIL_FULL_FILE" and
"$DEB_INSTALLED_FILE" are there to easily reuse that information elsewhere e.g.
completion.

Zsh deb-package completion uses 'command apt-cache --generate pkgnames' to
regenerate the list of packages everytime on the fly (when needed). Although
'command apt-cache --generate pkgnames' is quite fast, simply 'mapfile'ing an
already compiled list is faster:

% time command apt-cache --generate pkgnames
command apt-cache --generate pkgnames  0,09s user 0,20s system 63% cpu 0,459 total

% time ( list2=("${(f@)${mapfile[/var/lib/apt/meta-data/deb-avail-all]%$'\n'}}") )
( list2=("${(f@)${mapfile[/var/lib/apt/meta-data/deb-avail-all]%$'\n'}}") ; )
0,17s user 0,00s system 99% cpu 0,169 total


'mapfile'ing is also possible with Bash.



kind regards,

     Thilo


Reply to: