diff --git a/build-tools/stx/aptly_deb_usage.py b/build-tools/stx/aptly_deb_usage.py index 3cc53609..d221a83e 100755 --- a/build-tools/stx/aptly_deb_usage.py +++ b/build-tools/stx/aptly_deb_usage.py @@ -298,7 +298,7 @@ class Deb_aptly(): if self.aptly.tasks.show(task.id).state != 'SUCCEEDED': self.logger.warning('Drop mirror failed %s : %s', name, self.aptly.tasks.show(task.id).state) - # Clean orphans + # Delete orphan files task = self.aptly.db.cleanup() self.aptly.tasks.wait_for_task_by_id(task.id) @@ -468,7 +468,11 @@ class Deb_aptly(): return None if self.__create_snapshot(name, True): - return self.__publish_snap(name) + ret = self.__publish_snap(name) + # Delete orphan files + task = self.aptly.db.cleanup() + self.aptly.tasks.wait_for_task_by_id(task.id) + return ret return None # remove a local repository @@ -507,6 +511,10 @@ class Deb_aptly(): if self.aptly.tasks.show(task.id).state != 'SUCCEEDED': self.logger.warning('Drop repo failed %s : %s', name, self.aptly.tasks.show(task.id).state) + # Delete orphan files + task = self.aptly.db.cleanup() + self.aptly.tasks.wait_for_task_by_id(task.id) + return None # clean all metadata including remote, repository, public, distribution, task and content @@ -554,6 +562,6 @@ class Deb_aptly(): self.aptly.files.delete(file) # clean tasks self.aptly.tasks.clear() - # Clean orphans + # Delete orphan files task = self.aptly.db.cleanup() self.aptly.tasks.wait_for_task_by_id(task.id)