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

Re: Using python-apt to diff two repositories not in sources.list



On Thu, Jun 19, 2014 at 02:36:27PM +0200, Mikael Knutsson wrote:
> Hello,
Hi,
 
> I hope I'm hitting the right mailing list with this question. We have a use
> case where we want to be able to list the differences between two arbitrary
> repositories (not necessarily part of the sources.list file).

You can do something like:
"""
write_file_with_info_for_repo1_to("dir1/etc/apt/sources.list")
cache = apt.Cache(rootdir="dir1/etc/apt/sources.list")
cache.update()
for pkg in cache:
    do_stuff_with_pkg()
"""
repeat with repo2,...,N - you could reuse the same dir too, but that
would mean cache.update() redownloads instead of keeping the files
around.

> The initial thought we had was to use the python-apt bindings to handle all
> the file parsing, but after digging around a bit we didn't find a way to
> actually download and parse arbitrary repository indices in the python
> bindings.
> Have we missed some way of doing this?

I assume the above is what you want, setting a custom "rootdir" where
python-apt looks for its files.

> Another comment is that the documentation here:
> http://apt.alioth.debian.org/python-apt-doc/ is sadly very outdated while
> still being the only resource we managed to find for the API on the
> internet. Is it possible to get this updated? It is the first hit when you
> google for python-apt so it would be good if it was up to date!
[..]

The python-apt-doc package contains the api documentation. Good luck!

It would of course be great if you could write a short summary for the
python-apt-doc package that shows how you did the repository
compare. There is a "tutorials" section that would be a perfect
fit. Check e.g.
http://anonscm.debian.org/gitweb/?p=apt/python-apt.git;a=blob;f=doc/source/tutorials/apt-get.rst;h=3bac473bc19882e4c1e20ebe6bda36151714374e;hb=HEAD

Cheers,
 Michael


Reply to: