Chinaunix首页 | 论坛 | 博客
  • 博客访问: 455885
  • 博文数量: 45
  • 博客积分: 2526
  • 博客等级: 少校
  • 技术积分: 478
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-12 21:04
文章分类

全部博文(45)

文章存档

2014年(1)

2011年(1)

2010年(3)

2009年(22)

2008年(18)

我的朋友

分类: LINUX

2009-09-10 22:07:55

[ray@localhost ~]$ python
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>> md = yum.repoMDObject.RepoMD('fedora', '/var/cache/yum/fedora/repomd.xml')
>>> md.repoid
'fedora'
>>> md.tags
{'content': set([]), 'distro': {}}
>>> md.fileTypes()
['group', 'filelists', 'group_gz', 'primary', 'primary_db', 'other_db', 'other', 'filelists_db']
>>> md.dump()
file timestamp: 1227132182
file length : 2849
file checksum : md5/27e5eaef0355bdfd655ab62a94a9c9a5
file checksum : sha1/263de5c3f3664269fa33b7218ae1c58a46b9f8ea
file checksum : sha256/5bc05ae10476b8cb8b83745c83f223574f1f95a7cb5113b1160814d867fd72ad
revision: 1227126769

---- Data ----
  datatype: filelists
    location : None repodata/34d42ab6240fbd8d5fd464fafea49c09f7acc93a-filelists.xml.gz
    timestamp : 1227131096
    size : None
    open size : None
    checksum : sha - 34d42ab6240fbd8d5fd464fafea49c09f7acc93a
    open checksum: sha - 835abf1dd955c86ce440c240579d4a2a13ae6c4d
    dbversion : None

  datatype: filelists_db
    location : None repodata/848f002818e918fb0dc1e258342c63c3587683bf-filelists.sqlite.bz2
    timestamp : 1227131827
    size : None
    open size : None
    checksum : sha - 848f002818e918fb0dc1e258342c63c3587683bf
    open checksum: sha - 7f4fe477864248d6d9cd4b96686a01b96ba5f6e6
    dbversion : 10

  datatype: group
    location : None repodata/99f2086106ff36f48ed144e90f8c8aebc7142670-comps-rawhide.xml
    timestamp : 1227132182
    size : None
    open size : None
    checksum : sha - 99f2086106ff36f48ed144e90f8c8aebc7142670
    open checksum: None - None
    dbversion : None

  datatype: group_gz
    location : None repodata/ebbef2b450b2c5de3600a1cb49def759be1f0fca-comps-rawhide.xml.gz
    timestamp : 1227132182
    size : None
    open size : None
    checksum : sha - ebbef2b450b2c5de3600a1cb49def759be1f0fca
    open checksum: sha - 99f2086106ff36f48ed144e90f8c8aebc7142670
    dbversion : None

  datatype: other
    location : None repodata/eb2d0a3e0d00a8c46468fc5ebabc417222c2821f-other.xml.gz
    timestamp : 1227131096
    size : None
    open size : None
    checksum : sha - eb2d0a3e0d00a8c46468fc5ebabc417222c2821f
    open checksum: sha - 868fc5462d8bdf088ded7ccbff27bbfb6e535a77
    dbversion : None

  datatype: other_db
    location : None repodata/3a3a9ddcaa815e9bd9f36d1d43ceca44fcb5e0bb-other.sqlite.bz2
    timestamp : 1227131156
    size : None
    open size : None
    checksum : sha - 3a3a9ddcaa815e9bd9f36d1d43ceca44fcb5e0bb
    open checksum: sha - 7f24728482a6bbb98801a51e14e6a15fa8ee8fbe
    dbversion : 10

  datatype: primary
    location : None repodata/beeea88d162e76993c25b9dd8139868274ee7fa1-primary.xml.gz
    timestamp : 1227131096
    size : None
    open size : None
    checksum : sha - beeea88d162e76993c25b9dd8139868274ee7fa1
    open checksum: sha - 95b0f369429584d337f84bba81e56f00afccc9c6
    dbversion : None

  datatype: primary_db
    location : None repodata/04da721e41b80b2a003de83f73387a6d7d30833f-primary.sqlite.bz2
    timestamp : 1227132181
    size : None
    open size : None
    checksum : sha - 04da721e41b80b2a003de83f73387a6d7d30833f
    open checksum: sha - fe268c32ce7a1ac643c71af17da5299b164948f4
    dbversion : 10

>>> md.fileTypes()
['group', 'filelists', 'group_gz', 'primary', 'primary_db', 'other_db', 'other', 'filelists_db']
>>> md.getData('primary_db')
<yum.repoMDObject.RepoData instance at 0x9fe91ec>
>>> md.getData('primary_db').type
'primary_db'
>>> md.getData('primary_db').location
(None, 'repodata/04da721e41b80b2a003de83f73387a6d7d30833f-primary.sqlite.bz2')
>>> md.fileTypes()
['group', 'filelists', 'group_gz', 'primary', 'primary_db', 'other_db', 'other', 'filelists_db']
>>> yb = yum.YumBase()
>>> yb.repos
<yum.repos.RepoStorage instance at 0x9fc0fcc>
>>> yb.repos.findRepos('update')
[]
>>> yb.repos.findRepos('updates')
[<yum.yumRepo.YumRepository object at 0xa0021cc>]
>>> yb.repos.findRepos('updates').id
Traceback (most recent call last):
  File "", line 1, in <module>
AttributeError: 'list' object has no attribute 'id'
>>> yb.repos.findRepos('updates')[0]
<yum.yumRepo.YumRepository object at 0xa0021cc>
>>> yb.repos.findRepos('updates')[0].id
'updates'
>>> yb.repos.findRepos('updates')[0].urls
['', '', '', '', '', '', '', '', '', '', 'ftp://ftp.num.edu.mn/updates/10/i386/']
>>> yb.repos.findRepos('updates')[0].cachedir
'/var/cache/yum/updates'
>>> yb.repos.findRepos('updates')[0].gpgdir
'/var/cache/yum/updates/gpgdir'
>>> yb.repos.findRepos('updates')[0].pkgdir
'/var/cache/yum/updates/packages'
>>> yb.repos.findRepos('updates')[0].cachedir
'/var/cache/yum/updates'
>>> yb.repos.findRepos('updates')[0]
<yum.yumRepo.YumRepository object at 0xa0021cc>

>>> print yb.repos.findRepos('updates')[0].dump()
[updates]
bandwidth = 0
cachedir = /var/cache/yum/updates
enabled = True
enablegroups = True
exclude = []
gpgcheck = True
gpgkey = ['file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386']
hdrdir = /var/cache/yum/updates/headers
includepkgs = []
keepalive = True
metalink = None
mirrorlist = http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f10&arch=i386
name = Fedora 10 - i386 - Updates
pkgdir = /var/cache/yum/updates/packages
proxy = None
proxy_password = None
proxy_username = None
repo_gpgcheck = False
retries = 10
throttle = 0
timeout = 30.0
baseurl = http://ftp.riken.jp/Linux/fedora/updates/10/i386/
 http://ftp.jaist.ac.jp/pub/Linux/Fedora/updates/10/i386/
 http://ftp.linux.org.tr/fedora/updates/10/i386/
 http://mirror.yandex.ru/fedora/linux/updates/10/i386/
 http://ftp.rhd.ru/pub/fedora/linux/updates/10/i386/
 http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/updates/10/i386/
 http://ftp.kddilabs.jp/Linux/packages/fedora/updates/10/i386/
 http://mirror.nus.edu.sg/fedora/updates/10/i386/
 http://mirror.corbina.net/pub/Linux/fedora/updates/10/i386/
 http://mirrors.cytanet.com.cy/linux/fedora/linux/updates/10/i386/
 ftp://ftp.num.edu.mn/updates/10/i386/

>>> print yb.repos.findRepos('updates')[0].baseurl
['', '', '', '', '', '', '', '', '', '', 'ftp://ftp.num.edu.mn/updates/10/i386/']
>>> print yb.repos.findRepos('updates')[0].proxy
None
>>> print yb.repos.findRepos('updates')[0].metadata_cookie
/var/cache/yum/updates/cachecookie
>>> yb.repos.findRepos('updates')[0].repoMDFile
'repodata/repomd.xml'
>>> yb.repos.findRepos('updates')[0].repofile
'///etc/yum.repos.d/fedora-updates.repo'

阅读(2773) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~