Fix not creating images when rebuild
This commit is contained in:
parent
22b02666f4
commit
2135f80dac
@ -508,7 +508,7 @@ Dir::Etc::preferencesparts "/var/empty";
|
||||
full_target = f'{target}.{kind}'
|
||||
tarball_name = f'{image}-{arch}.{kind}'
|
||||
tarball_path = self.out_dir / tarball_name
|
||||
result = None
|
||||
result: Optional[Path] = tarball_path
|
||||
apt_dir = self.work_dir / 'apt'
|
||||
with self.pushd(self.work_dir / 'mkimage-profiles'):
|
||||
if not self.should_rebuild(tarball_path):
|
||||
@ -527,8 +527,8 @@ Dir::Etc::preferencesparts "/var/empty";
|
||||
|
||||
if os.path.exists(tarball_path):
|
||||
self.info(f'End building of {full_target} {arch}')
|
||||
result = tarball_path
|
||||
else:
|
||||
result = None
|
||||
self.build_failed(full_target, arch)
|
||||
|
||||
return result
|
||||
|
@ -48,3 +48,18 @@ class TestErrors(TestCase):
|
||||
self.cb.create_images()
|
||||
except BuildError:
|
||||
self.fail(msg)
|
||||
|
||||
@mock.patch('subprocess.call', call.Call())
|
||||
def test_dont_create_image_when_rebuild(self):
|
||||
tarball = self.data_dir / 'out/docker_Sisyphus-x86_64.tar.xz'
|
||||
tarball.touch()
|
||||
self.cb.create_images()
|
||||
image = (
|
||||
self.data_dir
|
||||
/ 'images'
|
||||
/ 'Sisyphus'
|
||||
/ 'alt-sisyphus-rootfs-minimal-x86_64.tar.xz'
|
||||
)
|
||||
msg = 'Do not create image when rebuild'
|
||||
if not image.exists():
|
||||
self.fail(msg)
|
||||
|
Loading…
Reference in New Issue
Block a user