Changes between Version 2 and Version 3 of YumCodeSnippet/SetupArbitraryRepo

Show
Ignore:
Author:
james (IP: 65.172.155.230)
Timestamp:
07/21/09 20:36:31 (8 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • YumCodeSnippet/SetupArbitraryRepo

    v2 v3  
    66{{{ 
    77#!python 
     8 
     9url = sys.argv[1] 
     10 
    811yb = yum.YumBase() 
    9 yb.conf.basecachedir = '/tmp/whereever' 
     12if not yb.setCacheDir(reuse=False): 
     13  print >>sys.stderr, "Can't create a tmp. cachedir. " 
     14  sys.exit(1) 
     15 
     16yb.repos.disableRepo('*') 
     17 
     18yb.add_enable_repo('myrepo', [url]) 
     19}}} 
     20 
     21...or to do it completely by hand... 
     22 
     23{{{ 
     24#!python 
     25yb = yum.YumBase() 
     26basecachedir = '/tmp/whereever' 
    1027if not os.path.exists(yb.conf.basecachedir): 
    1128    os.makedirs(yb.conf.basecachedir) 
    1835newrepo.name = 'myrepo - %s' % url 
    1936newrepo.baseurl = [url] 
    20 newrepo.basecachedir = yb.conf.basecachedir 
     37newrepo.basecachedir = basecachedir 
    2138newrepo.enablegroups = True 
    2239yb.repos.add(newrepo)