Merge #365 `Make image test at end of compose less strict`

This commit is contained in:
Dennis Gilmore 2016-08-16 20:53:23 +00:00
commit 492cdec719
2 changed files with 7 additions and 10 deletions

View File

@ -268,6 +268,7 @@ class CreateIsoThread(WorkerThread):
img.bootable = cmd["bootable"] img.bootable = cmd["bootable"]
img.subvariant = variant.uid img.subvariant = variant.uid
img.implant_md5 = iso.get_implanted_md5(cmd["iso_path"]) img.implant_md5 = iso.get_implanted_md5(cmd["iso_path"])
setattr(img, 'can_fail', compose.can_fail(variant, arch, 'iso'))
setattr(img, 'deliverable', 'iso') setattr(img, 'deliverable', 'iso')
try: try:
img.volume_id = iso.get_volume_id(cmd["iso_path"]) img.volume_id = iso.get_volume_id(cmd["iso_path"])

View File

@ -106,8 +106,8 @@ def run_repoclosure(compose):
def check_image_sanity(compose): def check_image_sanity(compose):
""" """
Go through all images in manifest and make basic sanity tests on them. If Go through all images in manifest and make basic sanity tests on them. If
any check fails for a failable deliverable, it will be removed from any check fails for a failable deliverable, a message will be printed and
manifest and logged. Otherwise the compose will be aborted. logged. Otherwise the compose will be aborted.
""" """
im = compose.im im = compose.im
for variant in compose.get_variants(): for variant in compose.get_variants():
@ -116,13 +116,11 @@ def check_image_sanity(compose):
for arch in variant.arches: for arch in variant.arches:
if arch not in im.images[variant.uid]: if arch not in im.images[variant.uid]:
continue continue
images = im.images[variant.uid][arch] for img in im.images[variant.uid][arch]:
im.images[variant.uid][arch] = [img for img in images check(compose, variant, arch, img)
if check(compose, variant, arch, img)]
def check(compose, variant, arch, image): def check(compose, variant, arch, image):
result = True
path = os.path.join(compose.paths.compose.topdir(), image.path) path = os.path.join(compose.paths.compose.topdir(), image.path)
deliverable = getattr(image, 'deliverable') deliverable = getattr(image, 'deliverable')
can_fail = getattr(image, 'can_fail', False) can_fail = getattr(image, 'can_fail', False)
@ -131,19 +129,17 @@ def check(compose, variant, arch, image):
with open(path) as f: with open(path) as f:
iso = is_iso(f) iso = is_iso(f)
if image.format == 'iso' and not iso: if image.format == 'iso' and not iso:
result = False
raise RuntimeError('%s does not look like an ISO file' % path) raise RuntimeError('%s does not look like an ISO file' % path)
if (image.arch in ('x86_64', 'i386') and if (image.arch in ('x86_64', 'i386') and
image.bootable and image.bootable and
not has_mbr(f) and not has_mbr(f) and
not has_gpt(f) and not has_gpt(f) and
not (iso and has_eltorito(f))): not (iso and has_eltorito(f))):
result = False
raise RuntimeError( raise RuntimeError(
'%s is supposed to be bootable, but does not have MBR nor ' '%s is supposed to be bootable, but does not have MBR nor '
'GPT nor is it a bootable ISO' % path) 'GPT nor is it a bootable ISO' % path)
# If exception is raised above, failable may catch it # If exception is raised above, failable may catch it, in which case
return result # nothing else will happen.
def _check_magic(f, offset, bytes): def _check_magic(f, offset, bytes):