diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-27 12:49:42 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-27 12:49:42 +0100 |
| commit | a2846523f74c3620071e82a8b6e74fc89c4204ad (patch) | |
| tree | 0faf16d517c500eb33d215a75f1488c4c270daf4 | |
| parent | 165cd00f59347de8f1c46643c782e1d7d65b58a0 (diff) | |
| download | python-apt-a2846523f74c3620071e82a8b6e74fc89c4204ad.tar.gz | |
* cherry picked
| -rw-r--r-- | DistUpgrade/TODO | 7 | ||||
| -rw-r--r-- | UpdateManager/DistUpgradeFetcher.py | 197 | ||||
| -rw-r--r-- | UpdateManager/MetaRelease.py | 4 | ||||
| -rw-r--r-- | UpdateManager/UpdateManager.py | 120 | ||||
| -rw-r--r-- | data/gnome-software-properties.desktop.in | 1 | ||||
| -rw-r--r-- | data/update-manager.desktop.in | 3 | ||||
| -rw-r--r-- | debian/changelog | 14 | ||||
| -rw-r--r-- | debian/control | 4 |
8 files changed, 228 insertions, 122 deletions
diff --git a/DistUpgrade/TODO b/DistUpgrade/TODO index 9d26eefc..df64b54b 100644 --- a/DistUpgrade/TODO +++ b/DistUpgrade/TODO @@ -5,6 +5,11 @@ 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 !!! @@ -42,4 +47,4 @@ Robustness: as possible. The problem here is that e.g. if libnoitfy0 explodes and evolution, update-notifer depend on it, continuing means to evo and u-n can't be upgraded and dpkg explodes on them too. This is not more worse - than what we have right now I guess.
\ No newline at end of file + than what we have right now I guess. diff --git a/UpdateManager/DistUpgradeFetcher.py b/UpdateManager/DistUpgradeFetcher.py new file mode 100644 index 00000000..7af32865 --- /dev/null +++ b/UpdateManager/DistUpgradeFetcher.py @@ -0,0 +1,197 @@ +# DistUpgradeFetcher.py +# +# Copyright (c) 2006 Canonical +# +# Author: Michael Vogt <michael.vogt@ubuntu.com> +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA + +import pygtk +pygtk.require('2.0') +import gtk +import os +import apt_pkg +import tarfile +import urllib2 +import tempfile +import GnuPGInterface +from gettext import gettext as _ + +import GtkProgress +from ReleaseNotesViewer import ReleaseNotesViewer + + +class DistUpgradeFetcher(object): + + def __init__(self, parent, new_dist): + self.parent = parent + self.window_main = parent.window_main + self.new_dist = new_dist + + def showReleaseNotes(self): + # FIXME: care about i18n! (append -$lang or something) + if self.new_dist.releaseNotesURI != None: + uri = self.new_dist.releaseNotesURI + self.window_main.set_sensitive(False) + self.window_main.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) + while gtk.events_pending(): + gtk.main_iteration() + + # download/display the release notes + # FIXME: add some progress reporting here + res = gtk.RESPONSE_CANCEL + try: + release_notes = urllib2.urlopen(uri) + notes = release_notes.read() + textview_release_notes = ReleaseNotesViewer(notes) + textview_release_notes.show() + self.parent.scrolled_notes.add(textview_release_notes) + self.parent.dialog_release_notes.set_transient_for(self.window_main) + res = self.parent.dialog_release_notes.run() + self.parent.dialog_release_notes.hide() + except urllib2.HTTPError: + primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ + _("Could not find the release notes") + secondary = _("The server may be overloaded. ") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() + dialog.destroy() + except IOError: + primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ + _("Could not download the release notes") + secondary = _("Please check your internet connection.") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() + dialog.destroy() + self.window_main.set_sensitive(True) + self.window_main.window.set_cursor(None) + # user clicked cancel + if res == gtk.RESPONSE_CANCEL: + return False + return True + + def authenticate(self, file, signature, keyring='/etc/apt/trusted.gpg'): + """ authenticated a file against a given signature, if no keyring + is given use the apt default keyring + """ + gpg = GnuPGInterface.GnuPG() + gpg.options.extra_args = ['--no-default-keyring', + '--keyring', keyring] + proc = gpg.run(['--verify', signature, file], + create_fhs=['status','logger','stderr']) + gpgres = proc.handles['status'].read() + if "VALIDSIG" in gpgres: + return True + return False + + def extractDistUpgrader(self): + # extract the tarbal + print "extracting '%s'" % (self.tmpdir+"/"+os.path.basename(self.uri)) + tar = tarfile.open(self.tmpdir+"/"+os.path.basename(self.uri),"r") + for tarinfo in tar: + tar.extract(tarinfo) + tar.close() + return True + + def verifyDistUprader(self): + # FIXME: check a internal dependency file to make sure + # that the script will run correctly + + # see if we have a script file that we can run + self.script = script = "%s/%s" % (self.tmpdir, self.new_dist.name) + if not os.path.exists(script): + # no script file found in extracted tarbal + primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ + _("Could not run the upgrade tool") + secondary = _("This is most likely a bug in the upgrade tool. " + "Please report it as a bug") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() + dialog.destroy() + return False + return True + + def fetchDistUpgrader(self): + # now download the tarball with the upgrade script + self.tmpdir = tmpdir = tempfile.mkdtemp() + os.chdir(tmpdir) + if self.new_dist.upgradeTool != None: + progress = GtkProgress.GtkFetchProgress(self.parent, + _("Downloading the upgrade " + "tool"), + _("The upgrade tool will " + "guide you through the " + "upgrade process.")) + fetcher = apt_pkg.GetAcquire(progress) + self.uri = self.new_dist.upgradeTool + af = apt_pkg.GetPkgAcqFile(fetcher,self.uri, descr=_("Upgrade tool")) + if fetcher.Run() != fetcher.ResultContinue: + return False + return True + + def runDistUpgrader(self): + #print "runing: %s" % script + os.execv(script,[]) + + def cleanup(self): + # cleanup + os.chdir("..") + # del tmpdir + for root, dirs, files in os.walk(self.tmpdir, topdown=False): + for name in files: + os.remove(os.path.join(root, name)) + #print "would remove file: %s" % os.path.join(root, name) + for name in dirs: + os.rmdir(os.path.join(root, name)) + #print "would remove dir: %s" % os.path.join(root, name) + os.rmdir(self.tmpdir) + + def run(self): + # see if we have release notes + if not self.showReleaseNotes(): + return + if not self.fetchDistUpgrader(): + print "Fetch failed" + return + if not self.extractDistUpgrader(): + print "extract failed" + return + if not self.verifyDistUprader(): + print "verify failed" + self.cleanup() + return + #if not self.authenticate(distUpgradeTar, distUpgradeSig): + # print "authenticate failed" + # self.cleanup() + # return + self.runDistUpgrader() + + +if __name__ == "__main__": + d = DistUpgradeFetcher(None) + print d.authenticate('/tmp/Release','/tmp/Release.gpg') diff --git a/UpdateManager/MetaRelease.py b/UpdateManager/MetaRelease.py index 0bc8dc05..cd56970f 100644 --- a/UpdateManager/MetaRelease.py +++ b/UpdateManager/MetaRelease.py @@ -42,8 +42,8 @@ class Dist(object): class MetaRelease(gobject.GObject): # some constants - METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release" - #METARELEASE_URI = "http://people.ubuntu.com/~mvo/dist-upgrader/meta-release-test.save" + #METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release" + METARELEASE_URI = "http://people.ubuntu.com/~mvo/dist-upgrader/meta-release-test.save" METARELEASE_FILE = "/var/lib/update-manager/meta-release" __gsignals__ = { diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 8b757bd1..8549f1c3 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -1,6 +1,6 @@ # UpdateManager.py # -# Copyright (c) 2004,2005 Canonical +# Copyright (c) 2004-2006 Canonical # 2004 Michiel Sikkes # 2005 Martin Willemoes Hansen # @@ -48,14 +48,12 @@ import time import thread import xml.sax.saxutils -# dist-upgrade tool -import tarfile from gettext import gettext as _ from Common.utils import * from Common.SimpleGladeApp import SimpleGladeApp -from ReleaseNotesViewer import ReleaseNotesViewer +from DistUpgradeFetcher import DistUpgradeFetcher import GtkProgress from MetaRelease import Dist, MetaRelease @@ -476,7 +474,7 @@ class UpdateManager(SimpleGladeApp): lock = thread.allocate_lock() lock.acquire() t = thread.start_new_thread(self.run_synaptic, - (self.window_main.window.xid ,action,lock)) + (self.window_main.window.xid,action,lock)) while lock.locked(): while gtk.events_pending(): gtk.main_iteration() @@ -625,116 +623,8 @@ class UpdateManager(SimpleGladeApp): def on_button_dist_upgrade_clicked(self, button): print "on_button_dist_upgrade_clicked" - - # see if we have release notes - - # FIXME: care about i18n! (append -$lang or something) - if self.new_dist.releaseNotesURI != None: - uri = self.new_dist.releaseNotesURI - print uri - self.window_main.set_sensitive(False) - self.window_main.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - while gtk.events_pending(): - gtk.main_iteration() - - # download/display the release notes - # FIXME: add some progress reporting here - res = gtk.RESPONSE_CANCEL - try: - release_notes = urllib2.urlopen(uri) - notes = release_notes.read() - textview_release_notes = ReleaseNotesViewer(notes) - textview_release_notes.show() - self.scrolled_notes.add(textview_release_notes) - self.dialog_release_notes.set_transient_for(self.window_main) - res = self.dialog_release_notes.run() - self.dialog_release_notes.hide() - except urllib2.HTTPError: - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ - _("Could not find the release notes") - secondary = _("The server may be overloaded. ") - dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, - gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") - dialog.set_title("") - dialog.set_markup(primary); - dialog.format_secondary_text(secondary); - dialog.run() - dialog.destroy() - except IOError: - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ - _("Could not download the release notes") - secondary = _("Please check your internet connection.") - dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, - gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") - dialog.set_title("") - dialog.set_markup(primary); - dialog.format_secondary_text(secondary); - dialog.run() - dialog.destroy() - self.window_main.set_sensitive(True) - self.window_main.window.set_cursor(None) - # user clicked cancel - if res == gtk.RESPONSE_CANCEL: - return - - # now download the tarball with the upgrade script - tmpdir = tempfile.mkdtemp() - os.chdir(tmpdir) - if self.new_dist.upgradeTool != None: - progress = GtkProgress.GtkFetchProgress(self, - _("Downloading the upgrade " - "tool"), - _("The upgrade tool will " - "guide you through the " - "upgrade process.")) - fetcher = apt_pkg.GetAcquire(progress) - uri = self.new_dist.upgradeTool - #print "Downloading %s to %s" % (uri, tmpdir) - af = apt_pkg.GetPkgAcqFile(fetcher,uri, - descr=_("Upgrade tool")) - fetcher.Run() - #print "Done downloading" - - # extract the tarbal - print "extracting" - tar = tarfile.open(tmpdir+"/"+os.path.basename(uri),"r") - for tarinfo in tar: - tar.extract(tarinfo) - tar.close() - - # FIXME: check a internal dependency file to make sure - # that the script will run correctly - - # see if we have a script file that we can run - script = "%s/%s" % (tmpdir, self.new_dist.name) - if not os.path.exists(script): - # no script file found in extracted tarbal - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ - _("Could not run the upgrade tool") - secondary = _("This is most likely a bug in the upgrade tool. " - "Please report it as a bug") - dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, - gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") - dialog.set_title("") - dialog.set_markup(primary); - dialog.format_secondary_text(secondary); - dialog.run() - dialog.destroy() - else: - #print "runing: %s" % script - os.execv(script,[]) - - # cleanup - os.chdir("..") - # del tmpdir - for root, dirs, files in os.walk(tmpdir, topdown=False): - for name in files: - os.remove(os.path.join(root, name)) - #print "would remove file: %s" % os.path.join(root, name) - for name in dirs: - os.rmdir(os.path.join(root, name)) - #print "would remove dir: %s" % os.path.join(root, name) - os.rmdir(tmpdir) + fetcher = DistUpgradeFetcher(self, self.new_dist) + fetcher.run() def new_dist_available(self, meta_release, upgradable_to): print "new_dist_available: %s" % upgradable_to.name diff --git a/data/gnome-software-properties.desktop.in b/data/gnome-software-properties.desktop.in index c626869a..781e2eb9 100644 --- a/data/gnome-software-properties.desktop.in +++ b/data/gnome-software-properties.desktop.in @@ -10,3 +10,4 @@ Type=Application Encoding=UTF-8 Categories=Application;System;Settings; X-KDE-SubstituteUID=true +X-Ubuntu-Gettext-Domain=update-manager
\ No newline at end of file diff --git a/data/update-manager.desktop.in b/data/update-manager.desktop.in index 906a60e6..00287a2e 100644 --- a/data/update-manager.desktop.in +++ b/data/update-manager.desktop.in @@ -8,4 +8,5 @@ Terminal=false Type=Application Encoding=UTF-8 Categories=Application;System;Settings; -X-KDE-SubstituteUID=true
\ No newline at end of file +X-KDE-SubstituteUID=true +X-Ubuntu-Gettext-Domain=update-manager
\ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 1756819d..811bd52f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,22 @@ -update-manager (0.42.2ubuntu5) dapper; urgency=low +update-manager (0.42.2ubuntu6) dapper; urgency=low + * SoftwareProperties/*: fix some UI problems (thanks to Sebastian Heinlein) + * debian/control: arch: all now * po/pt_BR.po: updated translation (thanks to Carlos Eduardo Pedroza Santiviago) + * data/gnome-software-properties.desktop.in, update-manager.desktop.in: + * debian/rules: undo the detection in favour of the simpler update of + the desktop files -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 20 Feb 2006 15:58:09 +0100 +update-manager (0.42.2ubuntu5) dapper; urgency=low + + * debian/rules: Add gettext domain to .server and .desktop files to get + language pack support for them. (Similarly to cdbs' gnome.mk) + + -- Martin Pitt <martin.pitt@ubuntu.com> Thu, 23 Feb 2006 18:42:04 +0100 + update-manager (0.42.2ubuntu4) dapper; urgency=low * removed some of the gnome dependencies (gconf still in) diff --git a/debian/control b/debian/control index 314ec741..8870a031 100644 --- a/debian/control +++ b/debian/control @@ -6,8 +6,8 @@ Build-Depends: debhelper (>= 4.0.0), libxml-parser-perl, scrollkeeper, intltool, Standards-Version: 3.6.1.1 Package: update-manager -Architecture: any -Depends: ${python:Depends}, ${misc:Depends}, python, python-gnome2, python-glade2, python-apt (>= 0.6.15), synaptic (>= 0.57.8), lsb-release +Architecture: all +Depends: ${python:Depends}, ${misc:Depends}, python, python-gnome2, python-glade2, python-apt (>= 0.6.15), synaptic (>= 0.57.8), lsb-release, python-gnupginterface Description: GNOME application that manages apt updates This is the GNOME apt update manager. It checks for updates and lets the user choose which to install. |
