X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=contrib%2Fyum-3.2.0-chroot.patch;h=ced6b22078f1d4438325eb108b8c0e65d92a04ce;hb=bd2cb0a372e7c3f7496654a3c946ddff90209816;hp=e4a5557048b5272b8a04b8b5a112fdad4b584dc6;hpb=f7db325308fd991afdb7d39b37e44a0dbcfe73e4;p=util-vserver.git diff --git a/contrib/yum-3.2.0-chroot.patch b/contrib/yum-3.2.0-chroot.patch index e4a5557..ced6b22 100644 --- a/contrib/yum-3.2.0-chroot.patch +++ b/contrib/yum-3.2.0-chroot.patch @@ -1,55 +1,6 @@ ---- yum-3.2.0/yum/config.py.chroot -+++ yum-3.2.0/yum/config.py -@@ -464,6 +464,26 @@ - pluginpath = ListOption(['/usr/share/yum-plugins', '/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. -@@ -476,6 +496,7 @@ - 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') -@@ -605,9 +626,9 @@ - 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 = yumvars ---- yum-3.2.0/yum/__init__.py.chroot -+++ yum-3.2.0/yum/__init__.py -@@ -201,8 +201,7 @@ +--- yum-3.2.0/yum/__init__.py.chroot 2007-05-16 16:57:12.000000000 -0400 ++++ yum-3.2.0/yum/__init__.py 2007-06-20 20:33:35.000000000 -0400 +@@ -201,8 +201,7 @@ class YumBase(depsolve.Depsolve): # (typically /etc/yum/repos.d) parser = ConfigParser() for reposdir in self.conf.reposdir: @@ -59,7 +10,7 @@ if os.path.isdir(reposdir): for repofn in glob.glob('%s/*.repo' % reposdir): -@@ -632,17 +631,15 @@ +@@ -632,17 +631,15 @@ class YumBase(depsolve.Depsolve): self.verbose_logger.log(logginglevels.INFO_2, 'Finished') @@ -81,7 +32,7 @@ mypid=str(os.getpid()) while not self._lock(lockfile, mypid, 0644): fd = open(lockfile, 'r') -@@ -667,16 +664,15 @@ +@@ -667,16 +664,15 @@ class YumBase(depsolve.Depsolve): msg = 'Existing lock %s: another copy is running as pid %s. Aborting.' % (lockfile, oldpid) raise Errors.LockError(0, msg) @@ -101,9 +52,58 @@ self._unlock(lockfile) def _lock(self, filename, contents='', mode=0777): ---- yum-3.2.0/docs/yum.conf.5.chroot -+++ yum-3.2.0/docs/yum.conf.5 -@@ -23,8 +23,10 @@ +--- yum-3.2.0/yum/config.py.chroot 2007-04-26 10:12:30.000000000 -0400 ++++ yum-3.2.0/yum/config.py 2007-06-20 20:33:35.000000000 -0400 +@@ -464,6 +464,26 @@ class StartupConf(BaseConfig): + pluginpath = ListOption(['/usr/share/yum-plugins', '/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. +@@ -476,6 +496,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') +@@ -605,9 +626,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 = yumvars +--- yum-3.2.0/docs/yum.conf.5.chroot 2007-02-18 19:14:56.000000000 -0500 ++++ yum-3.2.0/docs/yum.conf.5 2007-06-20 20:33:35.000000000 -0400 +@@ -23,8 +23,10 @@ The [main] section must exist for yum to following options: .IP \fBcachedir\fR @@ -116,7 +116,7 @@ .IP \fBkeepcache\fR Either `1' or `0'. Determines whether or not yum keeps the cache -@@ -40,6 +42,10 @@ +@@ -40,6 +42,10 @@ documented in \fB[repository] options\fR repositories defined in /etc/yum/yum.conf to form the complete set of repositories that yum will use. @@ -127,7 +127,7 @@ .IP \fBdebuglevel\fR Debug message output level. Practical range is 0\-10. Default is `2'. -@@ -47,7 +53,10 @@ +@@ -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 @@ -139,28 +139,30 @@ .IP \fBgpgcheck\fR Either `1' or `0'. This tells yum whether or not it should perform a GPG ---- yum-3.2.0/cli.py.chroot -+++ yum-3.2.0/cli.py -@@ -1166,13 +1166,16 @@ +--- yum-3.2.0/cli.py.chroot 2007-05-15 08:18:07.000000000 -0400 ++++ yum-3.2.0/cli.py 2007-06-20 20:33:35.000000000 -0400 +@@ -1166,13 +1166,14 @@ class YumOptionParser(OptionParser): def getRoot(self,opts): # 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 - elif opts.conffile == '/etc/yum/yum.conf': - # check if /installroot/etc/yum.conf exists. - if os.access(opts.installroot+'/etc/yum.conf', os.R_OK): - opts.conffile = opts.installroot+'/etc/yum.conf' -+ -+ if opts.installroot: ++ opts.conffile = '/etc/yum/yum.conf' ++ if opts.installroot: ++ if os.access(opts.installroot+opts.conffile, os.R_OK): ++ opts.conffile = opts.installroot+opts.conffile ++ elif os.access(opts.installroot+'/etc/yum.conf', os.R_OK): ++ opts.conffile = opts.installroot+'/etc/yum.conf' + if opts.installroot: +- if os.access(opts.installroot+'/'+opts.conffile, os.R_OK): +- opts.conffile = opts.installroot+'/'+opts.conffile +- elif opts.conffile == '/etc/yum/yum.conf': +- # check if /installroot/etc/yum.conf exists. +- if os.access(opts.installroot+'/etc/yum.conf', os.R_OK): +- opts.conffile = opts.installroot+'/etc/yum.conf' root=opts.installroot else: root = '/' -@@ -1195,7 +1198,7 @@ +@@ -1195,7 +1196,7 @@ class YumOptionParser(OptionParser): action="store_true", default=False, help="run entirely from cache, don't update cache") self.add_option("-c", "", dest="conffile", action="store",