Bug#726156: latest APT breaks InstallProgress

2013-10-14 Thread Michael Vogt
On Sun, Oct 13, 2013 at 09:34:29PM +0200, Julian Andres Klode wrote:
 On Sat, Oct 12, 2013 at 11:21:32PM +0200, Eugenio 'g7' Paolantonio wrote:
[..]
  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).
[..]
 
 There are more cases that need to be handled. I'll take a look at
 it tomorrow.

This is a unintended side-effect of the fix in libapt for parsing the
dpkg progress multiarch status information. 

The mixing of the : as the architecture qualifier and the delimiter
is one part of the problem, the other that apt is re-using the dpkg
status stream format instead of better abstracting this away from the
apt frontends. So we need quoting or we make apt always send the
architecture information. Either way it will break existing frontends
that parse this data.

The better option IMO is to have a proper pkgInstallProgress class that
python-apt/synaptic/aptitude can use (just like pkgAcquireStatus). I
started to explore this in my feature/install-progress-refactor
branch. 

Cheers,
 Michael


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#726156: latest APT breaks InstallProgress

2013-10-13 Thread Julian Andres Klode
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.0 +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/.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#726156: latest APT breaks InstallProgress

2013-10-12 Thread Eugenio 'g7' Paolantonio
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.0 +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