Parsing a yum repo with XPath

https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.htmlLets say you want to see what src RPMs are in a given yum repo. If the author used createrepo to create the yum repo, it should be an a fairly standard layout. The following xpath query should pull it out.

Note that you can get xmllint to run the xpath query from libxml2


curl http://$yumserver/$somerepo/ > repo.html
xmllint --html  --xpath "//html/body/table/tr/td/a/@href" repo.html | grep src

The portion of the query a/@href will match a tag like this

<a href="https://blam.src.rpm">

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.