Chinaunix

标题: YUM认识 [打印本页]

作者: 适兕    时间: 2007-01-18 19:32
标题: YUM认识
这个叫yellowdog Update,Modified.是LINUX@DUKE上的一个项目。
其项目的大体介绍我只复制过来,不作任何的翻译。
um is an automatic updater and package installer/remover for rpm
        systems. It automatically computes dependencies and figures out what
        things should occur to install packages. It makes it easier to
        maintain groups of machines without having to manually update each
        one using rpm.
      
      
        Features include:(特征)
       

      
     至于我为什么要介绍这样一个软件,而且分类到python世界,并不是放到free&open source software里,那就是它是用python语言编写的一个强大的linux系统工具!
#!/usr/bin/python
import sys
try:
   import yum
except ImportError:
   print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
   %s
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
If you cannot solve this problem yourself, please go to
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
""" % (sys.exc_value, sys.version)
   sys.exit(1)
sys.path.insert(0, '/usr/share/yum-cli')
try:
    import yummain
    yummain.main(sys.argv[1:])
except KeyboardInterrupt, e:
    print >> sys.stderr, "\n\nExiting on user cancel."
    sys.exit(1)
这是yum的运行脚本!还有什么是我要介绍的吗?
那就看一下其模块吧:
[root@lee grub]# python
Python 2.4.2 (#1, Feb 12 2006, 03:59:46)
[GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>> dir(yum)
['BOOLEAN_STATES', 'Errors', 'LETTERFLAGS', 'ListPackageSack', 'PLUG_OPT_BOOL', 'PLUG_OPT_FLOAT', 'PLUG_OPT_INT', 'PLUG_OPT_STRING', 'PLUG_OPT_WHERE_ALL', 'PLUG_OPT_WHERE_MAIN', 'PLUG_OPT_WHERE_REPO', 'PO_CONFIG', 'PO_DIR', 'PO_DOC', 'PO_FILE', 'PO_GHOST', 'PO_INSTALLEDPKG', 'PO_LOCALPKG', 'PO_REMOTEPKG', 'SYMBOLFLAGS', 'TR_DEPENDS', 'TR_DEPENDSON', 'TR_OBSOLETEDBY', 'TR_OBSOLETES', 'TR_UPDATEDBY', 'TR_UPDATES', 'TS_AVAILABLE', 'TS_ERASE', 'TS_INSTALL', 'TS_INSTALL_STATES', 'TS_OBSOLETED', 'TS_OBSOLETING', 'TS_REMOVE_STATES', 'TS_TRUEINSTALL', 'TS_UPDATE', 'TX_BLACK', 'TX_GREY', 'TX_WHITE', 'URLGrabError', 'YumAvailablePackage', 'YumBase', 'YumInstalledPackage', 'YumLocalPackage', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', 'comps', 'config', 'constants', 'depsolve', 'errno', 'fnmatch', 'glob', 'mdErrors', 'mdcache', 'misc', 'os', 'packages', 'parsePackages', 'parser', 'pgpmsg', 'plugins', 're', 'repos', 'rpm', 'rpmUtils', 'sre_constants', 'sys', 'time', 'transactioninfo', 'types']
在/usr/lib/python2.4下有更多的。。。。。源数据、递归、对系统硬件信息的调用。。。。。。。值得我们好好研究下。
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/6303/showart_234250.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2