[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#726156: latest APT breaks InstallProgress



On Sat, Oct 12, 2013 at 11:21:32PM +0200, Eugenio 'g7' Paolantonio wrote:
> Package: python-apt
> Version: 0.8.9.1
> Tags: patch
> 
> Hello,
> 
> 
> It seems that the latest APT update breaks the base python-apt
> InstallProgress, as some package names in the status stream also feature
> the package architecture (packagename:arch).
> 
> This is the produced traceback:
> 
> 
> Traceback (most recent call last):
>   File "/usr/bin/bricks", line 181, in run
>     engine.cache.commit(AcquireProgress(self.parent),
> InstallProgress(self.parent))
>   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 504, in commit
>     res = self.install_archives(pm, install_progress)
>   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 467, in
> install_archives
>     res = install_progress.run(pm)
>   File "/usr/lib/python2.7/dist-packages/apt/progress/base.py", line
> 206, in run
>     res = self.wait_child()
>   File "/usr/lib/python2.7/dist-packages/apt/progress/base.py", line
> 276, in wait_child
>     self.update_interface()
>   File "/usr/lib/python2.7/dist-packages/apt/progress/base.py", line
> 253, in update_interface
>     if float(percent) != self.percent or status_str != self.status:
> ValueError: could not convert string to float: amd64
> 
> 
> I'm attaching a quick and dirty patch that fixes the issue.
> 
> 
> Regards,
> Eugenio
> 
> -- 
> .: Eugenio Paolantonio - Semplice Linux developer :.
> 
> http://semplice-linux.org
> http://medesimo.eu
> 
> Twitter: @eugenio_g7 - Homepage: http://me.medesimo.eu

> --- orig/apt/progress/base.py	2013-06-06 18:32:36.000000000 +0200
> +++ mod/apt/progress/base.py	2013-10-12 22:27:54.050668349 +0200
> @@ -221,10 +221,17 @@
>              return
>  
>          pkgname = status = status_str = percent = base = ""
> +        architecture = "all"
>  
>          if line.startswith('pm'):
>              try:
>                  (status, pkgname, percent, status_str) = line.split(":", 3)
> +                # Handle pkgnames with :architecture, otherwise we'll later
> +                # try to make the package architecture a float.
> +                try:
> +                    float(percent)
> +                except ValueError:
> +                    (status, pkgname, architecture, percent, status_str) = line.split(":", 4)
>              except ValueError:
>                  # silently ignore lines that can't be parsed
>                  return

There are more cases that need to be handled. I'll take a look at
it tomorrow.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.


Reply to: