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