On Fri, 2006-09-08 at 17:25 +0530, Jitendra Nair wrote: > I will try and explain it Again > > capability == depstring as in "yum install depstring1 depstring2". > > Given a set of depstring's i need to know the package that provides > each depstring and the other packages this package is dependent on. > the way i am doing it till now was using 'pexpect' and run the command > "yum install depstring1 depstring2 depstring3 ..." and the capture stdout > and parse the output and generate the rpms list.Why i am doing this > because the build team needs the list for some reason. > > > Now need to do it using the yum api. > So i will write the psuedocode again : > > deplist = [ depstring1 , depstring2 , ...] > > for depstring in deplist: > packages.append ( yum.YumBase.returnPackageByDep ( depstring ) ) > > for po in packages : > yum.tsInfo.addInstall (po) > yum.buildTransaction() > mems = yum.tsInfo.getMembers() > for mem in mems: > pkgtuple = mem.po.returnPackageTuple() > #From 'pkgtuple' generate filename > #save filename. > > Thank you s.v for the reply . that pseudocode would mostly work but do you just want the resolved packages for a specific machine or do you want, in general, all packages that have a provide for the resolved package. You might want to: - find the package objects that match the depstrings - iterate those packages using yum.YumBase.findDeps() (this, looking at it now, is a stupid method and should take package objects, not userstrings) - that returns a dict, iterate that for each print each output to see how this works just run: yum deplist somepkgname -sv