root/trunk/contrib/yum-2.9.6-chroot.patch
| Revision 2425, 7.8 kB (checked in by ensc, 2 years ago) |
|---|
-
yum-2.9.6/cli.py
old new 123 123 action="store_true", default=False, 124 124 help="run entirely from cache, don't update cache") 125 125 self.optparser.add_option("-c", "", dest="conffile", action="store", 126 default= '/etc/yum.conf', help="config file location",126 default=None, help="config file location", 127 127 metavar=' [config file]') 128 128 self.optparser.add_option("-R", "", dest="sleeptime", action="store", 129 129 type='int', default=None, help="maximum command wait time", … … 175 175 176 176 # If the conf file is inside the installroot - use that. 177 177 # otherwise look for it in the normal root 178 if opts.installroot: 179 if os.access(opts.installroot+'/'+opts.conffile, os.R_OK): 178 if opts.conffile==None: 179 opts.conffile = '/etc/yum.conf' 180 if opts.installroot and os.access(opts.installroot+'/'+opts.conffile, os.R_OK): 180 181 opts.conffile = opts.installroot+'/'+opts.conffile 182 183 if opts.installroot: 181 184 root=opts.installroot 182 185 else: 183 186 root = '/' -
yum-2.9.6/docs/yum.conf.5
old new 23 23 following options: 24 24 25 25 .IP \fBcachedir\fR 26 Directory where yum should store its cache and db files. The default is 27 `/var/cache/yum'. 26 Directory where yum should store its cache and db files. The default 27 is `/var/cache/yum'. Unless the prefixes `hostfs://' or `chrootfs://' 28 are used, some magic will be applied to determine the real path in 29 combination with `--installroot'. 28 30 29 31 .IP \fBkeepcache\fR 30 32 Either `1' or `0'. Determines whether or not yum keeps the cache … … 40 42 repositories defined in /etc/yum.conf to form the complete set of repositories 41 43 that yum will use. 42 44 45 Unless the prefixes `hostfs://' or `chrootfs://' are used, some magic 46 will be applied to determine the real path in combination with 47 `--installroot'. 48 43 49 .IP \fBdebuglevel\fR 44 50 Debug message output level. Practical range is 0\-10. Default is `2'. 45 51 … … 47 53 Error message output level. Practical range is 0\-10. Default is `2'. 48 54 49 55 .IP \fBlogfile\fR 50 Full directory and file name for where yum should write its log file. 56 Full directory and file name for where yum should write its log 57 file. Unless the prefixes `hostfs://' or `chrootfs://' are used, 58 some magic will be applied to determine the real path in combination 59 with `--installroot'. 51 60 52 61 .IP \fBgpgcheck\fR 53 62 Either `1' or `0'. This tells yum whether or not it should perform a GPG -
yum-2.9.6/yum/config.py
old new 481 481 pluginpath = ListOption(['/usr/lib/yum-plugins']) 482 482 pluginconfpath = ListOption(['/etc/yum/pluginconf.d']) 483 483 484 def getRootedPath(self, path, enforce_default=False, defaults_to_host=False): 485 instroot = getattr(self, 'installroot', None) 486 if instroot==None: 487 return path 488 489 if path.startswith('hostfs://'): res = path[9:] 490 elif path.startswith('chrootfs://'): res = instroot + '/' + path[11:] 491 else: 492 tmp = instroot + '/' + path 493 494 if enforce_default: 495 if defaults_to_host: res = path 496 else: res = tmp 497 else: 498 if os.path.exists(tmp): res = tmp 499 elif defaults_to_host: res = path 500 else: res = tmp 501 502 return res 503 484 504 class YumConf(StartupConf): 485 505 ''' 486 506 Configuration option definitions for yum.conf\'s [main] section. … … 493 513 cachedir = Option('/var/cache/yum') 494 514 keepcache = BoolOption(True) 495 515 logfile = Option('/var/log/yum.log') 516 lockfile = Option('/var/run/yum.pid') 496 517 reposdir = ListOption(['/etc/yum/repos.d', '/etc/yum.repos.d']) 497 518 syslog_ident = Option() 498 519 syslog_facility = Option('LOG_DAEMON') … … 616 637 yumconf.populate(startupconf._parser, 'main') 617 638 618 639 # Apply the installroot to directory options 619 for option in ('cachedir', 'logfile' ):640 for option in ('cachedir', 'logfile', 'lockfile'): 620 641 path = getattr(yumconf, option) 621 setattr(yumconf, option, yumconf. installroot + path)642 setattr(yumconf, option, yumconf.getRootedPath(path)) 622 643 623 644 # Add in some extra attributes which aren't actually configuration values 624 645 yumconf.yumvar = vars -
yum-2.9.6/yum/__init__.py
old new 171 171 # (typically /etc/yum.repos.d and /etc/yum/repos.d) 172 172 parser = config.IncludedDirConfigParser(vars=self.yumvar) 173 173 for reposdir in self.conf.reposdir: 174 if os.path.exists(self.conf.installroot+'/'+reposdir): 175 reposdir = self.conf.installroot + '/' + reposdir 174 reposdir = self.conf.getRootedPath(reposdir) 176 175 177 176 if os.path.isdir(reposdir): 178 177 #XXX: why can't we just pass the list of files? … … 502 501 503 502 self.verbose_logger.log(logginglevels.INFO_2, 'Finished') 504 503 505 def doLock(self , lockfile):504 def doLock(self): 506 505 """perform the yum locking, raise yum-based exceptions, not OSErrors""" 507 506 508 507 # if we're not root then we don't lock - just return nicely 509 508 if self.conf.uid != 0: 510 509 return 511 510 512 root = self.conf.installroot 513 lockfile = root + '/' + lockfile # lock in the chroot 514 lockfile = os.path.normpath(lockfile) # get rid of silly preceding extra / 511 lockfile = self.conf.lockfile 515 512 516 513 mypid=str(os.getpid()) 517 514 while not self._lock(lockfile, mypid, 0644): … … 537 540 msg = 'Existing lock %s: another copy is running. Aborting.' % lockfile 538 541 raise Errors.LockError(0, msg) 539 542 540 def doUnlock(self , lockfile):543 def doUnlock(self): 541 544 """do the unlock for yum""" 542 545 543 546 # if we're not root then we don't lock - just return nicely 544 547 if self.conf.uid != 0: 545 548 return 546 549 547 root = self.conf.installroot 548 lockfile = root + '/' + lockfile # lock in the chroot 550 lockfile=self.conf.lockfile 549 551 550 552 self._unlock(lockfile) 551 553 -
yum-2.9.6/yummain.py
old new 62 62 def unlock(): 63 63 try: 64 64 base.closeRpmDB() 65 base.doUnlock( YUM_PID_FILE)65 base.doUnlock() 66 66 except Errors.LockError, e: 67 67 sys.exit(200) 68 68 … … 88 88 except Errors.YumBaseError, e: 89 89 exFatal(e) 90 90 try: 91 base.doLock( YUM_PID_FILE)91 base.doLock() 92 92 except Errors.LockError, e: 93 93 logger.critical('%s', e.msg) 94 94 sys.exit(200)
Note: See TracBrowser for help on using the browser.
