summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Vykydal <rvykydal@redhat.com>2009-10-13 15:08:45 +0200
committerRadek Vykydal <rvykydal@redhat.com>2009-10-13 15:08:45 +0200
commite3e679568d3b1b6dba88007ec7c30bd4d44283cf (patch)
tree5050e5fd4c4e51589d9a4b8534c9613808ce35ec
parentc685457b4598818ef105b3de1e1a9be670412e00 (diff)
downloadanaconda-e3e679568d3b1b6dba88007ec7c30bd4d44283cf.tar.gz
anaconda-e3e679568d3b1b6dba88007ec7c30bd4d44283cf.tar.xz
anaconda-e3e679568d3b1b6dba88007ec7c30bd4d44283cf.zip
Handle Installation Repo (base repo) as any other in repo edit UI.
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.
-rw-r--r--iw/task_gui.py62
-rw-r--r--yuminstall.py22
2 files changed, 32 insertions, 52 deletions
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 29966528f..ae871790a 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:%s" % (cdr, self.anaconda.backend.ayum.tree))
+ log.info("found installation media on %s" % cdr)
+ repo.name = self.nameEntry.get_text()
+ repo.anacondaBaseURLs = ["cdrom://%s:%s" % (cdr, self.anaconda.backend.ayum.tree)]
+ 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 26efd5433..1c54318fa 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -480,7 +480,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:
@@ -493,19 +493,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
@@ -515,9 +505,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"]