With present UI, edit repos, not base repos (methodstr). Works with assumption that base repo (repo/method) url points to a single repo, which is true for Fedora (as opposed to RHEL5 where we various repos in directories). dgregor told me that the target for RHEL6 is to have just one repo and handle product differentiation by comps. If we had to work with multirepo base urls, the UI for repo editing would need to be redesigned and rewritten because now we are mixing base urls with repo urls there. --- iw/task_gui.py | 62 ++++++++++++++++++++++++------------------------------- yuminstall.py | 22 ++++--------------- 2 files changed, 32 insertions(+), 52 deletions(-) diff --git a/iw/task_gui.py b/iw/task_gui.py index c297446..074d811 100644 --- a/iw/task_gui.py +++ b/iw/task_gui.py @@ -73,21 +73,6 @@ def setupRepo(anaconda, repo): return True -def setupBaseRepo(anaconda, methodstr): - anaconda.setMethodstr(methodstr) - - try: - anaconda.backend.ayum.configBaseURL() - except SystemError as e: - anaconda.intf.messageWindow(_("Error Setting Up Repository"), - _("The following error occurred while setting up the " - "installation repository:\n\n%s\n\nPlease provide the " - "correct information for installing %s") % (e, productName)) - return False - - anaconda.backend.ayum.configBaseRepo(replace=True) - return True - class RepoEditor: # Window-level callbacks def on_addRepoDialog_destroy(self, widget, *args): @@ -284,13 +269,12 @@ class RepoEditor: repo.name = self.nameEntry.get_text() - if repo.name == "Installation Repo": - return setupBaseRepo(self.anaconda, repourl) - return True def _applyMedia(self, repo): - cdr = scanForMedia(self.anaconda.backend.ayum.tree, self.anaconda.id.storage) + # FIXME works only if storage has detected format of cdrom drive + ayum = self.anaconda.backend.ayum + cdr = scanForMedia(ayum.tree, self.anaconda.id.storage) if not cdr: self.intf.messageWindow(_("No Media Found"), _("No installation media was found. " @@ -298,7 +282,17 @@ class RepoEditor: "and try again.")) return False - return setupBaseRepo(self.anaconda, "cdrom:%s" % (cdr,)) + log.info("found installation media on %s" % cdr) + repo.name = self.nameEntry.get_text() + repo.anacondabaseurls = ["cdrom:%s" % (cdr,)] + repo.baseurl = "file://%s" % ayum.tree + ayum.mediagrabber = ayum.mediaHandler + self.anaconda.mediaDevice = cdr + ayum.currentMedia = 1 + repo.mediaid = getMediaId(ayum.tree) + log.info("set mediaid of repo %s to: %s" % (repo.name, repo.mediaid)) + + return True def _applyNfs(self, repo): server = self.nfsServerEntry.get_text() @@ -314,23 +308,20 @@ class RepoEditor: _("Please enter an NFS server and path.")) return False - if repo.name == "Installation Repo": - return setupBaseRepo(self.anaconda, "nfs:%s:%s" % (server, path)) - else: - import tempfile - dest = tempfile.mkdtemp("", repo.name.replace(" ", ""), "/mnt") + import tempfile + dest = tempfile.mkdtemp("", repo.name.replace(" ", ""), "/mnt") - try: - isys.mount("%s:%s" % (server, path), dest, "nfs") - except Exception as e: - self.intf.messageWindow(_("Error Setting Up Repository"), - _("The following error occurred while setting up the " - "repository:\n\n%s") % e) - return False + try: + isys.mount("%s:%s" % (server, path), dest, "nfs") + except Exception as e: + self.intf.messageWindow(_("Error Setting Up Repository"), + _("The following error occurred while setting up the " + "repository:\n\n%s") % e) + return False - repo.baseurl = "file://%s" % dest - repo.anacondabaseurls = ["nfs:%s:%s" % (server,path)] - return True + repo.baseurl = "file://%s" % dest + repo.anacondabaseurls = ["nfs:%s:%s" % (server,path)] + return True def _applyHd(self, repo): return True @@ -360,6 +351,7 @@ class RepoEditor: # when adding newRepoObj = AnacondaYumRepo("UIedited_%s" % self.anaconda.backend.ayum.repoIDcounter.next()) + newRepoObj.cost = self.repo.cost removeOld = True else: newRepoObj = AnacondaYumRepo(reponame.replace(" ", "")) diff --git a/yuminstall.py b/yuminstall.py index 944436b..8c8d2ad 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -481,7 +481,7 @@ class AnacondaYum(YumSorter): # default to using whatever's enabled in /etc/yum.repos.d/ self._baseRepoURL = None - def configBaseRepo(self, root='/', replace=False): + def configBaseRepo(self, root='/'): # Create the "base" repo object, assuming there is one. Otherwise we # just skip all this and use the defaults from /etc/yum.repos.d. if not self._baseRepoURL: @@ -494,19 +494,9 @@ class AnacondaYum(YumSorter): for (name, uri) in self.anaconda.id.instClass.getPackagePaths(self._baseRepoURL).items(): rid = name.replace(" ", "") - if replace: - try: - repo = self.repos.getRepo("anaconda-%s-%s" % (rid, productStamp)) - repo.baseurl = uri - repo.anacondabaseurls = anacondabasepaths[name] - except RepoError: - replace = False - - # If there was an error finding the "base" repo, create a new one now. - if not replace: - repo = AnacondaYumRepo("anaconda-%s-%s" % (rid, productStamp)) - repo.baseurl = uri - repo.anacondabaseurls = anacondabasepaths[name] + repo = AnacondaYumRepo("anaconda-%s-%s" % (rid, productStamp)) + repo.baseurl = uri + repo.anacondabaseurls = anacondabasepaths[name] repo.name = name repo.cost = 100 @@ -516,9 +506,7 @@ class AnacondaYum(YumSorter): log.info("set mediaid of repo %s to: %s" % (rid, repo.mediaid)) repo.enable() - - if not replace: - self.repos.add(repo) + self.repos.add(repo) def mediaHandler(self, *args, **kwargs): mediaid = kwargs["mediaid"] -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list