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

Bug#622347: python-apt: Please add a public function fetch_archives



On Di, 2011-04-12 at 14:27 +0200, Patrick Schoenfeld wrote:
> Hi,
> 
> On Tue, Apr 12, 2011 at 02:02:56PM +0200, Julian Andres Klode wrote:
> > On Di, 2011-04-12 at 13:20 +0200, Patrick Schoenfeld wrote:
> > > Package: python-apt
> > > Version: 0.7.100.2
> > > Severity: wishlist
> > > 
> > > Hi,
> > > 
> > > I'm currently working on a python-apt based variant of fai-mirror,
> > > which uses python-apt to resolve dependencies for the packages
> > > and download them. Currently the only way to NOT install packages and download
> > > them only is to use an internal function _fetch_archives for example like this:
> > > 
> > > fetch_progress = apt.progress.text.AcquireProgress()
> > > depcache = self.cache._depcache
> > > pm = apt_pkg.PackageManager(depcache)
> > > fetcher = apt_pkg.Acquire(fetch_progress)
> > > self.cache._fetch_archives(fetcher, pm)
> > > 
> > > Its obvious that this is quiet unfortunate. Therefore it would be nice,
> > > if python-apt supported a method which allows fetching packages only.
> > 
> > You can fetch single versions by using Version.fetch_binary(), or go
> 
> This wouldn't work, because I need the package with their depends.
> 
> > through the list of all changed packages and mark the URIs for download
> > (via Version.uri)
> 
> Does the list of changed packages include depends? Would I need to do
> anything else to actually fetch the packages?
> 
> > But if really wanted we could surely at a public
> > fetch_archives method.
> 
> Well, as far as I can tell it currently seems that such a function
> (implemented similar to the above code) solves the problem of
> downloading all packages marked to be installed AND their depends. There
> is no need for such a function if thats easily possible with the
> existing API...

acquire = apt_pkg.Acquire(apt.progress.text.AcquireProgress()
items = [apt_pkg.AcquireFile(acquire, p.candidate.uri, p.candidate.size)
         for p in cache.get_changes]
acquire.run()

Would work. But it's more verbose and does not produce as nice results
as the built-in package-specific acquire items.

A commit has been made to the debian-experimental branch and should be
uploaded to experimental this week. It can be seen at:

http://bzr.debian.org/scm/loggerhead/apt/python-apt/debian-experimental/revision/jak@debian.org-20110412125108-82lib505tmmro4wu

The commit message is:
------------------------------------------------------------
revno: 517
revision-id: jak@debian.org-20110412125108-82lib505tmmro4wu
parent: jak@debian.org-20110412123339-vmhtshtruntji1uh
fixes bug(s): http://bugs.debian.org/622347
committer: Julian Andres Klode <jak@debian.org>
branch nick: debian-experimental
timestamp: Tue 2011-04-12 14:51:08 +0200
message:
  apt.cache: Add a fetch_archives() method (Closes: #622347)
-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.





Reply to: