1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-07 13:48:43 +02:00

catch cpio errors

TODO: detect if returned file is XML with error code
This commit is contained in:
Ludwig Nussel
2010-05-06 14:24:06 +02:00
parent 05e0cb620b
commit 7024449cd8
2 changed files with 9 additions and 1 deletions

View File

@@ -31,6 +31,8 @@ class CpioError(Exception):
Exception.__init__(self)
self.file = fn
self.msg = msg
def __str__(self):
return '%s: %s' % (self.file, self.msg)
class CpioHdr:
"""
@@ -159,7 +161,7 @@ class CpioRead:
data = self.__file.read(6)
self.format = data
if not self.format in self.sfmt.values():
raise CpioError(self.filename, '\'%s\' is not a supported cpio format' % self.filename)
raise CpioError(self.filename, '\'%s\' is not a supported cpio format' % self.format)
pos = 0
while (len(data) != 0):
self.__file.seek(pos, os.SEEK_SET)