From ce1ec44d79b4accdc236d30c4edbc7c95bb90803 Mon Sep 17 00:00:00 2001 From: Mikhail Gordeev Date: Thu, 30 May 2019 00:21:31 +0300 Subject: [PATCH] Remove old tarballs --- cloud-build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cloud-build.py b/cloud-build.py index 1e88374..03ac669 100755 --- a/cloud-build.py +++ b/cloud-build.py @@ -382,6 +382,12 @@ Dir::Etc::preferencesparts "/var/empty"; for path in os.listdir(directory): 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: self.clear_imager_dir() for branch in self.branches: @@ -401,6 +407,8 @@ Dir::Etc::preferencesparts "/var/empty"; images_in_branch.append(image_path) self.checksum_sign(images_in_branch) + self.remove_old_tarballs() + def checksum_sign(self, images): if len(images) == 0: self.error('Empty list of images to checksum_sign')