Changeset 2550

Show
Ignore:
Timestamp:
06/21/07 14:55:55 (1 year ago)
Author:
dhozac
Message:

Use the correct path to the configuration file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/contrib/yum-3.2.0-chroot.patch

    r2546 r2550  
    1 --- yum-3.2.0/yum/config.py.chroot 
    2 +++ yum-3.2.0/yum/config.py 
    3 @@ -464,6 +464,26 @@ 
     1--- yum-3.2.0/yum/__init__.py.chroot    2007-05-16 16:57:12.000000000 -0400 
     2+++ yum-3.2.0/yum/__init__.py   2007-06-20 20:33:35.000000000 -0400 
     3@@ -201,8 +201,7 @@ class YumBase(depsolve.Depsolve): 
     4         # (typically /etc/yum/repos.d) 
     5         parser = ConfigParser() 
     6         for reposdir in self.conf.reposdir: 
     7-            if os.path.exists(self.conf.installroot+'/'+reposdir): 
     8-                reposdir = self.conf.installroot + '/' + reposdir 
     9+            reposdir  = self.conf.getRootedPath(reposdir) 
     10  
     11             if os.path.isdir(reposdir): 
     12                 for repofn in glob.glob('%s/*.repo' % reposdir): 
     13@@ -632,17 +631,15 @@ class YumBase(depsolve.Depsolve): 
     14              
     15         self.verbose_logger.log(logginglevels.INFO_2, 'Finished') 
     16          
     17-    def doLock(self, lockfile = YUM_PID_FILE): 
     18+    def doLock(self): 
     19         """perform the yum locking, raise yum-based exceptions, not OSErrors""" 
     20          
     21         # if we're not root then we don't lock - just return nicely 
     22         if self.conf.uid != 0: 
     23             return 
     24-             
     25-        root = self.conf.installroot 
     26-        lockfile = root + '/' + lockfile # lock in the chroot 
     27-        lockfile = os.path.normpath(lockfile) # get rid of silly preceding extra / 
     28-         
     29
     30+        lockfile = self.conf.lockfile 
     31
     32         mypid=str(os.getpid())     
     33         while not self._lock(lockfile, mypid, 0644): 
     34             fd = open(lockfile, 'r') 
     35@@ -667,16 +664,15 @@ class YumBase(depsolve.Depsolve): 
     36                     msg = 'Existing lock %s: another copy is running as pid %s. Aborting.' % (lockfile, oldpid) 
     37                     raise Errors.LockError(0, msg) 
     38      
     39-    def doUnlock(self, lockfile = YUM_PID_FILE): 
     40+    def doUnlock(self): 
     41         """do the unlock for yum""" 
     42          
     43         # if we're not root then we don't lock - just return nicely 
     44         if self.conf.uid != 0: 
     45             return 
     46          
     47-        root = self.conf.installroot 
     48-        lockfile = root + '/' + lockfile # lock in the chroot 
     49-         
     50+        lockfile=self.conf.lockfile 
     51
     52         self._unlock(lockfile) 
     53          
     54     def _lock(self, filename, contents='', mode=0777): 
     55--- yum-3.2.0/yum/config.py.chroot      2007-04-26 10:12:30.000000000 -0400 
     56+++ yum-3.2.0/yum/config.py     2007-06-20 20:33:35.000000000 -0400 
     57@@ -464,6 +464,26 @@ class StartupConf(BaseConfig): 
    458     pluginpath = ListOption(['/usr/share/yum-plugins', '/usr/lib/yum-plugins']) 
    559     pluginconfpath = ListOption(['/etc/yum/pluginconf.d']) 
     
    2882     ''' 
    2983     Configuration option definitions for yum.conf\'s [main] section. 
    30 @@ -476,6 +496,7 @@ 
     84@@ -476,6 +496,7 @@ class YumConf(StartupConf): 
    3185     cachedir = Option('/var/cache/yum') 
    3286     keepcache = BoolOption(True) 
     
    3690     syslog_ident = Option() 
    3791     syslog_facility = Option('LOG_DAEMON') 
    38 @@ -605,9 +626,9 @@ 
     92@@ -605,9 +626,9 @@ def readMainConfig(startupconf): 
    3993     yumconf.populate(startupconf._parser, 'main') 
    4094  
     
    48102     # Add in some extra attributes which aren't actually configuration values  
    49103     yumconf.yumvar = yumvars 
    50 --- yum-3.2.0/yum/__init__.py.chroot 
    51 +++ yum-3.2.0/yum/__init__.py 
    52 @@ -201,8 +201,7 @@ 
    53          # (typically /etc/yum/repos.d) 
    54          parser = ConfigParser() 
    55          for reposdir in self.conf.reposdir: 
    56 -            if os.path.exists(self.conf.installroot+'/'+reposdir): 
    57 -                reposdir = self.conf.installroot + '/' + reposdir 
    58 +            reposdir  = self.conf.getRootedPath(reposdir) 
    59   
    60              if os.path.isdir(reposdir): 
    61                  for repofn in glob.glob('%s/*.repo' % reposdir): 
    62 @@ -632,17 +631,15 @@ 
    63               
    64          self.verbose_logger.log(logginglevels.INFO_2, 'Finished') 
    65           
    66 -    def doLock(self, lockfile = YUM_PID_FILE): 
    67 +    def doLock(self): 
    68          """perform the yum locking, raise yum-based exceptions, not OSErrors""" 
    69           
    70          # if we're not root then we don't lock - just return nicely 
    71          if self.conf.uid != 0: 
    72              return 
    73 -             
    74 -        root = self.conf.installroot 
    75 -        lockfile = root + '/' + lockfile # lock in the chroot 
    76 -        lockfile = os.path.normpath(lockfile) # get rid of silly preceding extra / 
    77 -         
    78 
    79 +        lockfile = self.conf.lockfile 
    80 
    81          mypid=str(os.getpid())     
    82          while not self._lock(lockfile, mypid, 0644): 
    83              fd = open(lockfile, 'r') 
    84 @@ -667,16 +664,15 @@ 
    85                      msg = 'Existing lock %s: another copy is running as pid %s. Aborting.' % (lockfile, oldpid) 
    86                      raise Errors.LockError(0, msg) 
    87       
    88 -    def doUnlock(self, lockfile = YUM_PID_FILE): 
    89 +    def doUnlock(self): 
    90          """do the unlock for yum""" 
    91           
    92          # if we're not root then we don't lock - just return nicely 
    93          if self.conf.uid != 0: 
    94              return 
    95           
    96 -        root = self.conf.installroot 
    97 -        lockfile = root + '/' + lockfile # lock in the chroot 
    98 -         
    99 +        lockfile=self.conf.lockfile 
    100 
    101          self._unlock(lockfile) 
    102           
    103      def _lock(self, filename, contents='', mode=0777): 
    104 --- yum-3.2.0/docs/yum.conf.5.chroot 
    105 +++ yum-3.2.0/docs/yum.conf.5 
    106 @@ -23,8 +23,10 @@ 
     104--- yum-3.2.0/docs/yum.conf.5.chroot    2007-02-18 19:14:56.000000000 -0500 
     105+++ yum-3.2.0/docs/yum.conf.5   2007-06-20 20:33:35.000000000 -0400 
     106@@ -23,8 +23,10 @@ The [main] section must exist for yum to 
    107107 following options: 
    108108  
     
    117117 .IP \fBkeepcache\fR 
    118118 Either `1' or `0'. Determines whether or not yum keeps the cache 
    119 @@ -40,6 +42,10 @@ 
     119@@ -40,6 +42,10 @@ documented in \fB[repository] options\fR 
    120120 repositories defined in /etc/yum/yum.conf to form the complete set of 
    121121 repositories that yum will use. 
     
    128128 Debug message output level. Practical range is 0\-10. Default is `2'. 
    129129  
    130 @@ -47,7 +53,10 @@ 
     130@@ -47,7 +53,10 @@ Debug message output level. Practical ra 
    131131 Error message output level. Practical range is 0\-10. Default is `2'. 
    132132  
     
    140140 .IP \fBgpgcheck\fR 
    141141 Either `1' or `0'. This tells yum whether or not it should perform a GPG 
    142 --- yum-3.2.0/cli.py.chroot 
    143 +++ yum-3.2.0/cli.py 
    144 @@ -1166,13 +1166,16 @@ 
     142--- yum-3.2.0/cli.py.chroot    2007-05-15 08:18:07.000000000 -0400 
     143+++ yum-3.2.0/cli.py   2007-06-20 20:33:35.000000000 -0400 
     144@@ -1166,13 +1166,14 @@ class YumOptionParser(OptionParser): 
    145145     def getRoot(self,opts): 
    146146         # If the conf file is inside the  installroot - use that. 
    147147         # otherwise look for it in the normal root 
    148 -        if opts.installroot: 
     148+        if opts.conffile==None: 
     149+            opts.conffile = '/etc/yum/yum.conf' 
     150+            if opts.installroot: 
     151+                if os.access(opts.installroot+opts.conffile, os.R_OK): 
     152+                    opts.conffile = opts.installroot+opts.conffile 
     153+                elif os.access(opts.installroot+'/etc/yum.conf', os.R_OK): 
     154+                    opts.conffile = opts.installroot+'/etc/yum.conf' 
     155         if opts.installroot: 
    149156-            if os.access(opts.installroot+'/'+opts.conffile, os.R_OK): 
    150 +        if opts.conffile==None: 
    151 +            opts.conffile = '/etc/yum.conf' 
    152 +            if opts.installroot and os.access(opts.installroot+'/'+opts.conffile, os.R_OK): 
    153                  opts.conffile = opts.installroot+'/'+opts.conffile 
    154              elif opts.conffile == '/etc/yum/yum.conf': 
    155                  # check if /installroot/etc/yum.conf exists. 
    156                  if os.access(opts.installroot+'/etc/yum.conf', os.R_OK): 
    157                      opts.conffile = opts.installroot+'/etc/yum.conf'          
    158 
    159 +        if opts.installroot: 
     157-                opts.conffile = opts.installroot+'/'+opts.conffile 
     158-            elif opts.conffile == '/etc/yum/yum.conf': 
     159-                # check if /installroot/etc/yum.conf exists. 
     160-                if os.access(opts.installroot+'/etc/yum.conf', os.R_OK): 
     161-                    opts.conffile = opts.installroot+'/etc/yum.conf'          
    160162             root=opts.installroot 
    161163         else: 
    162164             root = '/' 
    163 @@ -1195,7 +1198,7 @@ 
     165@@ -1195,7 +1196,7 @@ class YumOptionParser(OptionParser): 
    164166                 action="store_true", default=False, 
    165167                 help="run entirely from cache, don't update cache")