Remove old tarballs

This commit is contained in:
Mikhail Gordeev 2019-05-30 00:21:31 +03:00
parent 7a53873fc3
commit ce1ec44d79

View File

@ -382,6 +382,12 @@ Dir::Etc::preferencesparts "/var/empty";
for path in os.listdir(directory): for path in os.listdir(directory):
os.unlink(f'{directory}/{path}') os.unlink(f'{directory}/{path}')
def remove_old_tarballs(self):
with self.pushd(self.out_dir):
for tb in os.listdir():
if not re.search(f'-{self.date}-', tb):
os.unlink(tb)
def create_images(self) -> None: def create_images(self) -> None:
self.clear_imager_dir() self.clear_imager_dir()
for branch in self.branches: for branch in self.branches:
@ -401,6 +407,8 @@ Dir::Etc::preferencesparts "/var/empty";
images_in_branch.append(image_path) images_in_branch.append(image_path)
self.checksum_sign(images_in_branch) self.checksum_sign(images_in_branch)
self.remove_old_tarballs()
def checksum_sign(self, images): def checksum_sign(self, images):
if len(images) == 0: if len(images) == 0:
self.error('Empty list of images to checksum_sign') self.error('Empty list of images to checksum_sign')