diff options
author | Jeremy Katz <katzj@redhat.com> | 2006-07-18 02:30:53 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2006-07-18 02:30:53 +0000 |
commit | 9d409854150fb7c4ff7dc1ddf5a6d74b91b847ea (patch) | |
tree | 4a303ef5e284a33018a0df0ac5c8ae25119be444 /iw | |
parent | 9ba0ffafac530c5c74aabac04e8a53a35265d304 (diff) | |
download | anaconda-9d409854150fb7c4ff7dc1ddf5a6d74b91b847ea.tar.gz anaconda-9d409854150fb7c4ff7dc1ddf5a6d74b91b847ea.tar.xz anaconda-9d409854150fb7c4ff7dc1ddf5a6d74b91b847ea.zip |
2006-07-17 Jeremy Katz <katzj@redhat.com>
* yuminstall.py (AnacondaYum.doConfigSetup): Using metadata_expire
doesn't make sense for anaconda
(YumBackend.doRepoSetup): Allow setup of a single repo, reorganize
so that this works
* iw/task_gui.py (TaskWindow._addRepo): Support for adding repos.
* ui/tasksel.glade: Add button to bring up add repo dialopg
* ui/addrepo.glade: Initial pass at dialog for adding additional
repos.
Diffstat (limited to 'iw')
-rw-r--r-- | iw/task_gui.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/iw/task_gui.py b/iw/task_gui.py index ad4117c75..cf46f7338 100644 --- a/iw/task_gui.py +++ b/iw/task_gui.py @@ -16,6 +16,11 @@ from iw_gui import * from rhpl.translate import _, N_ from constants import productName +import network + +from yuminstall import AnacondaYumRepo +import yum.Errors + class TaskWindow(InstallWindow): def getNext(self): if self.xml.get_widget("customRadio").get_active(): @@ -51,10 +56,70 @@ class TaskWindow(InstallWindow): return False return True + def _addRepo(self, *args): + # FIXME: Need to bring up the network + if not network.hasActiveNetDev(): + self.intf.messageWindow("Need network", + "additional repos can only be configured " + "if you have a network available.", + custom_icon="error") + return gtk.RESPONSE_CANCEL + + (dxml, dialog) = gui.getGladeWidget("addrepo.glade", "addRepoDialog") + gui.addFrame(dialog) + dialog.show_all() + + while 1: + rc = dialog.run() + if rc == gtk.RESPONSE_CANCEL: + break + + reponame = dxml.get_widget("nameEntry").get_text() + reponame.strip() + if len(reponame) == 0: + self.intf.messageWindow(_("Invalid Repository Name"), + _("You must provide a non-zero length " + "repository name.")) + continue + + repourl = dxml.get_widget("urlEntry").get_text() + repourl.strip() + if (len(repourl) == 0 or not + (repourl.startswith("http://") or + repourl.startswith("ftp://"))): + self.intf.messageWindow(_("Invalid Repository URL"), + _("You must provide an HTTP or FTP " + "URL to a repository.")) + continue + + # FIXME: this is yum specific + repo = AnacondaYumRepo(uri=repourl, repoid=reponame) + repo.basecachedir = self.backend.ayum.conf.cachedir + repo.enable() + self.backend.ayum.repos.add(repo) + + try: + self.backend.doRepoSetup(self.anaconda, reponame, + fatalerrors = False) + except yum.Errors.RepoError, e: + self.intf.messageWindow(_("Error"), + _("Unable to read package metadata from repository. " + "This may be due to a missing repodata directory. " + "Please ensure that your repository has been " + "correctly generated.\n\n%s" %(e,)), + type="ok", custom_icon="error") + self.backend.ayum.repos.delete(reponame) + continue + break + + dialog.destroy() + return rc + def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend + self.anaconda = anaconda self.tasks = anaconda.id.instClass.tasks self.taskcbs = {} @@ -86,4 +151,6 @@ class TaskWindow(InstallWindow): self.xml.get_widget("mainLabel").hide() self.xml.get_widget("cbVBox").hide() + self.xml.get_widget("addRepoButton").connect("clicked", self._addRepo) + return vbox |