aptly_deb_usage: delete orphan files when deploy repos
Database cleanup removes information about unreferenced packages and deletes files in the package pool that aren’t used by packages anymore. Each time we deploy a repo, delete orphan files to keep the database clean. Story: 2008846 Task: 43867 Signed-off-by: ZhangXiao <xiao.zhang@windriver.com> Change-Id: Id4365b6000484969f6b7a74b4e799271eb104dbc
This commit is contained in:
parent
262274093f
commit
b86c4338ea
@ -298,7 +298,7 @@ class Deb_aptly():
|
|||||||
if self.aptly.tasks.show(task.id).state != 'SUCCEEDED':
|
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)
|
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()
|
task = self.aptly.db.cleanup()
|
||||||
self.aptly.tasks.wait_for_task_by_id(task.id)
|
self.aptly.tasks.wait_for_task_by_id(task.id)
|
||||||
|
|
||||||
@ -468,7 +468,11 @@ class Deb_aptly():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if self.__create_snapshot(name, True):
|
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
|
return None
|
||||||
|
|
||||||
# remove a local repository
|
# remove a local repository
|
||||||
@ -507,6 +511,10 @@ class Deb_aptly():
|
|||||||
if self.aptly.tasks.show(task.id).state != 'SUCCEEDED':
|
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)
|
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
|
return None
|
||||||
|
|
||||||
# clean all metadata including remote, repository, public, distribution, task and content
|
# clean all metadata including remote, repository, public, distribution, task and content
|
||||||
@ -554,6 +562,6 @@ class Deb_aptly():
|
|||||||
self.aptly.files.delete(file)
|
self.aptly.files.delete(file)
|
||||||
# clean tasks
|
# clean tasks
|
||||||
self.aptly.tasks.clear()
|
self.aptly.tasks.clear()
|
||||||
# Clean orphans
|
# Delete orphan files
|
||||||
task = self.aptly.db.cleanup()
|
task = self.aptly.db.cleanup()
|
||||||
self.aptly.tasks.wait_for_task_by_id(task.id)
|
self.aptly.tasks.wait_for_task_by_id(task.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user