root/trunk/contrib/yum-2.3.4-chroot.patch

Revision 2146, 7.5 kB (checked in by ensc, 3 years ago)

added yum-2.3.4-chroot patch

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • yum-2.3.4/docs/yum.conf.5

    old new  
    2323following options: 
    2424 
    2525.IP \fBcachedir\fR 
    26 Directory where yum should store its cache and db files. The default is 
    27 `/var/cache/yum'. 
     26Directory where yum should store its cache and db files. The default 
     27is `/var/cache/yum'. Unless the prefixes `hostfs://' or `chrootfs://' 
     28are used, some magic will be applied to determine the real path in 
     29combination with `--installroot'. 
    2830 
    2931.IP \fBreposdir\fR 
    3032A list of directories where yum should look for .repo files which define 
     
    3436repositories defined in /etc/yum.conf to form the complete set of repositories 
    3537that yum will use. 
    3638 
     39Unless the prefixes `hostfs://' or `chrootfs://' are used, some magic 
     40will be applied to determine the real path in combination with 
     41`--installroot'. 
     42 
    3743.IP \fBdebuglevel\fR 
    3844Debug message output level. Practical range is 0\-10. Default is `2'. 
    3945 
     
    4147Error message output level. Practical range is 0\-10. Default is `2'. 
    4248 
    4349.IP \fBlogfile\fR 
    44 Full directory and file name for where yum should write its log file. 
     50Full directory and file name for where yum should write its log 
     51file. Unless the prefixes `hostfs://' or `chrootfs://' are used, 
     52some magic will be applied to determine the real path in combination 
     53with `--installroot'. 
    4554 
    4655.IP \fBgpgcheck\fR 
    4756Either `1' or `0'. This tells yum whether or not it should perform a GPG 
  • yum-2.3.4/yum/config.py

    old new  
    205205                       
    206206        #defaults -either get them or set them 
    207207        optionstrings = [('cachedir', '/var/cache/yum'),  
    208                          ('logfile', '/var/log/yum.log'),  
     208                         ('logfile', '/var/log/yum.log'), 
     209                         ('lockfile', '/var/run/yum.pid'), 
    209210                         ('reposdir', ['/etc/yum/repos.d', '/etc/yum.repos.d']), 
    210211                         ('syslog_ident', None), 
    211212                         ('syslog_facility', 'LOG_USER'), 
     
    318319 
    319320        # do the dirs - set the root if there is one (grumble) 
    320321        for option in ['cachedir', 'logfile']: 
    321             path = self.configdata[option] 
    322             root = self.configdata['installroot'] 
    323             rootedpath = root + path 
     322            rootedpath = self.getRootedPath(self.configdata[option]) 
    324323            self.configdata[option] = rootedpath 
    325324            setattr(self, option, rootedpath) 
    326325         
     
    358357                        "All plugin search paths must be absolute") 
    359358 
    360359 
     360    def getRootedPath(self, path, enforce_default=False, defaults_to_host=False): 
     361        instroot = self.configdata['installroot'] 
     362        if   path.startswith('hostfs://'):   res = path[9:] 
     363        elif path.startswith('chrootfs://'): res = instroot + '/' + path[11:] 
     364        else: 
     365            tmp = instroot + '/' +path 
     366 
     367            if enforce_default: 
     368                if defaults_to_host:    res = path 
     369                else:                   res = tmp 
     370            else: 
     371                if os.path.exists(tmp): res = tmp 
     372                elif defaults_to_host:  res = path 
     373                else:                   res = tmp 
     374 
     375        return res 
     376 
    361377    def listConfigOptions(self): 
    362378        """return list of options available for global config""" 
    363379        return self.configdata.keys() 
     
    749765 
    750766    reposdirs = [] 
    751767    for dir in conf.reposdir: 
    752         if os.path.exists(conf.installroot + '/' + dir): 
    753             reposdirs.append(conf.installroot + '/' + dir) 
     768        reposdirs.append(conf.getRootedPath(dir)) 
    754769 
    755770    repofn = [] 
    756771    for reposdir in reposdirs: 
  • yum-2.3.4/yummain.py

    old new  
    6060    def unlock(): 
    6161        try: 
    6262            base.closeRpmDB() 
    63             base.doUnlock(YUM_PID_FILE
     63            base.doUnlock(
    6464        except Errors.LockError, e: 
    6565            sys.exit(200) 
    6666 
     
    7878    except Errors.YumBaseError, e: 
    7979        exFatal(e) 
    8080    try: 
    81         base.doLock(YUM_PID_FILE
     81        base.doLock(
    8282    except Errors.LockError, e: 
    8383        base.errorlog(0,'%s' % e.msg) 
    8484        sys.exit(200) 
Note: See TracBrowser for help on using the browser.