summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.glade348
-rw-r--r--DistUpgrade/DistUpgradeCache.py1
-rw-r--r--DistUpgrade/DistUpgradeControler.py28
-rw-r--r--DistUpgrade/DistUpgradeView.py8
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py118
-rw-r--r--DistUpgrade/TODO8
-rwxr-xr-xDistUpgrade/build-dist.sh53
7 files changed, 534 insertions, 30 deletions
diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade
index e50476e2..f6a8041d 100644
--- a/DistUpgrade/DistUpgrade.glade
+++ b/DistUpgrade/DistUpgrade.glade
@@ -38,7 +38,7 @@
<child>
<widget class="GtkLabel" id="label_title">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;x-large&quot;&gt;Upgrading to Ubuntu &quot;Dapper&quot; 6.04&lt;/span&gt;</property>
+ <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;x-large&quot;&gt;Upgrading to Ubuntu &quot;Dapper&quot; 6.06&lt;/span&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -520,7 +520,7 @@
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
- <widget class="GtkButton" id="button_cancel">
+ <widget class="GtkButton" id="button_cancel_changes">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@@ -533,7 +533,7 @@
</child>
<child>
- <widget class="GtkButton" id="button_start">
+ <widget class="GtkButton" id="button_confirm_changes">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@@ -1441,4 +1441,346 @@ The system could be in an unusable state if you cancel the upgrade. You are stro
</child>
</widget>
+<widget class="GtkDialog" id="dialog_conffile">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="modal">True</property>
+ <property name="resizable">False</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_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="hbuttonbox6">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button9">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-9</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox13">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="stock">gtk-cancel</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label30">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Keep</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</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>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button10">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-8</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox14">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image11">
+ <property name="visible">True</property>
+ <property name="stock">gtk-ok</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label31">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Replace</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</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>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox15">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkImage" id="image12">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox13">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label_conffile">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">True</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>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkExpander" id="expander3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox14">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTextView" id="textview_conffile">
+ <property name="height_request">300</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="overwrite">False</property>
+ <property name="accepts_tab">True</property>
+ <property name="justification">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap_mode">GTK_WRAP_NONE</property>
+ <property name="cursor_visible">False</property>
+ <property name="pixels_above_lines">0</property>
+ <property name="pixels_below_lines">0</property>
+ <property name="pixels_inside_wrap">0</property>
+ <property name="left_margin">0</property>
+ <property name="right_margin">0</property>
+ <property name="indent">0</property>
+ <property name="text" translatable="yes"></property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Difference between the files</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</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="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py
index 1711ef1b..2adab2ad 100644
--- a/DistUpgrade/DistUpgradeCache.py
+++ b/DistUpgrade/DistUpgradeCache.py
@@ -157,6 +157,7 @@ class MyCache(apt.Cache):
origins = pkg.candidateOrigin
trusted = False
for origin in origins:
+ #print origin
trusted |= origin.trusted
if not trusted:
untrusted.append(pkg.name)
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 6dcc0e2a..6ee2fb97 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -58,7 +58,6 @@ class DistUpgradeControler(object):
def updateSourcesList(self):
- self.sources = SourcesList()
# this must map, i.e. second in "from" must be the second in "to"
# (but they can be different, so in theory we could exchange
@@ -157,7 +156,7 @@ class DistUpgradeControler(object):
# FIXME: retry here too? just like the DoDistUpgrade?
# also remove all files from the lists partial dir!
currentRetry = 0
- maxRetries = self.config.get("Network","MaxRetries")
+ maxRetries = int(self.config.get("Network","MaxRetries"))
while currentRetry < maxRetries:
try:
res = self.cache.update(progress)
@@ -183,7 +182,7 @@ class DistUpgradeControler(object):
# log the changes for debuging
self._logChanges()
# ask the user if he wants to do the changes
- archivedir = apt_pkg.Config.FindDir("Dir::Cache::archives ")
+ archivedir = apt_pkg.Config.FindDir("Dir::Cache::archives")
st = os.statvfs(archivedir)
free = st[statvfs.F_BAVAIL]*st[statvfs.F_FRSIZE]
if self.cache.requiredDownload > free:
@@ -205,7 +204,7 @@ class DistUpgradeControler(object):
fprogress = self._view.getFetchProgress()
iprogress = self._view.getInstallProgress()
# retry the fetching in case of errors
- maxRetries = self.config.get("Network","MaxRetries")
+ maxRetries = int(self.config.get("Network","MaxRetries"))
while currentRetry < maxRetries:
try:
res = self.cache.commit(fprogress,iprogress)
@@ -213,9 +212,10 @@ class DistUpgradeControler(object):
# installing the packages failed, can't be retried
self._view.error(_("Could not install the upgrades"),
_("The upgrade aborts now. Your system "
- "can be in an unusable state. Please "
- "try 'sudo apt-get install -f' or Synaptic "
- "to fix your system."), "%s" % e)
+ "can be in an unusable state. A recovery "
+ "is now run (dpkg --configure -a)."),
+ "%s" % e)
+ self._view.getTerminal().call(["dpkg","--configure","-a"])
return False
except IOError, e:
# fetch failed, will be retried
@@ -270,9 +270,12 @@ class DistUpgradeControler(object):
# get changes
changes = self.cache.getChanges()
logging.debug("The following packages are remove candidates: %s" % " ".join([pkg.name for pkg in changes]))
+ summary = _("Remove obsolete packages?")
+ actions = [_("_Skip This Step"), _("_Remove")]
+ # FIXME Add an explanation about what obsolete pacages are
+ #explanation = _("")
if len(changes) > 0 and \
- self._view.confirmChanges(_("Remove obsolete Packages?"),
- changes, 0):
+ self._view.confirmChanges(summary, changes, 0, actions):
fprogress = self._view.getFetchProgress()
iprogress = self._view.getInstallProgress()
try:
@@ -295,13 +298,16 @@ class DistUpgradeControler(object):
# sanity check (check for ubuntu-desktop, brokenCache etc)
self._view.updateStatus(_("Checking package manager"))
self._view.setStep(1)
+
self.openCache()
-
+ self.sources = SourcesList()
+
if not self.cache.sanityCheck(self._view):
abort(1)
# run a "apt-get update" now
- self.doUpdate()
+ if not self.doUpdate():
+ self.abort()
# do pre-upgrade stuff (calc list of obsolete pkgs etc)
self.doPreUpdate()
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index 8e9a3d3f..02894939 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -19,6 +19,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+class DumbTerminal(object):
+ def run(self, cmd):
+ " expects a command in the subprocess style (as a list) "
+ subprocess.call(cmd)
+
+
class DistUpgradeView(object):
" abstraction for the upgrade view "
def __init__(self):
@@ -32,6 +38,8 @@ class DistUpgradeView(object):
def getInstallProgress(self):
" return a install progress object "
return apt.progress.InstallProgress()
+ def getTerminal(self):
+ return DumbTerminal()
def updateStatus(self, msg):
""" update the current status of the distUpgrade based
on the current view
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index 2f7e3fed..d8c55763 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -30,6 +30,7 @@ import pango
import sys
import logging
import time
+import subprocess
import apt
import apt_pkg
@@ -106,7 +107,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
self.status.set_text(_("Downloading file %li of %li at %s/s" % (currentItem, self.totalItems, apt_pkg.SizeToStr(self.currentCPS))))
self.progress.set_text(_("%s remaining" % apt_pkg.TimeToStr(self.eta)))
else:
- self.status.set_text(_("Downloading file %li of %li at unknown speed" % (currentItem, self.totalItems)))
+ self.status.set_text(_("Downloading file %li of %li" % (currentItem, self.totalItems)))
self.progress.set_text(" ")
while gtk.events_pending():
@@ -114,6 +115,10 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
return True
class GtkInstallProgressAdapter(InstallProgress):
+ # timeout with no status change when the terminal is expanded
+ # automatically
+ TIMEOUT_TERMINAL_ACTIVITY = 120
+
def __init__(self,parent):
InstallProgress.__init__(self)
self.label_status = parent.label_status
@@ -132,7 +137,7 @@ class GtkInstallProgressAdapter(InstallProgress):
# FIXME: add support for the timeout
# of the terminal (to display something useful then)
# -> longer term, move this code into python-apt
- self.label_status.set_text(_("Installing updates"))
+ self.label_status.set_text(_("Applying changes"))
self.progress.set_fraction(0.0)
self.progress.set_text(" ")
self.expander.set_sensitive(True)
@@ -140,7 +145,11 @@ class GtkInstallProgressAdapter(InstallProgress):
self.env = ["VTE_PTY_KEEP_FD=%s"% self.writefd,
"DEBIAN_FRONTEND=gnome",
"APT_LISTCHANGES_FRONTEND=none"]
-
+ # do a bit of time-keeping
+ self.start_time = 0.0
+ self.time_ui = 0.0
+ self.last_activity = 0.0
+
def error(self, pkg, errormsg):
logging.error("got an error from dpkg for pkg: '%s': '%s'" % (pkg, errormsg))
#self.expander_terminal.set_expanded(True)
@@ -158,11 +167,56 @@ class GtkInstallProgressAdapter(InstallProgress):
def conffile(self, current, new):
logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current)
- self.expander.set_expanded(True)
+ #self.expander.set_expanded(True)
+ prim = _("Replace configuration file\n'%s'?" % current)
+ sec = ("The configuration file %s was modified (by "
+ "you or by a script). An updated version is shipped "
+ "in this package. If you want to keep your current "
+ "version say 'Keep'. Do you want to replace the "
+ "current file and install the new package "
+ "maintainers version? " % current)
+ markup = "<span weight=\"bold\" size=\"larger\">%s </span> \n\n%s" % (prim, sec)
+ self.parent.label_conffile.set_markup(markup)
+ self.parent.dialog_conffile.set_transient_for(self.parent.window_main)
+
+ # now get the diff
+ if os.path.exists("/usr/bin/diff"):
+ cmd = ["/usr/bin/diff", "-u", current, new]
+ diff = utf8(subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0])
+ self.parent.textview_conffile.get_buffer().set_text(diff)
+ else:
+ self.parent.textview_conffile.get_buffer().set_text(_("The 'diff' command was not found"))
+ res = self.parent.dialog_conffile.run()
+ self.parent.dialog_conffile.hide()
+ # if replace, send this to the terminal
+ if res == gtk.RESPONSE_YES:
+ self.term.feed_child("y\n")
+ else:
+ self.term.feed_child("n\n")
+
def fork(self):
pid = self.term.forkpty(envv=self.env)
return pid
+ def statusChange(self, pkg, percent, status):
+ # start the timer when the first package changes its status
+ if self.start_time == 0.0:
+ #print "setting start time to %s" % self.start_time
+ self.start_time = time.time()
+ self.progress.set_fraction(float(self.percent)/100.0)
+ self.label_status.set_text(status.strip())
+ # start showing when we gathered some data
+ if percent > 1.0:
+ self.last_activity = time.time()
+ delta = self.last_activity - self.start_time
+ time_per_percent = (float(delta)/percent)
+ eta = (100.0 - self.percent) * time_per_percent
+ # only show if we have some sensible data
+ if eta > 1.0 and eta < (60*60*24*2):
+ self.progress.set_text(_("%s remaining")%apt_pkg.TimeToStr(eta))
+ else:
+ self.progress.set_text(" ")
+
def child_exited(self, term, pid, status):
self.apt_status = os.WEXITSTATUS(status)
self.finished = True
@@ -177,12 +231,27 @@ class GtkInstallProgressAdapter(InstallProgress):
def updateInterface(self):
InstallProgress.updateInterface(self)
- self.progress.set_fraction(self.percent/100.0)
- self.label_status.set_text(self.status)
+ # check if we haven't started yet with packages, pulse then
+ if self.start_time == 0.0:
+ self.progress.pulse()
+ time.sleep(0.2)
+ # check about terminal activity
+ if self.last_activity > 0 and \
+ (self.last_activity + self.TIMEOUT_TERMINAL_ACTIVITY) < time.time():
+ logging.warning("no activity on terminal for %s seconds" % self.TIMEOUT_TERMINAL_ACTIVITY)
+ self.parent.expander_terminal.set_expanded(True)
while gtk.events_pending():
gtk.main_iteration()
time.sleep(0.02)
+class DistUpgradeVteTerminal(object):
+ def __init__(self, parent, term):
+ self.term = term
+ self.parent = parent
+ def call(self, cmd):
+ self.term.show()
+ self.parent.expander_terminal.set_expanded(True)
+ self.term.fork_command(command=cmd[0],argv=cmd)
class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
" gtk frontend of the distUpgrade tool "
@@ -217,7 +286,6 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
attr = pango.AttrStyle(pango.STYLE_ITALIC, 0, -1)
attrlist.insert(attr)
self.label_status.set_property("attributes", attrlist)
-
# reasonable fault handler
sys.excepthook = self._handleException
@@ -232,13 +300,20 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
"\n".join(lines))
sys.exit(1)
+ def getTerminal(self):
+ return DistUpgradeVteTerminal(self, self._term)
+
def create_terminal(self, arg1,arg2,arg3,arg4):
" helper to create a vte terminal "
self._term = vte.Terminal()
self._term.set_font_from_string("monospace 10")
self._term.connect("contents-changed", self._term_content_changed)
self._terminal_lines = []
- self._terminal_log = open("/var/log/dist-upgrade-term.log","w")
+ try:
+ self._terminal_log = open("/var/log/dist-upgrade-term.log","w")
+ except IOError:
+ # if something goes wrong (permission denied etc), use stdout
+ self._terminal_log = sys.stdout
return self._term
def _term_content_changed(self, term):
@@ -298,7 +373,7 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
self.dialog_error.destroy()
return False
- def confirmChanges(self, summary, changes, downloadSize):
+ def confirmChanges(self, summary, changes, downloadSize, actions=None):
# FIXME: add a whitelist here for packages that we expect to be
# removed (how to calc this automatically?)
DistUpgradeView.confirmChanges(self, summary, changes, downloadSize)
@@ -345,6 +420,12 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
self.error(summary, msg)
return False
+ if actions != None:
+ self.button_cancel_changes.set_use_stock(False)
+ self.button_cancel_changes.set_use_underline(True)
+ self.button_cancel_changes.set_label(actions[0])
+ self.button_confirm_changes.set_label(actions[1])
+
self.label_summary.set_markup("<big><b>%s</b></big>" % summary)
self.label_changes.set_markup(msg)
# fill in the details
@@ -355,6 +436,7 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
self.details_list.append([_("Install %s" % inst)])
for up in self.toUpgrade:
self.details_list.append([_("Upgrade %s" % up)])
+ self.treeview_details.scroll_to_cell((0,))
self.dialog_changes.set_transient_for(self.window_main)
self.dialog_changes.realize()
self.dialog_changes.window.set_functions(gtk.gdk.FUNC_MOVE)
@@ -400,7 +482,21 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
return True
if __name__ == "__main__":
- view = GtkDistUpgradeView()
+
+ view = DistUpgradeViewGtk()
+ fp = GtkFetchProgressAdapter(view)
+ ip = GtkInstallProgressAdapter(view)
+
+
+ cache = apt.Cache()
+ for pkg in sys.argv[1:]:
+ cache[pkg].markInstall()
+ cache.commit(fp,ip)
+
+ sys.exit(0)
+ ip.conffile("TODO","TODO~")
+ view.getTerminal().call(["dpkg","--configure","-a"])
+ view.getTerminal().call(["ls"])
view.error("short","long",
"asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n"
"asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n"
@@ -410,3 +506,5 @@ if __name__ == "__main__":
"asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n"
"asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n"
)
+ view.confirmChanges("xx",[], 100)
+
diff --git a/DistUpgrade/TODO b/DistUpgrade/TODO
index fb6895f9..217eb6cb 100644
--- a/DistUpgrade/TODO
+++ b/DistUpgrade/TODO
@@ -1,10 +1,11 @@
MUSTFIX:
--------
* debconf gnome dosn't work (can't connect to the session)
+ [ should be fixed with the bugfix on gksu ]
* display a message that all applications should be closed for the
dist-upgrade (and that strange things like a crashing panel can
happen)
-
+ [done in current dialog]
breezy->dapper
@@ -19,11 +20,6 @@ hoary->breezy
(it will crash otherwise)
- send a "\n" on the libc6 question on hoary->breezy
-breezy->dapper
---------------
-- gnome-icon-theme changes a lot, icons move from hicolor to gnome.
- this might have caused a specatular crash during a upgrade
-
general
-------
- CDROM upgrades !!!
diff --git a/DistUpgrade/build-dist.sh b/DistUpgrade/build-dist.sh
new file mode 100755
index 00000000..f48c4e39
--- /dev/null
+++ b/DistUpgrade/build-dist.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# build a tarball that is ready for the upload. the format is
+# simple, it contans:
+# $version/$dist.tar.gz
+# $version/ReleaseNotes
+# this put into a file called "$dist-upgrader_$version.tar.gz"
+
+
+TARGETDIR=../dist-upgrade-build
+SOURCEDIR=`pwd`
+DIST=dapper
+MAINTAINER="Michael Vogt <michael.vogt@ubuntu.com>"
+NOTES=ReleaseAnouncement
+version=$(date +%Y%m%d.%H%M)
+
+# create targetdir
+if [ ! -d $TARGETDIR/$version ]; then
+ mkdir -p $TARGETDIR/$version
+fi
+
+#build the actual dist-upgrader tarball
+./build-tarball.sh
+
+# how move it into a container including the targetdir (with version)
+# and ReleaeNotes
+cd $TARGETDIR/$version
+cp $SOURCEDIR/$NOTES .
+cp $SOURCEDIR/$DIST.tar.gz .
+cd ..
+
+# build it
+TARBALL="dist-upgrader_"$version"_all.tar.gz"
+tar czvf $TARBALL $version
+
+# now create a changes file
+CHANGES="dist-upgrader_"$version"_all.changes"
+echo > $CHANGES
+echo "Origin: Ubuntu/$DIST" >> $CHANGES
+echo "Format: 1.7" >> $CHANGES
+echo "Date: `date -R`" >> $CHANGES
+echo "Architecture: all">>$CHANGES
+echo "Version: $version" >>$CHANGES
+echo "Distribution: $DIST" >>$CHANGES
+echo "Source: dist-upgrader" >> $CHANGES
+echo "Binary: dist-upgrader" >> $CHANGES
+echo "Urgency: low" >> $CHANGES
+echo "Maintainer: $MAINTAINER" >> $CHANGES
+echo "Changed-By: $MAINTAINER" >> $CHANGES
+echo "Changes: " >> $CHANGES
+echo " * new upstream version" >> $CHANGES
+echo "Files: " >> $CHANGES
+echo " `md5sum $TARBALL | awk '{print $1}'` `stat --format=%s $TARBALL` raw-dist-upgrader - $TARBALL" >> $CHANGES