Skip to content

A class for reading a Yum repos primary.xml.gz and returning data

License

Notifications You must be signed in to change notification settings

vbauchart/repodataParser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage for RepoParser

>>> from repodataParser.RepoParser import Parser
>>> p = Parser(url='http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/SRPMS/repodata/primary.xml.gz')

Query a single Package

>>> package = p.getPackage('php53u')

There can be more than one package by the same name in a repo (differnt versions)

>>> len(package)
1

The package has the following keys

>>> package[0].keys()
[u'description', u'format', u'url', u'checksum', u'summary', u'version', u'location', u'time',
u'packager', u'size', u'arch', u'name']

Each key is a tuple of value / attributes, but not all keys will have both

>>> package[0]['name']
(u'php53u', None)

>>> package[0]['version']
(None, {u'epoch': u'0', u'ver': u'5.3.17', u'rel': u'2.ius.el5'})

>>> package[0]['version'][1]['ver']
u'5.3.17'

Our you can get all packages from a repo using getList:

>>> [ i['name'][0] for i in p.getList() ]
[u'php53u-suhosin', u'php54-pecl-mysqlnd-ms', u'mysql50', u'php54-pgsql84', u'php52-suhosin',
u'php52-pear', u'python26-memcached', u'php53u-pear', u'php53u-pgsql84', u'php52-pecl-apc',
u'php53u-ioncube-loader', u'mysql55', u'rsyslog4', u'php53u-pecl-imagick', u'php54-pecl-imagick',
u'php53u-pecl-apc', u'php53u-pecl-geoip', u'php52-ioncube-loader', u'php52-pecl-geoip',
u'php52-xcache', u'yum-plugin-replace', u'python31-redis', u'php53u', u'python26-jsonschema',
u'php54-ioncube-loader', u'python26-lxml', u'epel-release', u'php54-xcache', u'php54-pecl-geoip',
u'php53u-pecl-memcached', u'php52-pecl-xdebug', u'php54-suhosin', u'php53u-eaccelerator',
u'php52', u'php54-pear', u'python31', u'php54', u'php53u-pecl-memcache', u'python26-elixir',
u'php52-pecl-imagick', u'mysqlclient15', u'mysql51', u'python31-hiredis', u'php53u-pecl-xdebug',
u'php52-eaccelerator', u'php54-pecl-xdebug', u'php53u-xcache', u'python31-mod_wsgi',
u'ius-release', u'php54-pecl-memcache', u'autoconf26x', u'python31-postgresql',
u'php52-pecl-memcache', u'php54-pecl-apc', u'python31-distribute']

About

A class for reading a Yum repos primary.xml.gz and returning data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%