Cleanup old packages from testing sub repository

This commit is contained in:
Vokhmin Alexey V 2013-11-18 18:59:12 +04:00
parent 2899728a33
commit e30920d185
2 changed files with 4 additions and 4 deletions

View File

@ -427,12 +427,12 @@ class BuildList < ActiveRecord::Base
new_core? ? abf_worker_log : I18n.t('layout.build_lists.log.not_available')
end
def last_published
def last_published(testing = false)
BuildList.where(:project_id => self.project_id,
:save_to_repository_id => self.save_to_repository_id)
.for_platform(self.build_for_platform_id)
.scoped_to_arch(self.arch_id)
.for_status(BUILD_PUBLISHED)
.for_status(testing ? BUILD_PUBLISHED_INTO_TESTING : BUILD_PUBLISHED)
.recent
end

View File

@ -132,7 +132,7 @@ module AbfWorker
old_packages = packages_structure
build_lists_for_cleanup.each do |bl|
bl.last_published.includes(:packages).limit(2).each{ |old_bl|
bl.last_published(testing).includes(:packages).limit(2).each{ |old_bl|
fill_packages(old_bl, old_packages, :fullname)
}
end
@ -309,7 +309,7 @@ module AbfWorker
# remove duplicates of sources for different arches
bl.packages.by_package_type('source').each{ |s| new_sources["#{s.fullname}"] = s.sha1 }
self.class.fill_packages(bl, packages)
bl.last_published.includes(:packages).limit(2).each{ |old_bl|
bl.last_published(testing).includes(:packages).limit(2).each{ |old_bl|
self.class.fill_packages(old_bl, old_packages, :fullname)
}
build_list_ids << bl.id