summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:07:54 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:07:54 +0100
commite68d67031ef224da375c0473d2f44902623acb0f (patch)
tree765700c7715011b7f13644603e917cf969cf553e /DistUpgrade
parent3d4f9a0c623acf75b7b9159c2a3f987deebee755 (diff)
downloadpython-apt-e68d67031ef224da375c0473d2f44902623acb0f.tar.gz
* merge with the stuff from the update-manager--mvo branch
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.glade4
-rw-r--r--DistUpgrade/DistUpgradeCache.py1
-rw-r--r--DistUpgrade/DistUpgradeControler.py16
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py21
-rw-r--r--DistUpgrade/TODO5
-rwxr-xr-xDistUpgrade/build-dist.sh43
6 files changed, 71 insertions, 19 deletions
diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade
index e50476e2..08b96a11 100644
--- a/DistUpgrade/DistUpgrade.glade
+++ b/DistUpgrade/DistUpgrade.glade
@@ -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>
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..972ea2dc 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -157,7 +157,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 +183,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 +205,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)
@@ -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:
@@ -301,7 +304,8 @@ class DistUpgradeControler(object):
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/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index 2f7e3fed..a6847cc7 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -132,7 +132,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)
@@ -163,6 +163,10 @@ class GtkInstallProgressAdapter(InstallProgress):
pid = self.term.forkpty(envv=self.env)
return pid
+ def statusChange(self, pkg, percent, status):
+ self.progress.set_fraction(float(percent)/100.0)
+ self.label_status.set_text(status.strip())
+
def child_exited(self, term, pid, status):
self.apt_status = os.WEXITSTATUS(status)
self.finished = True
@@ -177,8 +181,6 @@ class GtkInstallProgressAdapter(InstallProgress):
def updateInterface(self):
InstallProgress.updateInterface(self)
- self.progress.set_fraction(self.percent/100.0)
- self.label_status.set_text(self.status)
while gtk.events_pending():
gtk.main_iteration()
time.sleep(0.02)
@@ -217,7 +219,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
@@ -298,7 +299,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 +346,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 +362,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 +408,7 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
return True
if __name__ == "__main__":
- view = GtkDistUpgradeView()
+ view = DistUpgradeViewGtk()
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 +418,4 @@ 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..04c507be 100644
--- a/DistUpgrade/TODO
+++ b/DistUpgrade/TODO
@@ -19,11 +19,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..f18dc2ce
--- /dev/null
+++ b/DistUpgrade/build-dist.sh
@@ -0,0 +1,43 @@
+#!/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
+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.changes"
+echo "Format: 1.7" > $CHANGES
+echo "Date: `date -R`" >> $CHANGES
+echo "Architecture: all">>$CHANGES
+echo "Version: $version" >>$CHANGES
+echo "Distribution: dapper" >>$CHANGES
+echo "Files: " >> $CHANGES
+echo " `md5sum $TARBALL | awk '{print $1}'` `stat --format=%s $TARBALL` raw-dist-upgrader $TARBALL" >> $CHANGES