initial support for RHEL 6 Beta1
[yum.git] / yum-3.2.25-chroot.patch
1 diff -ur yum-3.2.25.orig/cli.py yum-3.2.25/cli.py
2 --- yum-3.2.25.orig/cli.py      2010-04-26 18:04:21.012619640 -0400
3 +++ yum-3.2.25/cli.py   2010-04-26 18:05:04.141743816 -0400
4 @@ -1276,13 +1276,14 @@
5      def getRoot(self,opts):
6          # If the conf file is inside the  installroot - use that.
7          # otherwise look for it in the normal root
8 +        if opts.conffile is None:
9 +            opts.conffile = '/etc/yum/yum.conf'
10 +            if opts.installroot:
11 +                if os.access(opts.installroot+opts.conffile, os.R_OK):
12 +                    opts.conffile = opts.installroot+opts.conffile
13 +                elif os.access(opts.installroot+'/etc/yum.conf', os.R_OK):
14 +                    opts.conffile = opts.installroot+'/etc/yum.conf'
15          if opts.installroot:
16 -            if os.access(opts.installroot+'/'+opts.conffile, os.R_OK):
17 -                opts.conffile = opts.installroot+'/'+opts.conffile
18 -            elif opts.conffile == '/etc/yum/yum.conf':
19 -                # check if /installroot/etc/yum.conf exists.
20 -                if os.access(opts.installroot+'/etc/yum.conf', os.R_OK):
21 -                    opts.conffile = opts.installroot+'/etc/yum.conf'         
22              root=opts.installroot
23          else:
24              root = '/'
25 @@ -1323,7 +1324,7 @@
26                  action="store_true",
27                  help=_("run entirely from system cache, don't update cache"))
28          group.add_option("-c", "--config", dest="conffile",
29 -                default='/etc/yum/yum.conf',
30 +                default=None,
31                  help=_("config file location"), metavar='[config file]')
32          group.add_option("-R", "--randomwait", dest="sleeptime", type='int',
33                  default=None,
34 diff -ur yum-3.2.25.orig/yum/config.py yum-3.2.25/yum/config.py
35 --- yum-3.2.25.orig/yum/config.py       2010-04-26 18:04:21.232521015 -0400
36 +++ yum-3.2.25/yum/config.py    2010-04-26 18:04:45.824994677 -0400
37 @@ -602,6 +602,29 @@
38      syslog_ident = Option()
39      syslog_facility = Option('LOG_DAEMON')
40  
41 +
42 +
43 +    def getRootedPath(self, path, enforce_default=False, defaults_to_host=False):
44 +        instroot = self.installroot
45 +        if instroot is None:
46 +            return path
47 +
48 +        if   path.startswith('hostfs://'):   res = path[9:]
49 +        elif path.startswith('chrootfs://'): res = instroot + '/' + path[11:]
50 +        else:
51 +            tmp = instroot + '/' + path
52 +
53 +            if enforce_default:
54 +                if defaults_to_host:    res = path
55 +                else:                   res = tmp
56 +            else:
57 +                if os.path.exists(tmp): res = tmp
58 +                elif defaults_to_host:  res = path
59 +                else:                   res = tmp
60 +
61 +        return res
62 +
63 +
64  class YumConf(StartupConf):
65      '''
66      Configuration option definitions for yum.conf\'s [main] section.
67 @@ -615,6 +638,7 @@
68      persistdir = Option('/var/lib/yum')
69      keepcache = BoolOption(True)
70      logfile = Option('/var/log/yum.log')
71 +    lockfile = Option('/var/run/yum.pid')
72      reposdir = ListOption(['/etc/yum/repos.d', '/etc/yum.repos.d'])
73  
74      commands = ListOption()
75 @@ -854,9 +878,9 @@
76      yumconf.populate(startupconf._parser, 'main')
77  
78      # Apply the installroot to directory options
79 -    for option in ('cachedir', 'logfile', 'persistdir'):
80 +    for option in ('cachedir', 'logfile', 'lockfile', 'persistdir'):
81          path = getattr(yumconf, option)
82 -        ir_path = yumconf.installroot + path
83 +        ir_path = yumconf.getRootedPath(path)
84          ir_path = ir_path.replace('//', '/') # os.path.normpath won't fix this and
85                                               # it annoys me
86          ir_path = varReplace(ir_path, yumvars)
87 diff -ur yum-3.2.25.orig/yum/config.py.orig yum-3.2.25/yum/config.py.orig
88 --- yum-3.2.25.orig/yum/config.py.orig  2010-04-26 18:04:21.093414920 -0400
89 +++ yum-3.2.25/yum/config.py.orig       2010-04-26 18:04:21.232521015 -0400
90 @@ -788,6 +788,7 @@
91      sslclientcert = Inherit(YumConf.sslclientcert)
92      sslclientkey = Inherit(YumConf.sslclientkey)
93  
94 +    skip_if_unavailable = BoolOption(False)
95      
96  class VersionGroupConf(BaseConfig):
97      pkglist = ListOption()
98 diff -ur yum-3.2.25.orig/yum/__init__.py yum-3.2.25/yum/__init__.py
99 --- yum-3.2.25.orig/yum/__init__.py     2010-04-26 18:04:21.238799385 -0400
100 +++ yum-3.2.25/yum/__init__.py  2010-04-26 18:04:45.828610053 -0400
101 @@ -392,8 +392,7 @@
102              # this check makes sure that our dirs exist properly.
103              # if they aren't in the installroot then don't prepend the installroot path
104              # if we don't do this then anaconda likes to not  work.
105 -            if os.path.exists(self.conf.installroot+'/'+reposdir):
106 -                reposdir = self.conf.installroot + '/' + reposdir
107 +            reposdir = self.conf.getRootedPath(reposdir)
108  
109              if os.path.isdir(reposdir):
110                  for repofn in sorted(glob.glob('%s/*.repo' % reposdir)):
111 @@ -1320,9 +1319,8 @@
112              return
113              
114          root = self.conf.installroot
115 -        lockfile = root + '/' + lockfile # lock in the chroot
116 -        lockfile = os.path.normpath(lockfile) # get rid of silly preceding extra /
117 -        
118 +        lockfile = self.conf.lockfile
119 +
120          mypid=str(os.getpid())    
121          while not self._lock(lockfile, mypid, 0644):
122              fd = open(lockfile, 'r')
123 Only in yum-3.2.25/yum: __init__.py.orig