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

Bug#504460: #504460 apt-utils: include apt-listrepository



Hi Carsten Hey,

2010/4/4 Carsten Hey <carsten@debian.org>:
> 1:carsten@taz:~> grep Installed =apt-listrepository
>  $tmp2 =~ s/^  (Candidate|Installed|Version Table):.*\n//mg;
> 2:carsten@taz:~> LC_ALL=de_DE.UTF-8 apt-cache policy apt | grep -o Installiert
> Installiert
>
> Looks like a possible bug in apt-listrepository which might occur when it is
> not run with LC_MESSAGES set to C.

Yeap, this looks like a dealbreaker bug.
Other problems:
1) It highly depends on the output format of dpkg and APT
2) dpkg --get-selections lists more than only the installed packages
 (hint: deinstall) but sounds as this wouldn't be requested.
3) can be done in less with python-apt which is at least suggested by APT.
4) The name is not good (lists repositories? really?)

3 is partly guesswork as i can't convince the perl-script to accept my crazy
apt setup, so i don't know what it will print in the end and i am neither a
perl nor a python expert (even calling me -programmer would be laughable),
but here we go, apt-listrepository in python…

>>>>>>>>

#!/usr/bin/python
import apt_pkg
apt_pkg.init_config()
apt_pkg.init_system()
cache = apt_pkg.Cache()
for pkg in cache.packages:
        if pkg.current_ver != None:
                print pkg.name, pkg.current_ver.ver_str,
                if pkg.current_ver.downloadable == 1:
                        print pkg.current_ver.file_list[0][0].site
                else:
                        print 'is not available online'

<<<<<<<<<

I am also unsure if it is really desirable to have apt-listrepostory (with a
new name and written by someone who can actually write perl/python/whatever)
in an important package as the use case is pretty limited…


Best regards / Mit freundlichen Grüßen,

David Kalnischkies



Reply to: