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

Re: how to retrieve the pacakge URI and architecture from python-apt



hi,

in my program 'debdelta-upgrade', I need to see which debian packages
need to be upgrade, and for each on, know the complete URI , somthing as
  http://ftp.it.debian.org/debian/pool/main/m/memstat/memstat_0.5_i386.deb

I was helped by M.Vogt with a snippet that s in this email; but
with the new python-apt in unstable, the following snippet stopped working.

How do I change it? (I tried to read the docs, but I do not know enaough
of APT )

 thanks a lot in advance

a.

On Mon, Jun 12, 2006 at 11:05:26PM +0200, A Mennucc wrote:
> hi
> 
> debdelta 0.13 incorporates your code below (with small changes):
> 
> On Fri, Jun 09, 2006 at 05:29:45PM +0200, Michael Vogt wrote:
> > ----------------------8<--------------------------------
> > import apt
> > import apt_pkg
> > cache = apt.Cache()
> > upgradable = filter(lambda p: p.isUpgradable, cache)
> > for pkg in upgradable:
> >         pkg._lookupRecord(True)
> >         path = apt_pkg.ParseSection(pkg._records.Record)["Filename"]
> >         cand = pkg._depcache.GetCandidateVer(pkg._pkg)
> >         for (packagefile,i) in cand.FileList:
> >                 indexfile = cache._list.FindIndex(packagefile)
> >                 if indexfile:
> >                         print indexfile.ArchiveURI(path)
> > ----------------------8<--------------------------------
> 
> thanks a lot
> 
> a.
> 
> -- 
> Andrea Mennucc
>  "E' un mondo difficile. Che vita intensa!" (Tonino Carotone)



-- 
Andrea Mennucc

"The EULA sounds like it was written by a team of lawyers who want to tell 
me what I can't do, and the GPL sounds like it was written by a human 
being who wants me to know what I can do."
Anonymous,    http://www.securityfocus.com/columnists/420


Reply to: