update-manager fails to compile with python 2.4 on hardy

Bug #164947 reported by Rich
14
Affects Status Importance Assigned to Milestone
update-manager (Ubuntu)
Fix Released
High
Michael Vogt

Bug Description

Binary package hint: update-manager

I received the following error on attempting to upgrade to update-manager 1:0.85.3:
Errors were encountered while processing:
 update-manager
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up update-manager (1:0.85.3) ...
Compiling /usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py ...
  File "/usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py", line 452
    finally:
          ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (32)
pycentral pkginstall: error byte-compiling files (32)
dpkg: error processing update-manager (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 update-manager

The issue is that, in Python 2.4, you don't get try-except-finally - you get try(try-except)-finally, but that's not what's in this file.

Changing the try-except-finally block to be a try-finally block with the try-except as its contents (starting at line 414, ending at line 451) fixes this problem.

Revision history for this message
marktechey (marktechey) wrote :

HI,
     Thanks, could you show me or tell me in more detail what you have to change? Thanks

Revision history for this message
marktechey (marktechey) wrote :

Never mind, I figure it out. Here is what mine looks like now, from line 414 to line 456

 try:
     try:
             # upgrade (and make sure this way that the cache is ok)
             self.upgrade(True)

             # check that everythink in priority required is installed
             self.checkPriority()

             # see if our KeepInstalled rules are honored
             self.keepInstalledRule()

             # and if we have some special rules
             self.postUpgradeRule()

             # check if we got a new kernel
             self.checkForKernel()

             # check for third party stuff (envy)
             self.checkThirdPartyQuirks()

             # install missing meta-packages (if not in server upgrade mode)
             if not serverMode:
                    if not self._installMetaPkgs(view):
                        raise SystemError, _("Can't upgrade required meta-packages")

             # see if it all makes sense
             if not self._verifyChanges():
                    if text_mode: _restore_fds(old_stdout, old_stderr)
                    raise SystemError, _("A essential package would have to be removed")
            except SystemError, e:
                # FIXME: change the text to something more useful
             view.error(_("Could not calculate the upgrade"),
                           _("A unresolvable problem occurred while "
                             "calculating the upgrade.\n\n"
                             "Please report this bug against the 'update-manager' "
                             "package and include the files in /var/log/dist-upgrade/ "
                             "in the bugreport."))
             logging.error("Dist-upgrade failed: '%s'", e)
             if text_mode: _restore_fds(old_stdout, old_stderr)
             return False
        finally:
            # wait for the gui-update thread to exit
            lock.release()
            t.join()

Thanks

Revision history for this message
nomux (jens-harms) wrote :

python expects:
  try:
    code
  finally:
    code

OR

  try:
     code
   except ErrorType:
     code

to get update-manager working do this:

mkdir tmp
cd tmp
(speicher das attachment update-manager.patch in dieses verzeichnis)
apt-get source update-manager
dpkg-source -x update-manager_0.85.3.dsc
sudo apt-get build-dep update-manager
cd update-manager-0.85.3/
patch -p0 <../update-manager.patch
dpkg -rfakeroot -uc -us -sa
cd ..
dpkg -i update-manager_0.85.3_all.deb

OK. now installation works

Revision history for this message
L W Randerson (luthrw-deactivatedaccount) wrote : Re: [Bug 164947] update-manager fails to compile with python 2.4 on hardy

Thank you Luther
----- Original Message -----
From: "Rich" <email address hidden>
To: <email address hidden>
Sent: Saturday, November 24, 2007 8:35 PM
Subject: [Bug 164947] update-manager fails to compile with python 2.4 on
hardy

Public bug reported:

Binary package hint: update-manager

I received the following error on attempting to upgrade to update-manager
1:0.85.3:
Errors were encountered while processing:
 update-manager
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up update-manager (1:0.85.3) ...
Compiling /usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py
...
  File "/usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py",
line 452
    finally:
          ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (32)
pycentral pkginstall: error byte-compiling files (32)
dpkg: error processing update-manager (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 update-manager

The issue is that, in Python 2.4, you don't get try-except-finally - you
get try(try-except)-finally, but that's not what's in this file.

Changing the try-except-finally block to be a try-finally block with the
try-except as its contents (starting at line 414, ending at line 451)
fixes this problem.

** Affects: update-manager (Ubuntu)
     Importance: Undecided
         Status: New

--
update-manager fails to compile with python 2.4 on hardy
https://bugs.launchpad.net/bugs/164947
You received this bug notification because you are a bug contact for
update-manager in ubuntu.

Revision history for this message
L W Randerson (luthrw-deactivatedaccount) wrote : Re: [Bug 164947] Re: update-manager fails to compile with python 2.4 onhardy

Have lost the correspondence, but I believe it is working correctly now.
----- Original Message -----
From: "marktechey" <email address hidden>
To: <email address hidden>
Sent: Sunday, November 25, 2007 7:41 AM
Subject: [Bug 164947] Re: update-manager fails to compile with python 2.4
onhardy

HI,
     Thanks, could you show me or tell me in more detail what you have to
change? Thanks

--
update-manager fails to compile with python 2.4 on hardy
https://bugs.launchpad.net/bugs/164947
You received this bug notification because you are a bug contact for
update-manager in ubuntu.

Revision history for this message
Kow (kow) wrote :

I can confirm the problem. The issue here is python < 2.5 lacking try/except/finally statements. The fix is to embed a try/except within the try/finally (as done above.) Yay for python. :-/

Revision history for this message
Rich (rincebrain) wrote :

A number of people have confirmed this, so I'm changing this to confirmed in the hopes that it will get fixed faster - it's really not okay for the update manager to be broken for too long, though I recognize that people running Hardy are far more likely to know how to use alternatives than the average user.

Changed in update-manager:
status: New → Confirmed
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Also confirmed

Setting up update-manager (1:0.85.3) ...
Compiling /usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py ...
  File "/usr/lib/python2.4/site-packages/DistUpgrade/DistUpgradeCache.py", line 452
    finally:
          ^
SyntaxError: invalid syntax

pycentral: pycentral pkginstall: error byte-compiling files (32)
pycentral pkginstall: error byte-compiling files (32)
dpkg: error processing update-manager (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 update-manager

Rich: note that this was reported over a weekend, so it's not likely that Michael will have even looked at his bug list yet

Michael Vogt (mvo)
Changed in update-manager:
assignee: nobody → mvo
importance: Undecided → High
status: Confirmed → In Progress
Revision history for this message
Michael Vogt (mvo) wrote :

update-manager (1:0.85.4) hardy; urgency=low

  * DistUpgrade/DistUpgradeCache.py:
    - do not use python2.5 try:/expect:/finally: - we need to run
      on 2.4 as well for dapper->hardy (LP: #164947)

 -- Michael Vogt <email address hidden> Mon, 26 Nov 2007 10:47:57 +0100

Changed in update-manager:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.