* [gentoo-commits] proj/anaconda:master commit in: /, liveinst/, iw/
@ 2011-07-03 15:47 Wiktor W Brodlo
0 siblings, 0 replies; only message in thread
From: Wiktor W Brodlo @ 2011-07-03 15:47 UTC (permalink / raw
To: gentoo-commits
commit: 47d5a697d7036a01f2ff772c54b8bf7e54d455cb
Author: wiktor w brodlo <wiktor <AT> brodlo <DOT> net>
AuthorDate: Sun Jul 3 15:47:06 2011 +0000
Commit: Wiktor W Brodlo <wiktor <AT> brodlo <DOT> net>
CommitDate: Sun Jul 3 15:47:06 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/anaconda.git;a=commit;h=47d5a697
mirrorselect
---
dispatch.py | 3 +-
gui.py | 4 +-
iw/makeconf_gui.py | 50 ++++++++--------
iw/mirrorselect_gui.py | 159 ++++++++++++++++++++++++++++++++++++++++++++++++
liveinst/liveinst | 1 +
5 files changed, 190 insertions(+), 27 deletions(-)
diff --git a/dispatch.py b/dispatch.py
index 08cc685..073dc2c 100644
--- a/dispatch.py
+++ b/dispatch.py
@@ -96,7 +96,8 @@ installSteps = [
("makeconf", ),
# Installing the Gentoo Base System
- # mirrorselect
+ ("mirrorselect", ),
+ #("mirrorselect-sync", ),
# profile
# use
diff --git a/gui.py b/gui.py
index 2a8a62f..d6f3821 100755
--- a/gui.py
+++ b/gui.py
@@ -80,7 +80,9 @@ stepToClass = {
"makeconf" : ("makeconf_gui", "MakeconfWindow"),
# Installing the Gentoo Base System
-
+ ("mirrorselect", ),
+ #("mirrorselect-sync", ),
+
# Configuring the Kernel
"timezone" : ("timezone_gui", "TimezoneWindow"),
diff --git a/iw/makeconf_gui.py b/iw/makeconf_gui.py
index c8a77be..9792021 100644
--- a/iw/makeconf_gui.py
+++ b/iw/makeconf_gui.py
@@ -34,29 +34,29 @@ import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
class MakeconfWindow(InstallWindow):
- def getNext(self):
- self.anaconda.makeconf.march = self.march.get_active_text()
- self.anaconda.makeconf.opt = self.opt.get_active_text()
- self.anaconda.makeconf.pipe = self.pipe.get_active()
- self.anaconda.makeconf.jobs = self.jobs.get_value_as_int()
- self.anaconda.makeconf.load = self.load.get_value_as_int()
- self.anaconda.makeconf.silent = self.silent.get_active()
- return None
-
- def getScreen(self, anaconda):
- self.anaconda = anaconda
- self.intf = anaconda.intf
-
- (self.xml, self.align) = gui.getGladeWidget("makeconf.glade", "makeconf_align")
-
- self.march = self.xml.get_widget("march")
- self.opt = self.xml.get_widget("opt")
- self.pipe = self.xml.get_widget("pipe")
- self.jobs = self.xml.get_widget("jobs")
- self.load = self.xml.get_widget("load")
- self.silent = self.xml.get_widget("silent")
-
- # TODO: Get a list of arches available for this installation.
-
- return self.align
+ def getNext(self):
+ self.anaconda.makeconf.march = self.march.get_active_text()
+ self.anaconda.makeconf.opt = self.opt.get_active_text()
+ self.anaconda.makeconf.pipe = self.pipe.get_active()
+ self.anaconda.makeconf.jobs = self.jobs.get_value_as_int()
+ self.anaconda.makeconf.load = self.load.get_value_as_int()
+ self.anaconda.makeconf.silent = self.silent.get_active()
+ return None
+
+ def getScreen(self, anaconda):
+ self.anaconda = anaconda
+ self.intf = anaconda.intf
+
+ (self.xml, self.align) = gui.getGladeWidget("makeconf.glade", "makeconf_align")
+
+ self.march = self.xml.get_widget("march")
+ self.opt = self.xml.get_widget("opt")
+ self.pipe = self.xml.get_widget("pipe")
+ self.jobs = self.xml.get_widget("jobs")
+ self.load = self.xml.get_widget("load")
+ self.silent = self.xml.get_widget("silent")
+
+ # TODO: Get a list of arches available for this installation.
+
+ return self.align
diff --git a/iw/mirrorselect_gui.py b/iw/mirrorselect_gui.py
new file mode 100644
index 0000000..564c433
--- /dev/null
+++ b/iw/mirrorselect_gui.py
@@ -0,0 +1,159 @@
+#
+# mirrorselect_gui.py: gui mirrorselect.
+#
+# Copyright (C) 2011 wiktor w brodlo
+# Copyright (C) 2011 Gentoo Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import string
+import gtk
+import gtk.glade
+import gtk.gdk
+import gobject
+import pango
+import sys
+import gui
+import os
+from mirrorselect.mirrorparser3 import MirrorParser3
+
+from iw_gui import *
+
+from constants import *
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
+class MirrorselectWindow(InstallWindow):
+ def getNext(self):
+ self.anaconda.makeconf.march = self.march.get_active_text()
+ self.anaconda.makeconf.opt = self.opt.get_active_text()
+ self.anaconda.makeconf.pipe = self.pipe.get_active()
+ self.anaconda.makeconf.jobs = self.jobs.get_value_as_int()
+ self.anaconda.makeconf.load = self.load.get_value_as_int()
+ self.anaconda.makeconf.silent = self.silent.get_active()
+ return None
+
+ def getScreen(self, anaconda):
+ self.anaconda = anaconda
+ self.intf = anaconda.intf
+
+ (self.xml, self.align) = gui.getGladeWidget("mirrorselect.glade", "mirrorselect_align")
+
+ mirrorsf = None
+
+ while mirrorsf == None:
+ # Try downloading the mirrorlist
+ mirrorsf = self.downloadMirrorlist()
+ # if failed,
+ if mirrorsf == None:
+ md = gtk.MessageDialog(buttons=gtk.BUTTONS_YES_NO)
+ md.set_property("title", _("Failed to download mirrorlist"))
+ md.set_property("text", _("Failed to download the mirror list. Would you like to try again?\nPressing 'No' will abort the installation."))
+ if md.run() == gtk.RESPONSE_NO:
+ md.destroy()
+ InstallControlWindow._doExit([])
+
+ self.xml.get_widget("downloading").destroy()
+
+ mirrors_parsed = self.parseMirrors(mirrorsf)
+ self.mirrors = self.mirrorList(mirrors_parsed, proto)
+
+ self.table = self.xml.get_widget("mirrors_table")
+
+ addMirrors(self.table, self.mirrors, mirrors_parsed)
+
+ return self.align
+
+ def addMirrors(self, table, mirror_list, mirror_data):
+ (regions, countries, mirrors) = mirror_list
+
+ for region in regions:
+ for country in countries:
+ for mirror in mirrors:
+ addMirrorRow(table, region, country, mirror, mirror_data[region][country][mirror])
+
+ def addMirrorRow(self, table, region, country, mirror, data):
+ cols = table.get_property("n-columns")
+ rows = table.get_property("n-rows")
+ table.resize(rows+1, cols)
+
+ cb = gtk.CheckButton(label=data["url"], use_underline=False)
+ name = gtk.Label("%s: %s\n%n" % (region, country, mirror))
+
+ flags_text = data["proto"]
+ if data["ipv4"] == "y":
+ flags_text += " ipv4"
+ if data["ipv6"] == "y":
+ flags_text += " ipv6"
+ flags = gtk.Label(flags_text)
+
+ table.attach(cb, 0, 1, rows, rows+1)
+ table.attach(cb, 1, 2, rows, rows+1)
+ table.attach(cb, 2, 3, rows, rows+1)
+
+ def downloadMirrorlist(self):
+ try:
+ os.system("wget -nc -O /tmp/mirror3.xml %s" % os.environ["PORTAGE_MIRRORLIST_URL"])
+ f = open("/tmp/mirror3.xml")
+ except:
+ return None
+ return f
+
+ def parseMirrors(self, mirrorlist):
+ xml = mirrorlist.read()
+ parser = MirrorParser3()
+ parser.parse(xml)
+ tuples = parser.tuples()
+
+ mirrors = {}
+ for mirror in tuples:
+ if mirror[1]["region"] not in mirrors:
+ mirrors[mirror[1]["region"]] = {}
+ if mirror[1]["country"] not in mirrors[mirror[1]["region"]]:
+ mirrors[mirror[1]["region"]][mirror[1]["country"]] = {}
+ mirrors[mirror[1]["region"]][mirror[1]["country"]]["%s (%s)" % (mirror[1]["name"], mirror[1]["proto"])] = \
+ {"url": mirror[0],
+ "name": mirror[1]["name"],
+ "proto": mirror[1]["proto"],
+ "ipv4": mirror[1]["ipv4"],
+ "ipv6": mirror[1]["ipv6"]}
+
+ return mirrors
+
+ def mirrorList(self, mirrors_parsed, proto):
+ region_list = mirrors_parsed.keys()
+ region_list.sort()
+ countries = {}
+ mirrors = {}
+ mirrors_proto = {}
+ for region in region_list:
+ countries[region] = mirrors_parsed[region].keys()
+ countries[region].sort()
+ for country in countries[region]:
+ mirrors[country] = mirrors_parsed[region][country].keys()
+ mirrors[country].sort()
+ mirrors_proto[country] = []
+ for mirror in mirrors[country]:
+ if proto == "http+ftp":
+ if mirrors_parsed[region][country][mirror]["proto"] == "http":
+ mirrors_proto[country].append(mirror)
+ if mirrors_parsed[region][country][mirror]["proto"] == "ftp":
+ mirrors_proto[country].append(mirror)
+ if mirrors_parsed[region][country][mirror]["proto"] == proto:
+ mirrors_proto[country].append(mirror)
+ mirrors_proto[country].sort()
+
+ return (region_list, countries, mirrors_proto)
+
diff --git a/liveinst/liveinst b/liveinst/liveinst
index 9565af4..aa729ba 100755
--- a/liveinst/liveinst
+++ b/liveinst/liveinst
@@ -41,6 +41,7 @@ export ANACONDA_CHROOTPATH="/mnt/sysimage/.//" # that's a BUG!
export ANACONDA_PRODUCTARCH="$(cat /etc/livedvd-release | cut -d' ' -f 3)"
export ANACONDA_BUGURL="http://bugs.gentoo.org"
export PIXMAPPATH="/usr/share/anaconda/pixmaps"
+export PORTAGE_MIRRORLIST_URL="http://www.gentoo.org/main/en/mirrors3.xml"
function kill_mounts() {
# devkit-disks is now mounting lots of stuff. for now, let's just try to unmount it all
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-07-03 19:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-03 15:47 [gentoo-commits] proj/anaconda:master commit in: /, liveinst/, iw/ Wiktor W Brodlo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox