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}'
|
full_target = f'{target}.{kind}'
|
||||||
tarball_name = f'{image}-{arch}.{kind}'
|
tarball_name = f'{image}-{arch}.{kind}'
|
||||||
tarball_path = self.out_dir / tarball_name
|
tarball_path = self.out_dir / tarball_name
|
||||||
result = None
|
result: Optional[Path] = tarball_path
|
||||||
apt_dir = self.work_dir / 'apt'
|
apt_dir = self.work_dir / 'apt'
|
||||||
with self.pushd(self.work_dir / 'mkimage-profiles'):
|
with self.pushd(self.work_dir / 'mkimage-profiles'):
|
||||||
if not self.should_rebuild(tarball_path):
|
if not self.should_rebuild(tarball_path):
|
||||||
@ -527,8 +527,8 @@ Dir::Etc::preferencesparts "/var/empty";
|
|||||||
|
|
||||||
if os.path.exists(tarball_path):
|
if os.path.exists(tarball_path):
|
||||||
self.info(f'End building of {full_target} {arch}')
|
self.info(f'End building of {full_target} {arch}')
|
||||||
result = tarball_path
|
|
||||||
else:
|
else:
|
||||||
|
result = None
|
||||||
self.build_failed(full_target, arch)
|
self.build_failed(full_target, arch)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -48,3 +48,18 @@ class TestErrors(TestCase):
|
|||||||
self.cb.create_images()
|
self.cb.create_images()
|
||||||
except BuildError:
|
except BuildError:
|
||||||
self.fail(msg)
|
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