Handle EnvironmentError instead of OSError since open()
authorZac Medico <zmedico@gentoo.org>
Thu, 18 Oct 2007 21:08:40 +0000 (21:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 18 Oct 2007 21:08:40 +0000 (21:08 -0000)
actually raises IOError. Also, treat a missing SLOT
file as SLOT="" since it is currently possible to
install an ebuild with an undefined SLOT even though
repoman generates a SLOT.missing error with such an
ebuild.

svn path=/main/trunk/; revision=8174

pym/portage/dbapi/vartree.py

index cca5ca9a3816cfb4cfc4aa1be9b65f9c3cb7f55d..45badc3e37ffcfbf3b0085b09ca571cae7312abd 100644 (file)
@@ -1672,16 +1672,20 @@ class dblink(object):
                        return 1
 
                inforoot_slot_file = os.path.join(inforoot, "SLOT")
+               slot = None
                try:
                        f = open(inforoot_slot_file)
                        try:
                                slot = f.read().strip()
                        finally:
                                f.close()
-               except OSError, e:
-                       writemsg("!!! Error reading '%s': %s\n" % (inforoot_slot_file, e),
-                               noiselevel=-1)
-                       return 1
+               except EnvironmentError, e:
+                       if e.errno != errno.ENOENT:
+                               raise
+                       del e
+
+               if slot is None:
+                       slot = ""
 
                if slot != self.settings["SLOT"]:
                        writemsg("!!! WARNING: Expected SLOT='%s', got '%s'\n" % \