Ignore some more non-needed files (to reach size coverage targets) and improve error messages

This commit is contained in:
Jakob Lell 2021-09-28 18:13:17 +02:00
parent fe4bfba776
commit f17b7fab2e
1 changed files with 26 additions and 2 deletions

View File

@ -728,7 +728,7 @@ class IgnoreOemImgHandler(FileHandler):
class IgnoreProductImgHandler(FileHandler):
"""
Handler to ignore oem.img files
Handler to ignore product.img files
"""
def check(self) -> CheckFileResult:
if self.fn == b'product.img' or self.fn.startswith(b'product.img.'):
@ -736,6 +736,26 @@ class IgnoreProductImgHandler(FileHandler):
return CheckFileResult.HANDLER_NO_MATCH
class IgnoreSystemExtImgHanlder(FileHandler):
"""
Handler to ignore system_ext.img files
"""
def check(self) -> CheckFileResult:
if self.fn == b'system_ext.img' or self.fn.startswith(b'system_ext.img.'):
return CheckFileResult.IGNORE
return CheckFileResult.HANDLER_NO_MATCH
class IgnoreXromImgHanlder(FileHandler):
"""
Handler to ignore xrom.img files
"""
def check(self) -> CheckFileResult:
if self.fn == b'xrom.img' or self.fn.startswith(b'xrom.img.'):
return CheckFileResult.IGNORE
return CheckFileResult.HANDLER_NO_MATCH
class IgnoreAppsImgHandler(FileHandler):
"""
Handler to ignore apps.img (and apps_X.img) files
@ -954,7 +974,7 @@ class SuperImageHandler(FileHandler):
if not liblp.check_magic(f):
return CheckFileResult.HANDLER_NO_MATCH
if not self.fn.lower().startswith(b'super'):
raise ValueError("Found liblp magic but not in super image, this should not happen")
raise ValueError(f"Found liblp magic in {self.fn} but not in super image, this should not happen")
return CheckFileResult.ARCHIVE
def extract_file2dir(self, output_path_rel):
@ -1759,6 +1779,8 @@ class ArchiveDirectoryHandler:
IgnoreOpImageHandler,
IgnoreOemImgHandler,
IgnoreProductImgHandler,
IgnoreSystemExtImgHanlder,
IgnoreXromImgHanlder,
IgnoreElfHandler,
IgnoreVmlinuxHandler,
BootImageHandler,
@ -1857,6 +1879,8 @@ class ArchiveDirectoryHandler:
IgnoreOpImageHandler,
IgnoreOemImgHandler,
IgnoreProductImgHandler,
IgnoreSystemExtImgHanlder,
IgnoreXromImgHanlder,
IgnoreUpdateHwHandler, # Only for Pass 2
IgnoreHuaweiUserdataAppHandler,
IgnoreElfHandler,