diff options
author | Paul Nasrat <pnasrat@redhat.com> | 2005-11-14 18:52:17 +0000 |
---|---|---|
committer | Paul Nasrat <pnasrat@redhat.com> | 2005-11-14 18:52:17 +0000 |
commit | 14f89f548a2b1619dc3368c9c2d8c91105334957 (patch) | |
tree | 8b81dfa94c4e15b4e00ed6711b7a0a581436af92 /yuminstall.py | |
parent | b05396c48b943ba854f45945b880c67ef3ddd4af (diff) | |
download | anaconda-14f89f548a2b1619dc3368c9c2d8c91105334957.tar.gz anaconda-14f89f548a2b1619dc3368c9c2d8c91105334957.tar.xz anaconda-14f89f548a2b1619dc3368c9c2d8c91105334957.zip |
Stub split media yum class
Diffstat (limited to 'yuminstall.py')
-rw-r--r-- | yuminstall.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/yuminstall.py b/yuminstall.py index 530d9d1d1..caecf0296 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -34,6 +34,10 @@ from rhpl.translate import _ import logging log = logging.getLogger("anaconda") +import urlparse +urlparse.uses_fragment.append('media') + + import iutil import isys @@ -273,6 +277,36 @@ class AnacondaYum(yum.YumBase): pkgs = returnBestPackages(t) return map(lambda x: self.getPackageObject(x), pkgs) +class AnacondaYumMedia(AnacondaYum): + def __init__(self, fn="/etc/yum.conf", root="/"): + AnacondaYum.__init__(self, fn=fn, root=root) + + def _getcd(self, po): + try: + uri = po.returnSimple('basepath'): + (scheme, netloc, path, query, fragid) = urlparse.urlsplit(url) + if scheme != "media" or not fragid: + return 0 + else: + return fragid + except KeyError: + return 0 + + def downloadHeader(self, po): + h = YumHeader(po) + hdrpath = po.localHdr() + cd = self._getcd(po) +#XXX: Hack, make yum pass around po in callback so we don't have to do this + if cd > 0: + pkgpath = po.returnSimple('relativepath') + pkgname = os.path.basename(pkgpath) + h.addTag(1000000, RPM_STRING, pkgname) + h.addTag(1000002, RPM_INT32, cd) + f = open(hdrpath, 'w') + f.write(h.str()) + f.close() + del(h) + class YumBackend(AnacondaBackend): def __init__(self, methodstr, method, instPath): AnacondaBackend.__init__(self, methodstr, method, instPath) |