[Ilugc] How to get checksum of a file from yum repo (aka: Best way to access an xml from shell)

  • From: sivakumar@xxxxxxxxxx (sivakumar)
  • Date: Tue Jun 1 20:02:14 2010

Thanks for your quick response Mehul. 

Can you suggest me the best option to parse an xml from shell ?
<snip>
Is this what you want?
zgrep checksum /path/to/filename.xml.gz

Yeah, I was looking for something similar


I should have checked before replying.
Some examples in perl and awk are shown here on how to work with xml
files 
http://www.issociate.de/board/post/265610/Parse_an_XML_File_using_Shell_script.html
Before that you could use something like
1. Perl -> http://search.cpan.org/~mikewong/XML-Dumper-0.81/Dumper.pm
2. Python -> http://docs.python.org/release/2.5.2/lib/module-zlib.html

Thanks for these options.

Later today I realized that there is also a sqlite db for the yum/zypper
repo which resides in the client end. Hence I had taken the below
approach.

sqlite3 /var/cache/yum/<reponame>/primary.xml.gz.sqlite 'select pkgId
from packages where location_href like "%ZSI-1.7-2.el5.mdsc.i386.rpm"'

I had also come across xmllint, xmlproc_parse might have also solved my
need. 

Other related posts:

  • » [Ilugc] How to get checksum of a file from yum repo (aka: Best way to access an xml from shell) - sivakumar