From 2cf4e28059f008a39fd90902aa5e4d36fa6c727e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Jan 2006 19:24:22 +0100 Subject: * remove cruft implemented --- DistUpgrade/DistUpgrade.glade | 62 ++++++++++++++++++++++++++++++++++--- DistUpgrade/DistUpgradeControler.py | 38 ++++++++++++++--------- DistUpgrade/DistUpgradeView.py | 2 +- DistUpgrade/DistUpgradeViewGtk.py | 6 ++-- DistUpgrade/TODO | 8 +++-- 5 files changed, 91 insertions(+), 25 deletions(-) diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 51308d3b..ad28aabc 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -372,12 +372,39 @@ 0 - + True - create_terminal - 0 - 0 - Tue, 06 Dec 2005 20:03:08 GMT + False + 0 + + + + True + create_terminal + 0 + 0 + Tue, 06 Dec 2005 20:03:08 GMT + + + 0 + True + True + + + + + + True + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + 0 + False + True + + @@ -518,6 +545,31 @@ False 6 + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + True diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 44f3986e..cf82b9af 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -38,7 +38,7 @@ class MyCache(apt.Cache): apt.Cache.__init__(self, progress) # turn on debuging apt_pkg.Config.Set("Debug::pkgProblemResolver","true") - fd = os.open(os.path.expanduser("~/dist-upgrade-apt.log"), os.O_RDWR|os.O_CREAT) + fd = os.open(os.path.expanduser("~/dist-upgrade-apt.log"), os.O_RDWR|os.O_CREAT|os.O_TRUNC) os.dup2(fd,1) os.dup2(fd,2) @@ -76,8 +76,10 @@ class DistUpgradeControler(object): self.cache = None # some constants here - self.fromDist = "hoary" - self.toDist = "breezy" + #self.fromDist = "hoary" + #self.toDist = "breezy" + self.fromDist = "breezy" + self.toDist = "dapper" self.origin = "Ubuntu" # a list of missing pkg names in the current install that neesd to @@ -123,14 +125,9 @@ class DistUpgradeControler(object): deps_found &= self.cache.has_key(pkg) and self.cache[pkg].isInstalled if deps_found: logging.debug("guessing '%s' as missing meta-pkg" % key) - try: - self.cache[key].markInstall() - self.missing_pkgs.append(key) - break - except SystemError: - pass + self.missing_pkgs.append(key) # check if we actually found one - if not metaPkgInstalled(): + if not metaPkgInstalled() and len(self.missing_pkgs) == 0: # FIXME: provide a list self._view.error(_("Can't guess meta-package"), _("Your system does not contain a " @@ -292,7 +289,8 @@ class DistUpgradeControler(object): # log the changes for debuging self._logChanges() # ask the user if he wants to do the changes - res = self._view.confirmChanges(changes,self.cache.requiredDownload) + res = self._view.confirmChanges(_("Perform Upgrade?"),changes, + self.cache.requiredDownload) return res def doDistUpgrade(self): @@ -301,10 +299,22 @@ class DistUpgradeControler(object): self.cache.commit(fprogress,iprogress) def doPostUpgrade(self): - # FIXME: check out what packages are cruft now + self.openCache() + # check out what packages are cruft now # use self.{foreign,obsolete}_pkgs here and see what changed - pass - + now_obsolete = self._getObsoletesPkgs() - self.obsolete_pkgs + now_foreign = self._getForeignPkgs() - self.foreign_pkgs + logging.debug("Obsolete: %s" % " ".join(now_obsolete)) + logging.debug("Foreign: %s" % " ".join(now_foreign)) + # mark the cruft as delete + for pkgname in now_obsolete: + self.cache[pkgname].markDelete() + if self._view.confirmChanges(_("Remove obsolete Packages?"), + self.cache.getChanges(), 0): + fprogress = self._view.getFetchProgress() + iprogress = self._view.getInstallProgress() + self.cache.commit(fprogress,iprogress) + def askForReboot(self): return self._view.askYesNoQuestion(_("Reboot required"), _("The upgrade is finished now. " diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py index cc8616d2..a36855d3 100644 --- a/DistUpgrade/DistUpgradeView.py +++ b/DistUpgrade/DistUpgradeView.py @@ -45,7 +45,7 @@ class DistUpgradeView(object): 4. Post upgrade stuff """ pass - def confirmChanges(self, changes, downloadSize): + def confirmChanges(self, summary, changes, downloadSize): """ display the list of changed packages (apt.Package) and return if the user confirms them """ diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index be10a18c..fc4dfb11 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -169,6 +169,7 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): column.add_attribute(render, "markup", 0) self.treeview_details.append_column(column) self.treeview_details.set_model(self.details_list) + self.vscrollbar_terminal.set_adjustment(self._term.get_adjustment()) def create_terminal(self, arg1,arg2,arg3,arg4): " helper to create a vte terminal " @@ -210,10 +211,11 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): dialog.run() dialog.destroy() return False - def confirmChanges(self, changes, downloadSize): + def confirmChanges(self, summary, changes, downloadSize): # FIXME: add a whitelist here for packages that we expect to be # removed (how to calc this automatically?) - DistUpgradeView.confirmChanges(self, changes,downloadSize) + DistUpgradeView.confirmChanges(self, summary, changes,downloadSize) + self.label_summary.set_markup("%s" % summary) msg = _("%s packages are going to be removed.\n" "%s packages are going to be newly installed.\n" "%s packages are going to be upgraded.\n\n" diff --git a/DistUpgrade/TODO b/DistUpgrade/TODO index 7dc10ff8..e3fbc452 100644 --- a/DistUpgrade/TODO +++ b/DistUpgrade/TODO @@ -4,9 +4,11 @@ happen) - stop gnome-volume-manager before the hoary->breezy upgrade (it will crash otherwise) -- check authentication and don't upgrade anything that is not - authenticated (maybe just comment unauthenticated stuff out?) - restore sources.list if anything goes wrong before doing the actual upgrade (e.g. dependency calculation) - whitelist removal (pattern? e.g. c102 -> c2a etc)? -- logging for the dpkg install run \ No newline at end of file +- logging for the dpkg install run +- send a "\n" on the libc6 question on hoary->breezy + +- check authentication and don't upgrade anything that is not + authenticated (maybe just comment unauthenticated stuff out?) -- cgit v1.2.3