diff options
author | Radek Vykydal <rvykydal@redhat.com> | 2009-10-13 15:06:25 +0200 |
---|---|---|
committer | Radek Vykydal <rvykydal@redhat.com> | 2009-10-13 15:06:25 +0200 |
commit | 592b83491b8f20a6e6126a85c9b399339f1cac57 (patch) | |
tree | a2e3e6987faadbd0e566de03db3aad66956fb888 | |
parent | 50360845ff5f62bfdab6471024d6f615c3b86ec5 (diff) | |
download | anaconda-592b83491b8f20a6e6126a85c9b399339f1cac57.tar.gz anaconda-592b83491b8f20a6e6126a85c9b399339f1cac57.tar.xz anaconda-592b83491b8f20a6e6126a85c9b399339f1cac57.zip |
Store methodstr url of repo (#502208, #526022).
We need it for repo editing or correction of repo= arguments in UI, especially
in case of nfs: or cdrom: which can't be stored in AnacondaYum.baseurl.
-rw-r--r-- | iw/task_gui.py | 25 | ||||
-rw-r--r-- | yuminstall.py | 19 |
2 files changed, 33 insertions, 11 deletions
diff --git a/iw/task_gui.py b/iw/task_gui.py index 198912d55..cb9400400 100644 --- a/iw/task_gui.py +++ b/iw/task_gui.py @@ -194,17 +194,18 @@ class RepoEditor: if self.repo: self.nameEntry.set_text(self.repo.name) - self.typeComboBox.set_active(self._methodToIndex(self.anaconda.methodstr)) + if self.repo.anacondaBaseURLs: + url = self.repo.anacondaBaseURLs[0] + else: + url = '' + self.typeComboBox.set_active(self._methodToIndex(url)) - if not self.anaconda.methodstr or self.anaconda.methodstr.startswith("http") or self.anaconda.methodstr.startswith("ftp"): + if not url or url.startswith("http") or url.startswith("ftp"): if self.repo.mirrorlist: self.baseurlEntry.set_text(self.repo.mirrorlist) self.mirrorlistCheckbox.set_active(True) else: - if self.repo.baseurl: - self.baseurlEntry.set_text(self.repo.baseurl[0]) - else: - self.baseurlEntry.set_text("") + self.baseurlEntry.set_text(url) self.mirrorlistCheckbox.set_active(False) @@ -217,18 +218,18 @@ class RepoEditor: else: self.proxyCheckbox.set_active(False) self.proxyTable.set_sensitive(False) - elif self.anaconda.methodstr.startswith("nfs:"): - method_server_dir = self.anaconda.methodstr.split(":") + elif url.startswith("nfs"): + method_server_dir = url.split(":") try: self.nfsServerEntry.set_text(method_server_dir[1]) self.nfsPathEntry.set_text(method_server_dir[2]) except IndexError: pass self.nfsOptionsEntry.set_text("") - elif self.anaconda.methodstr.startswith("cdrom:"): + elif url.startswith("cdrom:"): pass - elif self.anaconda.methodstr.startswith("hd:"): - m = self.anaconda.methodstr[3:] + elif url.startswith("hd:"): + m = url[3:] if m.count(":") == 1: (device, path) = m.split(":") fstype = "auto" @@ -279,6 +280,7 @@ class RepoEditor: else: repo.baseurl = [repourl] repo.mirrorlist = None + repo.anacondaBaseURLs = repo.baseurl repo.name = self.nameEntry.get_text() @@ -327,6 +329,7 @@ class RepoEditor: return False repo.baseurl = "file://%s" % dest + repo.anacondaBaseURLs = ["nfs:%s:%s" % (server,path)] return True def _applyHd(self, repo): diff --git a/yuminstall.py b/yuminstall.py index 5c81e2a48..e2cf98cd5 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -243,6 +243,7 @@ class AnacondaYumRepo(YumRepository): def __init__(self, *args, **kwargs): YumRepository.__init__(self, *args, **kwargs) self.enablegroups = True + self._anacondaBaseURLs = [] def needsNetwork(self): def _isURL(s): @@ -267,6 +268,16 @@ class AnacondaYumRepo(YumRepository): if os.path.exists("%s/packages" % cachedir): shutil.rmtree("%s/packages" % cachedir) + # needed to store nfs: repo url that yum doesn't know + def _getAnacondaBaseURLs(self): + return self._anacondaBaseURLs or self.baseurl or [self.mirrorlist] + + def _setAnacondaBaseURLs(self, value): + self._anacondaBaseURLs = value + + anacondaBaseURLs = property(_getAnacondaBaseURLs, _setAnacondaBaseURLs, + doc="Extends AnacondaYum.baseurl to store non-yum urls:") + class YumSorter(yum.YumBase): def _transactionDataFactory(self): return SplitMediaTransactionData() @@ -476,6 +487,9 @@ class AnacondaYum(YumSorter): return # add default repos + anacondabaseurl = (self.anaconda.methodstr or + "cdrom:%s" % (self.anaconda.mediaDevice)) + anacondabasepaths = self.anaconda.id.instClass.getPackagePaths(anacondabaseurl) for (name, uri) in self.anaconda.id.instClass.getPackagePaths(self._baseRepoURL).items(): rid = name.replace(" ", "") @@ -483,6 +497,7 @@ class AnacondaYum(YumSorter): try: repo = self.repos.getRepo("anaconda-%s-%s" % (rid, productStamp)) repo.baseurl = uri + repo.anacondaBaseURLs = anacondabasepaths[name] except RepoError: replace = False @@ -490,6 +505,7 @@ class AnacondaYum(YumSorter): if not replace: repo = AnacondaYumRepo("anaconda-%s-%s" % (rid, productStamp)) repo.baseurl = uri + repo.anacondaBaseURLs = anacondabasepaths[name] repo.name = name repo.cost = 100 @@ -650,6 +666,7 @@ class AnacondaYum(YumSorter): # yum doesn't understand nfs:// and doesn't want to. We need # to first do the mount, then translate it into a file:// that # yum does understand. + anacondaBaseURLs = [] if ksrepo.baseurl and ksrepo.baseurl.startswith("nfs://"): if not network.hasActiveNetDev() and not self.anaconda.intf.enableNetwork(): self.anaconda.intf.messageWindow(_("No Network Available"), @@ -667,6 +684,7 @@ class AnacondaYum(YumSorter): except Exception as e: log.error("error mounting NFS repo: %s" % e) + anacondaBaseURLs = [ksrepo.baseurl] ksrepo.baseurl = "file://%s" % dest repo = AnacondaYumRepo(ksrepo.name) @@ -677,6 +695,7 @@ class AnacondaYum(YumSorter): repo.baseurl = [] else: repo.baseurl = [ ksrepo.baseurl ] + repo.anacondaBaseURLs = anacondaBaseURLs if ksrepo.cost: repo.cost = ksrepo.cost |