summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-09 19:24:22 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-09 19:24:22 +0100
commit2cf4e28059f008a39fd90902aa5e4d36fa6c727e (patch)
tree827f6065ef20af79d71effdc2550aa0ff7ec6603 /DistUpgrade
parent6e70ca9443891d9eec28332d04b7cd262a5e9aee (diff)
downloadpython-apt-2cf4e28059f008a39fd90902aa5e4d36fa6c727e.tar.gz
* remove cruft implemented
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.glade62
-rw-r--r--DistUpgrade/DistUpgradeControler.py38
-rw-r--r--DistUpgrade/DistUpgradeView.py2
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py6
-rw-r--r--DistUpgrade/TODO8
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 @@
<property name="spacing">0</property>
<child>
- <widget class="Custom" id="custom_terminal">
+ <widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="creation_function">create_terminal</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 06 Dec 2005 20:03:08 GMT</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="Custom" id="custom_terminal">
+ <property name="visible">True</property>
+ <property name="creation_function">create_terminal</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Tue, 06 Dec 2005 20:03:08 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVScrollbar" id="vscrollbar_terminal">
+ <property name="visible">True</property>
+ <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+ <property name="inverted">False</property>
+ <property name="adjustment">0 0 0 0 0 0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
</child>
@@ -519,6 +546,31 @@
<property name="spacing">6</property>
<child>
+ <widget class="GtkLabel" id="label_summary">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Confirm changes:&lt;/b&gt;</property>
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("<big><b>%s</b></big>" % 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?)