Blame SOURCES/BZ-1102585-variable-substitution.patch

5e9bef
commit 28cc43d16664a408f7e4315767230544d7f52618
5e9bef
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
5e9bef
Date:   Mon May 19 16:21:46 2014 +0200
5e9bef
5e9bef
    Replace vars in include lines in .repo files. BZ 977380
5e9bef
5e9bef
diff --git a/yum/parser.py b/yum/parser.py
5e9bef
index b165ef2..5110cb5 100644
5e9bef
--- a/yum/parser.py
5e9bef
+++ b/yum/parser.py
5e9bef
@@ -18,6 +18,8 @@ def varReplace(raw, vars):
5e9bef
     @return: Input raw string with substituted values.
5e9bef
     '''
5e9bef
 
5e9bef
+    if not vars:
5e9bef
+        return raw
5e9bef
     done = []                      # Completed chunks to return
5e9bef
 
5e9bef
     while raw:
5e9bef
@@ -136,6 +138,7 @@ class ConfigPreProcessor:
5e9bef
                              'Error parsing config %s: include must specify file to include.' % (self.name)
5e9bef
                     else:
5e9bef
                         # whooohoo a valid include line.. push it on the stack
5e9bef
+                        url = varReplace(url, self._vars)
5e9bef
                         fo = self._pushfile( url )
5e9bef
                 else:
5e9bef
                     # check if the current line starts a new section
5e9bef
@@ -156,9 +159,7 @@ class ConfigPreProcessor:
5e9bef
             line = line.lstrip()
5e9bef
         # at this point we have a line from the topmost file on the stack
5e9bef
         # or EOF if the stack is empty
5e9bef
-        if self._vars:
5e9bef
-            return varReplace(line, self._vars)
5e9bef
-        return line
5e9bef
+        return varReplace(line, self._vars)
5e9bef
     
5e9bef
     
5e9bef
     def _absurl( self, url ):
5e9bef
commit 04c46c81f556e3e5ee72630f9501e243d00528a7
5e9bef
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
5e9bef
Date:   Wed Jun 11 11:13:00 2014 +0200
5e9bef
5e9bef
    Read env vars in readStartupConfig() to make them work in yum.conf. BZ 1102575
5e9bef
5e9bef
diff --git a/yum/config.py b/yum/config.py
5e9bef
index f0f4e96..6e0ecdc 100644
5e9bef
--- a/yum/config.py
5e9bef
+++ b/yum/config.py
5e9bef
@@ -1042,6 +1042,11 @@ def readStartupConfig(configfile, root, releasever=None):
5e9bef
     startupconf.config_file_path = configfile
5e9bef
     parser = ConfigParser()
5e9bef
     confpp_obj = ConfigPreProcessor(configfile)
5e9bef
+
5e9bef
+    yumvars = _getEnvVar()
5e9bef
+    confpp_obj._vars = yumvars
5e9bef
+    startupconf.yumvars = yumvars
5e9bef
+
5e9bef
     try:
5e9bef
         parser.readfp(confpp_obj)
5e9bef
     except ParsingError, e:
5e9bef
@@ -1076,7 +1081,7 @@ def readMainConfig(startupconf):
5e9bef
     # ' xemacs syntax hack
5e9bef
 
5e9bef
     # Set up substitution vars
5e9bef
-    yumvars = _getEnvVar()
5e9bef
+    yumvars = startupconf.yumvars
5e9bef
     yumvars['basearch'] = startupconf.basearch
5e9bef
     yumvars['arch'] = startupconf.arch
5e9bef
     yumvars['releasever'] = startupconf.releasever