Changes between Version 3 and Version 4 of YumCodeSnippets

Show
Ignore:
Author:
james (IP: 65.172.155.230)
Timestamp:
02/02/09 15:20:32 (9 years ago)
Comment:

Assume "import yum, os, sys"

Legend:

Unmodified
Added
Removed
Modified
  • YumCodeSnippets

    v3 v4  
    11== Yum Code Snippets == 
    22 
    3 This is just snippets of code using the yum modules for common/simple tasks. Add/edit/comment as you'd like. 
     3This is just snippets of code using the yum modules for common/simple tasks. Add/edit/comment as you'd like. All of these snippets assume that you have done "import yum, os, sys". 
    44 
    55Open a local package as a yum package object w/o all the rest of the yum stuff: 
    4242 
    4343{{{ 
    44  
    45 import yum 
    4644my = yum.YumBase() 
    4745my.install(name='somepackage') 
    5654 
    5755{{{ 
    58  
    59 import yum, os, sys 
    6056my = yum.YumBase() 
    6157my.conf.basecachedir = '/tmp/whereever' 
    8177Search for which package(s) own a file on the system 
    8278{{{ 
    83 import yum 
    8479my = yum.YumBase() 
    8580pkgs = my.rpmdb.whatProvides('/boot/vmlinuz-2.6.23.9-85.fc8', None, (None, None,None)) 
    8681for pkg in pkgs: 
    87 print pkg 
     82    print pkg 
    8883}}} 
    8984 
    9186 
    9287{{{ 
    93 import yum 
    9488my = yum.YumBase() 
    9589pkgs = my.rpmdb.searchNevra(name='yum')