Re: Finding installed packages and their repositories using python yum module
Navid Shaikh <[email protected]> Mon, 24 Mar 2014 12:23:26 +0530
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <CAOd3oerbjw5yzLqMrpSrXaDsiWOLd4HesSgtJaHuGMDXYYiUPQ@mail.gmail.com> |
--===============7721250029301725903== Content-Type: multipart/alternative; boundary=089e0158cb54712b2904f554b209 --089e0158cb54712b2904f554b209 Content-Type: text/plain; charset=ISO-8859-1 Hi Tim, Yes, found the expected result. Thank you! On Sat, Mar 22, 2014 at 10:19 PM, Tim Lauridsen <[email protected]>wrote: > you are looking for > > .ui_from_repo > > TIm > > > On Thu, Mar 20, 2014 at 12:26 PM, Navid Shaikh <[email protected]>wrote: > >> Hi, >> I am using python yum module. >> I am finding all installed packages in system and yum repositories, from >> which these RPMs >> are installed. >> From command line, I can see this using command: >> >> $yum list installed >> >> However when I am using python yum module, I can find the installed >> packages but >> I am not able to find associated yum repository from which a package is >> installed. >> >> Here is how I got the installed packages: >> >> >> import yum >> >> yb = yum.YumBase() >> pkg_list = yb.doPackageLists(pkgnarrow="installed") >> inst_pkg_list = pkg_list.installed >> >> #Now I am trying to find if there is an attribute giving yum repository >> info for this package >> rpm1 = inst_pkg_list[0] >> rpm1.repoid >> 'installed' >> #However, it returns 'installed', which is not yum repository name. >> >> >> Where I am doing it wrong? >> Any help is highly appreciated. >> >> -- >> Regards, >> Navid Shaikh >> >> _______________________________________________ >> Yum mailing list >> [email protected] >> http://lists.baseurl.org/mailman/listinfo/yum >> >> > > _______________________________________________ > Yum mailing list > [email protected] > http://lists.baseurl.org/mailman/listinfo/yum > > -- Regards, Navid Shaikh | @SwordPhilic --089e0158cb54712b2904f554b209 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi Tim,<div>Yes, found the expected result.</div><div>Than= k you!</div></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_qu= ote">On Sat, Mar 22, 2014 at 10:19 PM, Tim Lauridsen <span dir=3D"ltr"><= <a href=3D"mailto:[email protected]" target=3D"_blank">tim.lauridsen@= gmail.com</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div dir=3D"ltr">you are looking for=A0 <p style=3D"margin:0px">.ui_from_repo</p><div class=3D"gmail_extra"><br>TIm= <br><br><br><div class=3D"gmail_quote"><div><div class=3D"h5">On Thu, Mar 2= 0, 2014 at 12:26 PM, Navid Shaikh <span dir=3D"ltr"><<a href=3D"mailto:s= [email protected]" target=3D"_blank">[email protected]</a>></= span> wrote:<br> </div></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo= rder-left:1px #ccc solid;padding-left:1ex"><div><div class=3D"h5"><div dir= =3D"ltr">Hi,<div>I am using python yum module.</div><div>I am finding all i= nstalled packages in system and yum repositories, from which these RPMs</di= v> <div>are installed.</div><div>From command line, I can see this using comma= nd:</div> <div><br></div><div>$yum list installed</div><div><br></div><div>However wh= en I am using python yum module, I can find the installed packages but</div= ><div>I am not able to find associated yum repository from which a package = is installed.</div> <div><br></div><div>Here is how I got the installed packages:</div><div><br= ></div><div><br></div><div>import yum</div><div><br></div><div>yb =3D yum.Y= umBase()</div><div>pkg_list =3D yb.doPackageLists(pkgnarrow=3D"install= ed")</div> <div>inst_pkg_list =3D pkg_list.installed</div><div><br></div><div>#Now I a= m trying to find if there is an attribute giving yum repository info for th= is package</div><div>rpm1 =3D inst_pkg_list[0]</div><div>rpm1.repoid</div> <div> 'installed'</div><div>#However, it returns 'installed', whi= ch is not yum repository name.</div><div><br></div><div><br></div><div>Wher= e I am doing it wrong?</div><div>Any help is highly appreciated.</div> <span><font color=3D"#888888"> <div> <br></div><div>-- <br><div dir=3D"ltr"><font face=3D"tahoma, sans-serif" co= lor=3D"#000000">Regards,</font><div><font face=3D"tahoma, sans-serif" color= =3D"#000000">Navid Shaikh</font></div> </div> </div></font></span></div> <br></div></div>_______________________________________________<br> Yum mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= l.org</a><br> <a href=3D"http://lists.baseurl.org/mailman/listinfo/yum" target=3D"_blank"= >http://lists.baseurl.org/mailman/listinfo/yum</a><br> <br></blockquote></div><br></div></div> <br>_______________________________________________<br> Yum mailing list<br> <a href=3D"mailto:[email protected]">[email protected]</a><br> <a href=3D"http://lists.baseurl.org/mailman/listinfo/yum" target=3D"_blank"= >http://lists.baseurl.org/mailman/listinfo/yum</a><br> <br></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div dir= =3D"ltr"><font face=3D"tahoma, sans-serif" style=3D"background-color:rgb(25= 5,255,255)" color=3D"#000000">Regards,</font><div><font face=3D"tahoma, san= s-serif" style=3D"background-color:rgb(255,255,255)" color=3D"#000000">Navi= d Shaikh | @SwordPhilic</font></div> </div> </div> --089e0158cb54712b2904f554b209-- --===============7721250029301725903== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Yum mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum --===============7721250029301725903==--