+++ /dev/null
-diff -Nurp yum-2.9.6.orig/cli.py yum-2.9.6/cli.py
---- yum-2.9.6.orig/cli.py 2006-09-06 06:15:49.000000000 +0200
-+++ yum-2.9.6/cli.py 2006-09-25 09:08:06.000000000 +0200
-@@ -123,7 +123,7 @@ yum [options] < update | install | info
- action="store_true", default=False,
- help="run entirely from cache, don't update cache")
- self.optparser.add_option("-c", "", dest="conffile", action="store",
-- default='/etc/yum.conf', help="config file location",
-+ default=None, help="config file location",
- metavar=' [config file]')
- self.optparser.add_option("-R", "", dest="sleeptime", action="store",
- type='int', default=None, help="maximum command wait time",
-@@ -175,9 +175,12 @@ yum [options] < update | install | info
-
- # If the conf file is inside the installroot - use that.
- # otherwise look for it in the normal root
-- if opts.installroot:
-- if os.access(opts.installroot+'/'+opts.conffile, os.R_OK):
-+ if opts.conffile==None:
-+ opts.conffile = '/etc/yum.conf'
-+ if opts.installroot and os.access(opts.installroot+'/'+opts.conffile, os.R_OK):
- opts.conffile = opts.installroot+'/'+opts.conffile
-+
-+ if opts.installroot:
- root=opts.installroot
- else:
- root = '/'
-diff -Nurp yum-2.9.6.orig/docs/yum.conf.5 yum-2.9.6/docs/yum.conf.5
---- yum-2.9.6.orig/docs/yum.conf.5 2006-06-19 03:28:22.000000000 +0200
-+++ yum-2.9.6/docs/yum.conf.5 2006-09-25 09:02:50.000000000 +0200
-@@ -23,8 +23,10 @@ The [main] section must exist for yum to
- following options:
-
- .IP \fBcachedir\fR
--Directory where yum should store its cache and db files. The default is
--`/var/cache/yum'.
-+Directory where yum should store its cache and db files. The default
-+is `/var/cache/yum'. Unless the prefixes `hostfs://' or `chrootfs://'
-+are used, some magic will be applied to determine the real path in
-+combination with `--installroot'.
-
- .IP \fBkeepcache\fR
- Either `1' or `0'. Determines whether or not yum keeps the cache
-@@ -40,6 +42,10 @@ documented in \fB[repository] options\fR
- repositories defined in /etc/yum.conf to form the complete set of repositories
- that yum will use.
-
-+Unless the prefixes `hostfs://' or `chrootfs://' are used, some magic
-+will be applied to determine the real path in combination with
-+`--installroot'.
-+
- .IP \fBdebuglevel\fR
- Debug message output level. Practical range is 0\-10. Default is `2'.
-
-@@ -47,7 +53,10 @@ Debug message output level. Practical ra
- Error message output level. Practical range is 0\-10. Default is `2'.
-
- .IP \fBlogfile\fR
--Full directory and file name for where yum should write its log file.
-+Full directory and file name for where yum should write its log
-+file. Unless the prefixes `hostfs://' or `chrootfs://' are used,
-+some magic will be applied to determine the real path in combination
-+with `--installroot'.
-
- .IP \fBgpgcheck\fR
- Either `1' or `0'. This tells yum whether or not it should perform a GPG
-diff -Nurp yum-2.9.6.orig/yum/config.py yum-2.9.6/yum/config.py
---- yum-2.9.6.orig/yum/config.py 2006-06-19 03:28:22.000000000 +0200
-+++ yum-2.9.6/yum/config.py 2006-09-25 09:12:36.000000000 +0200
-@@ -481,6 +481,26 @@ class StartupConf(BaseConfig):
- pluginpath = ListOption(['/usr/lib/yum-plugins'])
- pluginconfpath = ListOption(['/etc/yum/pluginconf.d'])
-
-+ def getRootedPath(self, path, enforce_default=False, defaults_to_host=False):
-+ instroot = getattr(self, 'installroot', None)
-+ if instroot==None:
-+ return path
-+
-+ if path.startswith('hostfs://'): res = path[9:]
-+ elif path.startswith('chrootfs://'): res = instroot + '/' + path[11:]
-+ else:
-+ tmp = instroot + '/' + path
-+
-+ if enforce_default:
-+ if defaults_to_host: res = path
-+ else: res = tmp
-+ else:
-+ if os.path.exists(tmp): res = tmp
-+ elif defaults_to_host: res = path
-+ else: res = tmp
-+
-+ return res
-+
- class YumConf(StartupConf):
- '''
- Configuration option definitions for yum.conf\'s [main] section.
-@@ -493,6 +513,7 @@ class YumConf(StartupConf):
- cachedir = Option('/var/cache/yum')
- keepcache = BoolOption(True)
- logfile = Option('/var/log/yum.log')
-+ lockfile = Option('/var/run/yum.pid')
- reposdir = ListOption(['/etc/yum/repos.d', '/etc/yum.repos.d'])
- syslog_ident = Option()
- syslog_facility = Option('LOG_DAEMON')
-@@ -616,9 +637,9 @@ def readMainConfig(startupconf):
- yumconf.populate(startupconf._parser, 'main')
-
- # Apply the installroot to directory options
-- for option in ('cachedir', 'logfile'):
-+ for option in ('cachedir', 'logfile', 'lockfile'):
- path = getattr(yumconf, option)
-- setattr(yumconf, option, yumconf.installroot + path)
-+ setattr(yumconf, option, yumconf.getRootedPath(path))
-
- # Add in some extra attributes which aren't actually configuration values
- yumconf.yumvar = vars
-diff -Nurp yum-2.9.6.orig/yum/__init__.py yum-2.9.6/yum/__init__.py
---- yum-2.9.6.orig/yum/__init__.py 2006-09-06 06:18:20.000000000 +0200
-+++ yum-2.9.6/yum/__init__.py 2006-09-25 09:02:50.000000000 +0200
-@@ -171,8 +171,7 @@ class YumBase(depsolve.Depsolve):
- # (typically /etc/yum.repos.d and /etc/yum/repos.d)
- parser = config.IncludedDirConfigParser(vars=self.yumvar)
- for reposdir in self.conf.reposdir:
-- if os.path.exists(self.conf.installroot+'/'+reposdir):
-- reposdir = self.conf.installroot + '/' + reposdir
-+ reposdir = self.conf.getRootedPath(reposdir)
-
- if os.path.isdir(reposdir):
- #XXX: why can't we just pass the list of files?
-@@ -502,16 +501,20 @@ class YumBase(depsolve.Depsolve):
-
- self.verbose_logger.log(logginglevels.INFO_2, 'Finished')
-
-- def doLock(self, lockfile):
-+ def __getLockfileName(self):
-+ lockfile = self.conf.lockfile
-+ return self.conf.getRootedPath(lockfile,
-+ enforce_default = True,
-+ defaults_to_host = False)
-+
-+ def doLock(self):
- """perform the yum locking, raise yum-based exceptions, not OSErrors"""
-
- # if we're not root then we don't lock - just return nicely
- if self.conf.uid != 0:
- return
-
-- root = self.conf.installroot
-- lockfile = root + '/' + lockfile # lock in the chroot
-- lockfile = os.path.normpath(lockfile) # get rid of silly preceding extra /
-+ lockfile = self.__getLockfileName()
-
- mypid=str(os.getpid())
- while not self._lock(lockfile, mypid, 0644):
-@@ -537,15 +540,14 @@ class YumBase(depsolve.Depsolve):
- msg = 'Existing lock %s: another copy is running. Aborting.' % lockfile
- raise Errors.LockError(0, msg)
-
-- def doUnlock(self, lockfile):
-+ def doUnlock(self):
- """do the unlock for yum"""
-
- # if we're not root then we don't lock - just return nicely
- if self.conf.uid != 0:
- return
-
-- root = self.conf.installroot
-- lockfile = root + '/' + lockfile # lock in the chroot
-+ lockfile=self.__getLockfileName()
-
- self._unlock(lockfile)
-
-diff -Nurp yum-2.9.6.orig/yummain.py yum-2.9.6/yummain.py
---- yum-2.9.6.orig/yummain.py 2006-08-19 22:04:33.000000000 +0200
-+++ yum-2.9.6/yummain.py 2006-09-25 09:02:50.000000000 +0200
-@@ -62,7 +62,7 @@ def main(args):
- def unlock():
- try:
- base.closeRpmDB()
-- base.doUnlock(YUM_PID_FILE)
-+ base.doUnlock()
- except Errors.LockError, e:
- sys.exit(200)
-
-@@ -88,7 +88,7 @@ def main(args):
- except Errors.YumBaseError, e:
- exFatal(e)
- try:
-- base.doLock(YUM_PID_FILE)
-+ base.doLock()
- except Errors.LockError, e:
- logger.critical('%s', e.msg)
- sys.exit(200)