[Extras-cauldron-commits] r35 - trunk/buildme/buildlib

ed_ at garage.maemo.org ed_ at garage.maemo.org
Sun May 18 17:21:47 EEST 2008


Author: ed_
Date: 2008-05-18 17:21:44 +0300 (Sun, 18 May 2008)
New Revision: 35

Modified:
   trunk/buildme/buildlib/dsc.py
Log:
dsc: raise different exceptions

Modified: trunk/buildme/buildlib/dsc.py
===================================================================
--- trunk/buildme/buildlib/dsc.py	2008-05-18 14:21:00 UTC (rev 34)
+++ trunk/buildme/buildlib/dsc.py	2008-05-18 14:21:44 UTC (rev 35)
@@ -34,6 +34,9 @@
 from minideblib.ChangeFile import ChangeFile, ChangeFileException
 from minideblib.SignedFile import SignedFile
 
+class DscException(Exception): pass
+class LockException(Exception): pass
+
 class Dsc(ChangeFile):
     """ .dsc file with locking and some extra functionality """
 
@@ -47,21 +50,21 @@
         # try to lock the file
         self.lock = Lockf(os.path.join(self._lockdir, name + '.lock'))
         if not self.lock.lock():
-            raise ChangeFileException("%s is locked" % name)
+            raise LockException("%s is locked" % name)
 
         ChangeFile.__init__(self)
 
         try:
             self.load_from_file(fname)
-        except IOError:
-            raise ChangeFileException("Error: Can't read from dsc file '%s'" % name)
+        except IOError, exobj:
+            raise DscException("Error: Can't read from dsc file '%s'" % name)
 
         fptr = open(fname)
         self.signed = SignedFile(fptr).getSigned()
         fptr.close()
 
         if mustbesigned and not self.signed:
-            raise ChangeFileException("Error: file %s isn't signed" % name)
+            raise DscException("Error: file %s isn't signed" % name)
 
         if not exclude:
             exclude = []
@@ -84,7 +87,7 @@
             self._logger.debug("'%s' is signed, checking" % self.fname)
             (rcode, out) = getstatusoutput("gpg --verify %s" % self.fname)
             if rcode:
-                raise ChangeFileException("GPG verification of '%s' failed. gpg returned %s, output: %s" \
+                raise DscException("GPG verification of '%s' failed. gpg returned %s, output: %s" \
                                           % (os.path.basename(self.fname), rcode, out))
 
     def getFiles(self):



More information about the Extras-cauldron-commits mailing list