summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorSebastian Heinlein <sebi@sebi-pc>2006-11-12 19:46:09 +0100
committerSebastian Heinlein <sebi@sebi-pc>2006-11-12 19:46:09 +0100
commit5d3e785f44043bd3905540bd16a293ea9dfac375 (patch)
tree2dd978feb2b97aaf3c18cd61423acd3ae54b95f7 /DistUpgrade
parent71121af388843e45eb2b655b6d1bd94542503651 (diff)
parentdcca71324598d46ff83436bb71b732fd1853169d (diff)
downloadpython-apt-5d3e785f44043bd3905540bd16a293ea9dfac375.tar.gz
* merge with mvo
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/Changelog40
-rw-r--r--DistUpgrade/DistUpgrade.cfg2
-rw-r--r--DistUpgrade/DistUpgradeCache.py73
-rw-r--r--DistUpgrade/DistUpgradeControler.py18
-rw-r--r--DistUpgrade/DistUpgradeView.py6
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py47
-rwxr-xr-xDistUpgrade/build-tarball.sh2
-rw-r--r--DistUpgrade/removal_blacklist.cfg3
8 files changed, 156 insertions, 35 deletions
diff --git a/DistUpgrade/Changelog b/DistUpgrade/Changelog
index ece5feda..46e6fb89 100644
--- a/DistUpgrade/Changelog
+++ b/DistUpgrade/Changelog
@@ -1,3 +1,43 @@
+2006-10-28:
+ - catch errors when load_icon() does not work
+2006-10-27:
+ - reset self.read so that we do not loop endlessly when dpkg
+ sends unexpected data (lp: #68553)
+2006-10-26:
+ - make sure that xserver-xorg-video-all get installed if
+ xserver-xorg-driver-all was installed before (lp: #58424)
+2006-10-21:
+ - comment out old cdrom sources
+ - demotions updated
+2006-10-21:
+ - fix incorrect arguments in fixup logging (lp: #67311)
+ - more error logging
+ - fix upgrade problems for people with unofficial compiz
+ repositories (lp: #58424)
+ - rosetta i18n updates
+ - uploaded
+2006-10-17:
+ - ensure bzr, tomboy and xserver-xorg-input-* are properly
+ upgraded
+ - don't fail if dpkg sents unexpected status lines (lp: #66013)
+2006-10-16:
+ - remove leftover references to ubuntu-base and
+ use ubuntu-minimal and ubuntu-standard instead
+ - updated translations from rosetta
+2006-10-13:
+ - log held-back as well
+2006-10-12:
+ - check if cdrom.lst actually exists before copying it
+2006-10-11:
+ - keep pixbuf loader reference around so that we
+ have one after the upgrade when the old
+ /usr/lib/gtk-2.0/loader/2.4.0/ loader is gone.
+ This fixes the problem of missing stock-icons
+ after the upgrade. Also revalidate the theme
+ in each step.
+2006-10-10:
+ - fix time calculation
+ - fix kubuntu upgrade case
2006-10-06:
- fix source.list rewrite corner case bug (#64159)
2006-10-04:
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg
index f399a1f5..c39cb9e5 100644
--- a/DistUpgrade/DistUpgrade.cfg
+++ b/DistUpgrade/DistUpgrade.cfg
@@ -7,7 +7,7 @@ View=DistUpgradeViewGtk
[Distro]
# the meta-pkgs we support
MetaPkgs=ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, xubuntu-desktop
-BaseMetaPkgs=ubuntu-minimal
+BaseMetaPkgs=ubuntu-minimal, ubuntu-standard
PostUpgradePurge=xorg-common, libgl1-mesa
Demotions=demoted.cfg
RemoveEssentialOk=sysvinit
diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py
index 7d0d27e0..d9dc9959 100644
--- a/DistUpgrade/DistUpgradeCache.py
+++ b/DistUpgrade/DistUpgradeCache.py
@@ -166,8 +166,8 @@ class MyCache(apt.Cache):
def edgyQuirks(self):
""" this function works around quirks in the dapper->edgy upgrade """
logging.debug("running edgyQuirks handler")
- # deal with the python2.4-$foo -> python-$foo transition
for pkg in self:
+ # deal with the python2.4-$foo -> python-$foo transition
if (pkg.name.startswith("python2.4-") and
pkg.isInstalled and
not pkg.markedUpgrade):
@@ -178,15 +178,51 @@ class MyCache(apt.Cache):
"python2.4->python upgrade rule")
except SystemError, e:
logging.debug("Failed to apply python2.4->python install: %s (%s)" % (basepkg, e))
- # deal with *gar*gar* hpijs
- if (self.has_key("hpijs") and self["hpijs"].isInstalled and
- not self["hpijs"].markedUpgrade):
- try:
- self.markInstall("hpijs","hpijs quirk upgrade rule")
- except SystemError, e:
- logging.debug("Failed to apply hpijs install (%s)" % e)
+ # xserver-xorg-input-$foo gives us trouble during the upgrade too
+ if (pkg.name.startswith("xserver-xorg-input-") and
+ pkg.isInstalled and
+ not pkg.markedUpgrade):
+ try:
+ self.markInstall(pkg.name, "xserver-xorg-input fixup rule")
+ except SystemError, e:
+ logging.debug("Failed to apply fixup: %s (%s)" % (pkg.name, e))
-
+ # deal with held-backs that are unneeded
+ for pkgname in ["hpijs", "bzr", "tomboy"]:
+ if (self.has_key(pkgname) and self[pkgname].isInstalled and
+ not self[pkgname].markedUpgrade):
+ try:
+ self.markInstall(pkgname,"%s quirk upgrade rule" % pkgname)
+ except SystemError, e:
+ logging.debug("Failed to apply %s install (%s)" % (pkgname,e))
+ # libgl1-mesa-dri from xgl.compiz.info (and friends) breaks the
+ # upgrade, work around this here by downgrading the package
+ if self.has_key("libgl1-mesa-dri"):
+ pkg = self["libgl1-mesa-dri"]
+ # the version from the compiz repo has a "6.5.1+cvs20060824" ver
+ if (pkg.candidateVersion == pkg.installedVersion and
+ "+cvs2006" in pkg.candidateVersion):
+ for ver in pkg._pkg.VersionList:
+ # the "officual" edgy version has "6.5.1~20060817-0ubuntu3"
+ if "~2006" in ver.VerStr:
+ # ensure that it is from a trusted repo
+ for (VerFileIter, index) in ver.FileList:
+ indexfile = self._list.FindIndex(VerFileIter)
+ if indexfile and indexfile.IsTrusted:
+ logging.info("Forcing downgrade of libgl1-mesa-dri for xgl.compz.info installs")
+ self._depcache.SetCandidateVer(pkg._pkg, ver)
+ break
+
+ # deal with general if $foo is installed, install $bar
+ for (fr, to) in [("xserver-xorg-driver-all","xserver-xorg-video-all")]:
+ if self.has_key(fr) and self.has_key(to):
+ if self[fr].isInstalled and not self[to].markedInstall:
+ try:
+ self.markInstall(to,"%s->%s quirk upgrade rule" % (fr, to))
+ except SystemError, e:
+ logging.debug("Failed to apply %s->%s install (%s)" % (fr, to, e))
+
+
def dapperQuirks(self):
""" this function works around quirks in the breezy->dapper upgrade """
@@ -202,16 +238,16 @@ class MyCache(apt.Cache):
# upgrade (and make sure this way that the cache is ok)
self.upgrade(True)
- # then see if meta-pkgs are missing
- if not self._installMetaPkgs(view):
- raise SystemError, _("Can't upgrade required meta-packages")
-
# see if our KeepInstalled rules are honored
self.keepInstalledRule()
# and if we have some special rules
self.postUpgradeRule()
+ # then see if meta-pkgs are missing
+ if not self._installMetaPkgs(view):
+ raise SystemError, _("Can't upgrade required meta-packages")
+
# see if it all makes sense
if not self._verifyChanges():
raise SystemError, _("A essential package would have to be removed")
@@ -231,6 +267,15 @@ class MyCache(apt.Cache):
for pkg in self.getChanges():
if pkg.markedDelete:
continue
+ # special case because of a bug in pkg.candidateOrigin
+ if pkg.markedDowngrade:
+ for ver in pkg._pkg.VersionList:
+ # version is lower than installed one
+ if apt_pkg.VersionCompare(ver.VerStr, pkg.installedVersion) < 0:
+ for (verFileIter,index) in ver.FileList:
+ if not origin.trusted:
+ untrusted.append(pkg.name)
+ continue
origins = pkg.candidateOrigin
trusted = False
for origin in origins:
@@ -349,7 +394,7 @@ class MyCache(apt.Cache):
self.restore_snapshot()
return False
except (SystemError,KeyError),e:
- loggging.warning("_tryMarkObsoleteForRemoval failed for '%s' (%s)" % (pkgname,e))
+ logging.warning("_tryMarkObsoleteForRemoval failed for '%s' (%s)" % (pkgname,e))
self.restore_snapshot()
return False
return True
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 7b35f3c8..4e76a65d 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -60,7 +60,8 @@ class AptCdrom(object):
if backup_ext:
cdromstate = os.path.join(apt_pkg.Config.FindDir("Dir::State"),
apt_pkg.Config.Find("Dir::State::cdroms"))
- shutil.copy(cdromstate, cdromstate+backup_ext)
+ if os.path.exists(cdromstate):
+ shutil.copy(cdromstate, cdromstate+backup_ext)
# do the actual work
apt_pkg.Config.Set("Acquire::cdrom::mount",self.cdrompath)
apt_pkg.Config.Set("APT::CDROM::NoMount","true")
@@ -201,7 +202,7 @@ class DistUpgradeControler(object):
# we disable breezy cdrom sources to make sure that demoted
# packages are removed
- if entry.uri.startswith("cdrom:") and entry.dist == "breezy":
+ if entry.uri.startswith("cdrom:") and entry.dist == self.fromDist:
entry.disabled = True
continue
# ignore cdrom sources otherwise
@@ -319,13 +320,17 @@ class DistUpgradeControler(object):
inst = []
up = []
rm = []
+ held = []
for pkg in self.cache:
if pkg.markedInstall: inst.append(pkg.name)
elif pkg.markedUpgrade: up.append(pkg.name)
elif pkg.markedDelete: rm.append(pkg.name)
+ elif (pkg.isInstalled and pkg.isUpgradable): held.append(pkg.name)
+ logging.debug("Held-back: %s" % " ".join(held))
logging.debug("Remove: %s" % " ".join(rm))
logging.debug("Install: %s" % " ".join(inst))
logging.debug("Upgrade: %s" % " ".join(up))
+
def doPreUpgrade(self):
# FIXME: check out what packages are downloadable etc to
@@ -354,7 +359,8 @@ class DistUpgradeControler(object):
continue
# no exception, so all was fine, we are done
return True
-
+
+ logging.error("doUpdate() failed complettely")
self._view.error(_("Error during update"),
_("A problem occured during the update. "
"This is usually some sort of network "
@@ -392,6 +398,7 @@ class DistUpgradeControler(object):
logging.debug("free on %s: %s " % (archivedir, free))
if self.cache.requiredDownload > free:
free_at_least = apt_pkg.SizeToStr(self.cache.requiredDownload-free)
+ logging.error("not enough free space (missing %s)" % free_at_least)
self._view.error(err_sum, err_long % (free_at_least,archivedir))
return False
@@ -456,6 +463,7 @@ class DistUpgradeControler(object):
res = self.cache.commit(fprogress,iprogress)
except SystemError, e:
# installing the packages failed, can't be retried
+ logging.error("SystemError from cache.commit(): %s" % e)
self._view.getTerminal().call(["dpkg","--configure","-a"])
self._view.error(_("Could not install the upgrades"),
_("The upgrade aborts now. Your system "
@@ -475,7 +483,7 @@ class DistUpgradeControler(object):
return True
# maximum fetch-retries reached without a successful commit
- logging.debug("giving up on fetching after maximum retries")
+ logging.error("giving up on fetching after maximum retries")
self._view.error(_("Could not download the upgrades"),
_("The upgrade aborts now. Please check your "\
"internet connection or "\
@@ -560,6 +568,7 @@ class DistUpgradeControler(object):
try:
res = self.cache.commit(fprogress,iprogress)
except (SystemError, IOError), e:
+ logging.error("cache.commit() in doPostUpgrade() failed: %s" % e)
self._view.error(_("Error during commit"),
_("Some problem occured during the clean-up. "
"Please see the below message for more "
@@ -668,6 +677,7 @@ class DistUpgradeControler(object):
self._view.setStep(1)
if not self.prepare():
+ logging.error("self.prepared() failed")
self._view.error(_("Preparing the upgrade failed"),
_("Preparing the system for the upgrade "
"failed. Please report this as a bug "
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index 40617774..109a278b 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -95,12 +95,14 @@ class DistUpgradeView(object):
self.toInstall = []
self.toUpgrade = []
self.toRemove = []
+ self.toDowngrade = []
for pkg in changes:
if pkg.markedInstall: self.toInstall.append(pkg.name)
elif pkg.markedUpgrade: self.toUpgrade.append(pkg.name)
elif pkg.markedDelete: self.toRemove.append(pkg.name)
- # no downgrades, re-installs
- assert(len(self.toInstall)+len(self.toUpgrade)+len(self.toRemove) == len(changes))
+ elif pkg.markedDowngrade: self.toDowngrade.append(pkg.name)
+ # no re-installs
+ assert(len(self.toInstall)+len(self.toUpgrade)+len(self.toRemove)+len(self.toDowngrade) == len(changes))
def askYesNoQuestion(self, summary, msg):
" ask a Yes/No question and return True on 'Yes' "
pass
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index e77fe858..07a94110 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -198,6 +198,7 @@ class GtkInstallProgressAdapter(InstallProgress):
def conffile(self, current, new):
logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current)
+ start = time.time()
#self.expander.set_expanded(True)
prim = _("Replace the customized configuration file\n'%s'?") % current
sec = _("You will lose any changes you have made to this "
@@ -216,6 +217,7 @@ class GtkInstallProgressAdapter(InstallProgress):
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()
+ self.time_ui += time.time() - start
# if replace, send this to the terminal
if res == gtk.RESPONSE_YES:
self.term.feed_child("y\n")
@@ -242,9 +244,11 @@ class GtkInstallProgressAdapter(InstallProgress):
self.last_activity = time.time()
self.activity_timeout_reported = False
delta = self.last_activity - self.start_time
+ # time wasted in conffile questions (or other ui activity)
+ delta -= self.time_ui
time_per_percent = (float(delta)/percent)
eta = (100.0 - self.percent) * time_per_percent
- # only show if we have some sensible data
+ # only show if we have some sensible data (60sec < eta < 2days)
if eta > 61.0 and eta < (60*60*24*2):
self.progress.set_text(_("About %s remaining") % FuzzyTimeToStr(eta))
else:
@@ -263,7 +267,12 @@ class GtkInstallProgressAdapter(InstallProgress):
self.label_status.set_text("")
def updateInterface(self):
- InstallProgress.updateInterface(self)
+ try:
+ InstallProgress.updateInterface(self)
+ except ValueError, e:
+ logging.error("got ValueError from InstallPrgoress.updateInterface. Line was '%s' (%s)" % (self.read, e))
+ # reset self.read so that it can continue reading and does not loop
+ self.read = ""
# check if we haven't started yet with packages, pulse then
if self.start_time == 0.0:
self.progress.pulse()
@@ -316,12 +325,22 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
logging.warning("Error setting locales (%s)" % e)
icons = gtk.icon_theme_get_default()
- gtk.window_set_default_icon(icons.load_icon("update-manager", 32, 0))
+ try:
+ gtk.window_set_default_icon(icons.load_icon("update-manager", 32, 0))
+ except gobject.GError, e:
+ logging.debug("error setting default icon, ignoring (%s)" % e)
+ pass
SimpleGladeApp.__init__(self, gladedir+"/DistUpgrade.glade",
None, domain="update-manager")
- self.last_step = 0 # keep a record of the latest step
+ self.prev_step = 0 # keep a record of the latest step
# we dont use this currently
#self.window_main.set_keep_above(True)
+ self.icontheme = gtk.icon_theme_get_default()
+ # we keep a reference pngloader around so that its in memory
+ # -> this avoid the issue that during the dapper->edgy upgrade
+ # the loaders move from /usr/lib/gtk/2.4.0/loaders to 2.10.0
+ self.pngloader = gtk.gdk.PixbufLoader("png")
+
self.window_main.realize()
self.window_main.window.set_functions(gtk.gdk.FUNC_MOVE)
self._opCacheProgress = GtkOpProgress(self.progressbar_cache)
@@ -410,7 +429,7 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
label.hide()
def abort(self):
size = gtk.ICON_SIZE_MENU
- step = self.last_step
+ step = self.prev_step
if step > 0:
image = getattr(self,"image_step%i" % step)
arrow = getattr(self,"arrow_step%i" % step)
@@ -418,18 +437,20 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
image.show()
arrow.hide()
def setStep(self, step):
- # first update the "last" step as completed
+ if self.icontheme.rescan_if_needed():
+ logging.debug("icon theme changed, re-reading")
+ # first update the "previous" step as completed
size = gtk.ICON_SIZE_MENU
attrlist=pango.AttrList()
- if self.last_step:
- image = getattr(self,"image_step%i" % self.last_step)
- label = getattr(self,"label_step%i" % self.last_step)
- arrow = getattr(self,"arrow_step%i" % self.last_step)
+ if self.prev_step:
+ image = getattr(self,"image_step%i" % self.prev_step)
+ label = getattr(self,"label_step%i" % self.prev_step)
+ arrow = getattr(self,"arrow_step%i" % self.prev_step)
label.set_property("attributes",attrlist)
image.set_from_stock(gtk.STOCK_APPLY, size)
image.show()
arrow.hide()
- self.last_step = step
+ self.prev_step = step
# show the an arrow for the current step and make the label bold
image = getattr(self,"image_step%i" % step)
label = getattr(self,"label_step%i" % step)
@@ -454,6 +475,8 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp):
self.dialog_information.window.set_functions(gtk.gdk.FUNC_MOVE)
self.dialog_information.run()
self.dialog_information.hide()
+ while gtk.events_pending():
+ gtk.main_iteration()
def error(self, summary, msg, extended_msg=None):
self.dialog_error.set_transient_for(self.window_main)
@@ -588,11 +611,11 @@ if __name__ == "__main__":
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)
#sys.exit(0)
ip.conffile("TODO","TODO~")
diff --git a/DistUpgrade/build-tarball.sh b/DistUpgrade/build-tarball.sh
index df9d6506..241eda06 100755
--- a/DistUpgrade/build-tarball.sh
+++ b/DistUpgrade/build-tarball.sh
@@ -4,7 +4,7 @@ DIST=edgy
# cleanup
echo "Cleaning up"
-rm -f *~ *.bak *.pyc *.moved '#'*
+rm -f *~ *.bak *.pyc *.moved '#'* *.rej *.orig
sudo rm -rf backports/ profile/ result/ tarball/ *.deb
diff --git a/DistUpgrade/removal_blacklist.cfg b/DistUpgrade/removal_blacklist.cfg
index 773395be..7bfb114b 100644
--- a/DistUpgrade/removal_blacklist.cfg
+++ b/DistUpgrade/removal_blacklist.cfg
@@ -1,5 +1,6 @@
# blacklist of packages that should never be removed
-ubuntu-base
+ubuntu-standard
+ubuntu-minimal
ubuntu-desktop
kubuntu-destkop
edubuntu-desktop