summaryrefslogtreecommitdiffstats
path: root/yuminstall.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-09-04 11:59:16 -0400
committerChris Lumens <clumens@redhat.com>2009-09-30 11:59:17 -0400
commitb0aaa0f1b4a51b76c68953838004d1fa6dbf0d40 (patch)
tree02c32f35f76c37d4fe8d66401d0ee95a78bfecc6 /yuminstall.py
parentd8670a7400b2aa737fb35a441895ba19192b09a8 (diff)
downloadanaconda-b0aaa0f1b4a51b76c68953838004d1fa6dbf0d40.tar.gz
anaconda-b0aaa0f1b4a51b76c68953838004d1fa6dbf0d40.tar.xz
anaconda-b0aaa0f1b4a51b76c68953838004d1fa6dbf0d40.zip
Add repo --proxy= support to kickstart.
This parameter has the same format that url --proxy= does in loader. In fact, we use the same regular expression in both places. Be sure to change both if you change one.
Diffstat (limited to 'yuminstall.py')
-rw-r--r--yuminstall.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/yuminstall.py b/yuminstall.py
index f86de3694..bad27e5a0 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -31,6 +31,7 @@ import locale
import glob
import tempfile
import itertools
+import re
import rpm
import rpmUtils
@@ -644,6 +645,9 @@ class AnacondaYum(YumSorter):
extraRepos.append(repo)
if self.anaconda.isKickstart:
+ # This is the same pattern as from loader/urls.c:splitProxyParam.
+ pattern = re.compile("([[:alpha:]]+://)?(([[:alnum:]]+)(:[^:@]+)?@)?([^:]+)(:[[:digit:]]+)?(/.*)?")
+
for ksrepo in self.anaconda.id.ksdata.repo.repoList:
# yum doesn't understand nfs:// and doesn't want to. We need
# to first do the mount, then translate it into a file:// that
@@ -685,6 +689,25 @@ class AnacondaYum(YumSorter):
if ksrepo.includepkgs:
repo.include = ksrepo.includepkgs
+ if ksrepo.proxy:
+ m = pattern.match(ksrepo.proxy)
+
+ if m and m.group(3):
+ # If both a host and port was found, just paste them
+ # together using the colon at the beginning of the port
+ # match as a separator. Otherwise, just use the host.
+ if m.group(4):
+ repo.proxy = m.group(3) + m.group(4)
+ else:
+ reop.proxy = m.group(3)
+
+ if m and m.group(5):
+ repo.proxy_username = m.group(5)
+
+ if m and m.group(6):
+ # Skip the leading colon.
+ repo.proxy_password = m.group(6)[1:]
+
repo.enable()
extraRepos.append(repo)
@@ -1524,7 +1547,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
def _checkUpgradeArch(self, anaconda):
def compareArch(a, b):
- import re
if re.match("i.86", a) and re.match("i.86", b):
return True
else: