From e30920d1854dc37472cb6c7097e7b49fa644589f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 18 Nov 2013 18:59:12 +0400 Subject: [PATCH] Cleanup old packages from testing sub repository --- app/models/build_list.rb | 4 ++-- lib/abf_worker/build_lists_publish_task_manager.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index f4a3260a4..5bf4216c4 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -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 diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index c98d6fcc5..2e4996695 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -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