summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.glade76
-rw-r--r--DistUpgrade/DistUpgrade.py104
2 files changed, 180 insertions, 0 deletions
diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade
new file mode 100644
index 00000000..bdd11f5d
--- /dev/null
+++ b/DistUpgrade/DistUpgrade.glade
@@ -0,0 +1,76 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window_main">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Upgrade distribution</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label_status">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Upgrading&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkProgressBar" id="progressbar_cache">
+ <property name="visible">True</property>
+ <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+ <property name="fraction">0</property>
+ <property name="pulse_step">0.10000000149</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/DistUpgrade/DistUpgrade.py b/DistUpgrade/DistUpgrade.py
new file mode 100644
index 00000000..0c6e9202
--- /dev/null
+++ b/DistUpgrade/DistUpgrade.py
@@ -0,0 +1,104 @@
+#!/usr/bin/python2.4
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gtk.gdk
+import gtk.glade
+
+import apt
+from UpdateManager.Common.SimpleGladeApp import SimpleGladeApp
+from UpdateManager.GtkProgress import GtkOpProgress
+from SoftwareProperties.aptsources import SourcesList, SourceEntry
+from gettext import gettext as _
+
+class DistUpgradeProgress(object):
+ pass
+
+
+class DistUpgradeView(object):
+ " abstraction for the upgrade view "
+ def __init__(self):
+ pass
+ def getOpCacheProgress(self):
+ " return a OpProgress() subclass for the given graphic"
+ return apt.progress.OpProgress()
+ def updateStatus(self, msg):
+ """ update the current status of the distUpgrade based
+ on the current view
+ """
+ pass
+ def askYesNoQuestion(self,msg):
+ pass
+
+class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
+ " gtk frontend of the distUpgrade tool "
+ def __init__(self):
+ # FIXME: i18n must be somewhere relative do this dir
+ SimpleGladeApp.__init__(self, "DistUpgrade.glade",
+ None, domain="update-manager")
+ self._opCacheProgress = GtkOpProgress(self.progressbar_cache)
+ def getOpCacheProgress(self):
+ return self._opCacheProgress
+ def updateStatus(self, msg):
+ self.label_status = "<b>%s</b>" % msg
+
+class DistUpgradeControler(object):
+ def __init__(self, distUpgradeView):
+ self._view = distUpgradeView
+
+ def sanityCheck(self):
+ pass
+
+ def updateSourcesList(self, fromDist, to):
+ sources = SourcesList()
+ sources.backup()
+ for entry in sources:
+ # check if it's a mirror (or offical site)
+ if sources.is_mirror(entry.uri, "archive.ubuntu.com"):
+ if entry.dist == fromDist:
+ entry.dist = to
+ else:
+ # disable all entries that are official but don't
+ # point to the "from" dist
+ entry.disabled = True
+ else:
+ # disable non-official entries that point to dist
+ if entry.dist == fromDist:
+ entry.disabled = True
+ sources.save()
+
+ def breezyUpgrade(self):
+ # sanity check (check for ubuntu-desktop, brokenCache etc)
+ self._view.updateStatus(_("Checking the system"))
+ self.sanityCheck()
+
+ # update sources.list
+ self._view.updateStatus(_("Updating repository information"))
+ self.updateSourcesList(fromDist="hoary",to="breezy")
+
+ # then update the package index files
+
+
+ # then open the cache
+ self._view.updateStatus(_("Reading cache"))
+ self._cache = apt.Cache(self._view.getOpCacheProgress())
+
+ # do pre-upgrade stuff
+
+ # calc the dist-upgrade and see if the removals are ok/expected
+
+ # do the dist-upgrade
+
+ # do post-upgrade stuff
+
+ # done, ask for reboot
+
+ def run(self):
+ self.breezyUpgrade()
+
+
+if __name__ == "__main__":
+ view = GtkDistUpgradeView()
+ app = DistUpgradeControler(view)
+ app.run()