tags 566672 + patch
thanks.

Hi! Sorry about my lag :-)...

I think the attached patch solves this problem. I have tested it with
two packages: first one is known by apt-get previously and upgrade
test is done for it. The other package is not known, so piuparts
informs about that the upgrade test is not possible.

Mainly, the patch is based on the documentation of apt-cache. Its
manual page say that "apt-cache returns zero on normal operation,
decimal 100 on error". With all this, I think it is enough to check if
the return code status is non-zero. I don't know if I have missed
something, so I am cautious saying this :-).

Cheers,
 Cleto.
--- piuparts.py	2010-06-10 09:25:36.000000000 +0200
+++ piuparts.py.new	2010-06-10 09:25:24.000000000 +0200
@@ -731,14 +731,11 @@
     
     def apt_get_knows(self, package_names):
         """Does apt-get (or apt-cache) know about a set of packages?"""
+
         for name in package_names:
             (status, output) = self.run(["apt-cache", "show", name],
                                         ignore_errors=True)
-            if not os.WIFEXITED(status):
-                logging.error("Error occurred when running apt-cache " +
-                              " in chroot:\n" + output)
-                panic()
-            if os.WEXITSTATUS(status) != 0 or not output.strip():
+            if status != 0:
                 return False
         return True
 

Reply via email to