From: Enrico Scholz Date: Sun, 10 Apr 2005 12:26:52 +0000 (+0000) Subject: added patches for yum X-Git-Tag: version_0_30_210~264 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d4f304755e35eda3add774220a26831e73da97f;p=util-vserver.git added patches for yum git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2017 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/contrib/Makefile-files b/util-vserver/contrib/Makefile-files index 99f6e15..fa79f78 100644 --- a/util-vserver/contrib/Makefile-files +++ b/util-vserver/contrib/Makefile-files @@ -26,6 +26,8 @@ noinst_DATA += $(contrib_gen_DTA) CLEANFILES += $(contrib_gen_DTA) EXTRA_DIST += $(contrib_subst_SRCS) \ - contrib/make-manifest + contrib/make-manifest \ + contrib/yum-2.2.1-chroot.patch \ + contrib/yum-2.3.2-chroot.patch contrib/manifest.dat: contrib/.manifest.dat.pathsubst.stamp diff --git a/util-vserver/contrib/yum-2.2.1-chroot.patch b/util-vserver/contrib/yum-2.2.1-chroot.patch new file mode 100644 index 0000000..7741680 --- /dev/null +++ b/util-vserver/contrib/yum-2.2.1-chroot.patch @@ -0,0 +1,194 @@ +--- yum-2.2.1/docs/yum.conf.5.chroot 2005-02-19 23:30:54.000000000 +0100 ++++ yum-2.2.1/docs/yum.conf.5 2005-04-08 19:53:02.000000000 +0200 +@@ -23,8 +23,10 @@ + 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 \fBreposdir\fR + Directory where yum should look for .repo files for its configuration +@@ -33,6 +35,10 @@ + repository options below. These will be merged with the 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'. + +@@ -40,7 +46,10 @@ + 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 +--- yum-2.2.1/yum/__init__.py.chroot 2005-03-15 08:34:03.000000000 +0100 ++++ yum-2.2.1/yum/__init__.py 2005-04-08 20:10:36.000000000 +0200 +@@ -298,19 +298,22 @@ + self.log(3, 'Arch Excluding %s' % po) + self.pkgSack.delPackage(po) + self.log(2, 'Finished') ++ ++ def __getLockfileName(self): ++ lockfile = self.conf.configdata['lockfile'] ++ return self.conf.getRootedPath(lockfile, ++ enforce_default = True, ++ defaults_to_host = False) + +- +- +- def doLock(self, lockfile): ++ 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.getConfigOption('uid') != 0: + return + +- root = self.conf.installroot +- lockfile = root + '/' + lockfile # lock in the chroot +- ++ lockfile=self.__getLockfileName() ++ + mypid=str(os.getpid()) + while not self._lock(lockfile, mypid, 0644): + fd = open(lockfile, 'r') +@@ -333,15 +336,14 @@ + 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.getConfigOption('uid') != 0: + return + +- root = self.conf.installroot +- lockfile = root + '/' + lockfile # lock in the chroot ++ lockfile=self.__getLockfileName() + + self._unlock(lockfile) + +--- yum-2.2.1/yum/config.py.chroot 2005-03-15 07:09:18.000000000 +0100 ++++ yum-2.2.1/yum/config.py 2005-04-08 19:53:02.000000000 +0200 +@@ -194,7 +194,8 @@ + + #defaults -either get them or set them + optionstrings = [('cachedir', '/var/cache/yum'), +- ('logfile', '/var/log/yum.log'), ++ ('logfile', '/var/log/yum.log'), ++ ('lockfile', '/var/run/yum.pid'), + ('reposdir', '/etc/yum.repos.d'), + ('rss-filename', 'yum-rss.xml'), + ('pkgpolicy', 'newest'), +@@ -270,9 +271,7 @@ + + # do the dirs - set the root if there is one (grumble) + for option in ['cachedir', 'logfile']: +- path = self.configdata[option] +- root = self.configdata['installroot'] +- rootedpath = root + path ++ rootedpath = self.getRootedPath(self.configdata[option]) + self.configdata[option] = rootedpath + setattr(self, option, rootedpath) + +@@ -314,8 +313,7 @@ + # read each of them in using confpp, then parse them same as any other repo + # section - as above. + reposdir = self.getConfigOption('reposdir') +- if os.path.exists(self.getConfigOption('installroot') + '/' + reposdir): +- reposdir = self.getConfigOption('installroot') + '/' + reposdir ++ reposdir = self.getRootedPath(reposdir) + + reposglob = reposdir + '/*.repo' + if os.path.exists(reposdir) and os.path.isdir(reposdir): +@@ -334,6 +332,23 @@ + print e + + ++ def getRootedPath(self, path, enforce_default=False, defaults_to_host=False): ++ instroot = self.configdata['installroot'] ++ 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 ++ + def listConfigOptions(self): + """return list of options available for global config""" + return self.configdata.keys() +--- yum-2.2.1/cli.py.chroot 2005-03-15 08:19:11.000000000 +0100 ++++ yum-2.2.1/cli.py 2005-04-08 19:53:02.000000000 +0200 +@@ -126,7 +126,7 @@ + sleeptime=0 + root = '/' + installroot = None +- conffile = '/etc/yum.conf' ++ conffile = None + + try: + for o,a in gopts: +@@ -140,12 +140,14 @@ + + # if the conf file is inside the installroot - use that. + # otherwise look for it in the normal root +- if installroot: +- if os.access(installroot + '/' + conffile, os.R_OK): ++ if conffile==None: ++ conffile = '/etc/yum.conf' ++ if installroot and os.access(installroot + '/' + conffile, os.R_OK): + conffile = installroot + '/' + conffile +- ++ ++ if installroot: + root = installroot +- ++ + try: + self.conf = yumconf(configfile = conffile, root = root) + except yum.Errors.ConfigError, e: +--- yum-2.2.1/yummain.py.chroot 2005-01-07 14:45:50.000000000 +0100 ++++ yum-2.2.1/yummain.py 2005-04-08 19:53:02.000000000 +0200 +@@ -41,7 +41,7 @@ + def unlock(): + try: + base.closeRpmDB() +- base.doUnlock('/var/run/yum.pid') ++ base.doUnlock() + except Errors.LockError, e: + sys.exit(200) + +@@ -58,7 +58,7 @@ + sys.exit(1) + + try: +- base.doLock('/var/run/yum.pid') ++ base.doLock() + except Errors.LockError, e: + base.errorlog(0,'%s' % e.msg) + sys.exit(200) diff --git a/util-vserver/contrib/yum-2.3.2-chroot.patch b/util-vserver/contrib/yum-2.3.2-chroot.patch new file mode 100644 index 0000000..5e40dfe --- /dev/null +++ b/util-vserver/contrib/yum-2.3.2-chroot.patch @@ -0,0 +1,205 @@ +--- yum-2.3.2/docs/yum.conf.5.chroot 2005-03-25 11:12:20.000000000 +0100 ++++ yum-2.3.2/docs/yum.conf.5 2005-04-08 18:27:12.000000000 +0200 +@@ -23,8 +23,10 @@ + 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 \fBreposdir\fR + A list of directories where yum should look for .repo files which define +@@ -34,6 +36,10 @@ + 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'. + +@@ -41,7 +47,10 @@ + 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 +--- yum-2.3.2/yum/__init__.py.chroot 2005-04-04 20:14:18.000000000 +0200 ++++ yum-2.3.2/yum/__init__.py 2005-04-08 20:11:06.000000000 +0200 +@@ -97,9 +97,8 @@ + # read each of them in using confpp, then parse them same as any other repo + # section - as above. + 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): + repofn = glob.glob(reposdir+'/*.repo') + repofn.sort() +@@ -405,17 +404,20 @@ + self.pkgSack.excludeArchs(archlist) + self.log(3, 'Finished') + ++ def __getLockfileName(self): ++ lockfile = self.conf.configdata['lockfile'] ++ return self.conf.getRootedPath(lockfile, ++ enforce_default = True, ++ defaults_to_host = False) + +- +- def doLock(self, lockfile): ++ 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.getConfigOption('uid') != 0: + return +- +- root = self.conf.installroot +- lockfile = root + '/' + lockfile # lock in the chroot ++ ++ lockfile=self.__getLockfileName() + + mypid=str(os.getpid()) + while not self._lock(lockfile, mypid, 0644): +@@ -439,15 +441,14 @@ + 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.getConfigOption('uid') != 0: + return + +- root = self.conf.installroot +- lockfile = root + '/' + lockfile # lock in the chroot ++ lockfile=self.__getLockfileName() + + self._unlock(lockfile) + +--- yum-2.3.2/yum/config.py.chroot 2005-03-28 00:01:22.000000000 +0200 ++++ yum-2.3.2/yum/config.py 2005-04-08 20:09:25.000000000 +0200 +@@ -193,7 +193,8 @@ + + #defaults -either get them or set them + optionstrings = [('cachedir', '/var/cache/yum'), +- ('logfile', '/var/log/yum.log'), ++ ('logfile', '/var/log/yum.log'), ++ ('lockfile', '/var/run/yum.pid'), + ('reposdir', ['/etc/yum/repos.d', '/etc/yum.repos.d']), + ('syslog_ident', None), + ('syslog_facility', 'LOG_USER'), +@@ -304,9 +305,7 @@ + + # do the dirs - set the root if there is one (grumble) + for option in ['cachedir', 'logfile']: +- path = self.configdata[option] +- root = self.configdata['installroot'] +- rootedpath = root + path ++ rootedpath = self.getRootedPath(self.configdata[option]) + self.configdata[option] = rootedpath + setattr(self, option, rootedpath) + +@@ -339,6 +338,23 @@ + "All plugin search paths must be absolute") + + ++ def getRootedPath(self, path, enforce_default=False, defaults_to_host=False): ++ instroot = self.configdata['installroot'] ++ 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 ++ + def listConfigOptions(self): + """return list of options available for global config""" + return self.configdata.keys() +@@ -717,9 +733,7 @@ + # read each of them in using confpp, then parse them same as any other repo + # section - as above. + +- reposdir = conf.reposdir +- if os.path.exists(conf.installroot + '/' + reposdir): +- reposdir = conf.installroot + '/' + reposdir ++ reposdir = conf.getRootedPath(conf.reposdir) + + reposglob = reposdir + '/*.repo' + if os.path.exists(reposdir) and os.path.isdir(reposdir): +--- yum-2.3.2/cli.py.chroot 2005-03-28 05:18:03.000000000 +0200 ++++ yum-2.3.2/cli.py 2005-04-08 18:27:12.000000000 +0200 +@@ -115,7 +115,7 @@ + sleeptime=0 + root = '/' + installroot = None +- conffile = '/etc/yum.conf' ++ conffile = None + + try: + for o,a in gopts: +@@ -129,12 +129,14 @@ + + # if the conf file is inside the installroot - use that. + # otherwise look for it in the normal root ++ if conffile==None: ++ conffile = '/etc/yum.conf' ++ if installroot and os.access(installroot + '/' + conffile, os.R_OK): ++ conffile = installroot + '/' + conffile ++ + if installroot: +- if os.access(installroot + '/' + conffile, os.R_OK): +- conffile = installroot + '/' + conffile +- +- root = installroot +- ++ root = installroot ++ + try: + self.doConfigSetup(fn = conffile, root = root) + except yum.Errors.ConfigError, e: +--- yum-2.3.2/yummain.py.chroot 2005-03-27 07:39:17.000000000 +0200 ++++ yum-2.3.2/yummain.py 2005-04-08 18:27:12.000000000 +0200 +@@ -41,7 +41,7 @@ + def unlock(): + try: + base.closeRpmDB() +- base.doUnlock('/var/run/yum.pid') ++ base.doUnlock() + except Errors.LockError, e: + sys.exit(200) + +@@ -58,7 +58,7 @@ + sys.exit(1) + + try: +- base.doLock('/var/run/yum.pid') ++ base.doLock() + except Errors.LockError, e: + base.errorlog(0,'%s' % e.msg) + sys.exit(200)