1 --- yum-2.3.3/docs/yum.conf.5.chroot
2 +++ yum-2.3.3/docs/yum.conf.5
7 -Directory where yum should store its cache and db files. The default is
9 +Directory where yum should store its cache and db files. The default
10 +is `/var/cache/yum'. Unless the prefixes `hostfs://' or `chrootfs://'
11 +are used, some magic will be applied to determine the real path in
12 +combination with `--installroot'.
15 A list of directories where yum should look for .repo files which define
17 repositories defined in /etc/yum.conf to form the complete set of repositories
20 +Unless the prefixes `hostfs://' or `chrootfs://' are used, some magic
21 +will be applied to determine the real path in combination with
25 Debug message output level. Practical range is 0\-10. Default is `2'.
28 Error message output level. Practical range is 0\-10. Default is `2'.
31 -Full directory and file name for where yum should write its log file.
32 +Full directory and file name for where yum should write its log
33 +file. Unless the prefixes `hostfs://' or `chrootfs://' are used,
34 +some magic will be applied to determine the real path in combination
35 +with `--installroot'.
38 Either `1' or `0'. This tells yum whether or not it should perform a GPG
39 --- yum-2.3.3/yum/__init__.py.chroot
40 +++ yum-2.3.3/yum/__init__.py
42 # read each of them in using confpp, then parse them same as any other repo
44 for reposdir in self.conf.reposdir:
45 - if os.path.exists(self.conf.installroot + '/' + reposdir):
46 - reposdir = self.conf.installroot + '/' + reposdir
48 + reposdir = self.conf.getRootedPath(reposdir)
50 if os.path.isdir(reposdir):
51 repofn = glob.glob(reposdir+'/*.repo')
54 self.pkgSack.excludeArchs(archlist)
55 self.log(3, 'Finished')
57 + def __getLockfileName(self):
58 + lockfile = self.conf.configdata['lockfile']
59 + return self.conf.getRootedPath(lockfile,
60 + enforce_default = True,
61 + defaults_to_host = False)
64 - def doLock(self, lockfile):
66 """perform the yum locking, raise yum-based exceptions, not OSErrors"""
68 # if we're not root then we don't lock - just return nicely
69 if self.conf.getConfigOption('uid') != 0:
72 - root = self.conf.installroot
73 - lockfile = root + '/' + lockfile # lock in the chroot
75 + lockfile=self.__getLockfileName()
77 mypid=str(os.getpid())
78 while not self._lock(lockfile, mypid, 0644):
80 msg = 'Existing lock %s: another copy is running. Aborting.' % lockfile
81 raise Errors.LockError(0, msg)
83 - def doUnlock(self, lockfile):
85 """do the unlock for yum"""
87 # if we're not root then we don't lock - just return nicely
88 if self.conf.getConfigOption('uid') != 0:
91 - root = self.conf.installroot
92 - lockfile = root + '/' + lockfile # lock in the chroot
93 + lockfile=self.__getLockfileName()
95 self._unlock(lockfile)
97 --- yum-2.3.3/yum/config.py.chroot
98 +++ yum-2.3.3/yum/config.py
101 #defaults -either get them or set them
102 optionstrings = [('cachedir', '/var/cache/yum'),
103 - ('logfile', '/var/log/yum.log'),
104 + ('logfile', '/var/log/yum.log'),
105 + ('lockfile', '/var/run/yum.pid'),
106 ('reposdir', ['/etc/yum/repos.d', '/etc/yum.repos.d']),
107 ('syslog_ident', None),
108 ('syslog_facility', 'LOG_USER'),
111 # do the dirs - set the root if there is one (grumble)
112 for option in ['cachedir', 'logfile']:
113 - path = self.configdata[option]
114 - root = self.configdata['installroot']
115 - rootedpath = root + path
116 + rootedpath = self.getRootedPath(self.configdata[option])
117 self.configdata[option] = rootedpath
118 setattr(self, option, rootedpath)
121 "All plugin search paths must be absolute")
124 + def getRootedPath(self, path, enforce_default=False, defaults_to_host=False):
125 + instroot = self.configdata['installroot']
126 + if path.startswith('hostfs://'): res = path[9:]
127 + elif path.startswith('chrootfs://'): res = instroot + '/' + path[11:]
129 + tmp = instroot + '/' +path
131 + if enforce_default:
132 + if defaults_to_host: res = path
135 + if os.path.exists(tmp): res = tmp
136 + elif defaults_to_host: res = path
141 def listConfigOptions(self):
142 """return list of options available for global config"""
143 return self.configdata.keys()
145 # read each of them in using confpp, then parse them same as any other repo
146 # section - as above.
148 - reposdir = conf.reposdir
149 - if os.path.exists(conf.installroot + '/' + reposdir):
150 - reposdir = conf.installroot + '/' + reposdir
151 + reposdir = conf.getRootedPath(conf.reposdir)
153 reposglob = reposdir + '/*.repo'
154 if os.path.exists(reposdir) and os.path.isdir(reposdir):
155 --- yum-2.3.3/cli.py.chroot
158 action="store_true", default=False,
159 help="run entirely from cache, don't update cache")
160 self.optparser.add_option("-c", "", dest="conffile", action="store",
161 - default='/etc/yum.conf', help="config file location",
162 + default=None, help="config file location",
163 metavar=' [config file]')
164 self.optparser.add_option("-R", "", dest="sleeptime", action="store",
165 type='int', default=None, help="maximum command wait time",
168 # If the conf file is inside the installroot - use that.
169 # otherwise look for it in the normal root
170 - if opts.installroot:
171 - if os.access(opts.installroot+'/'+opts.conffile, os.R_OK):
172 + if opts.conffile==None:
173 + opts.conffile = '/etc/yum.conf'
174 + if opts.installroot and os.access(opts.installroot+'/'+opts.conffile, os.R_OK):
175 opts.conffile = opts.installroot+'/'+opts.conffile
177 + if opts.installroot:
178 root=opts.installroot
181 --- yum-2.3.3/yummain.py.chroot
182 +++ yum-2.3.3/yummain.py
187 - base.doUnlock(YUM_PID_FILE)
189 except Errors.LockError, e:
193 except Errors.YumBaseError, e:
196 - base.doLock(YUM_PID_FILE)
198 except Errors.LockError, e:
199 base.errorlog(0,'%s' % e.msg)