#46: not publish new builds into repository if project of builds has been removed from repository

This commit is contained in:
Vokhmin Alexey V 2013-03-22 15:43:22 +04:00
parent 2da7db2217
commit 67cf79fac2
1 changed files with 11 additions and 7 deletions

View File

@ -228,6 +228,17 @@ module AbfWorker
end
def create_rpm_build_task(save_to_repository_id, build_for_platform_id)
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ }
# We should not to publish new builds into repository
# if project of builds has been removed from repository.
BuildList.where(
:project_id => projects_for_cleanup.map{ |k| k.split('-')[0] }.uniq,
:save_to_repository_id => repository.id,
:status => BuildList::BUILD_PUBLISH
).update_all(:status => BuildList::FAILED_PUBLISH)
build_lists = BuildList.
where(:new_core => true, :status => BuildList::BUILD_PUBLISH).
where(:save_to_repository_id => save_to_repository_id).
@ -237,13 +248,6 @@ module AbfWorker
build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty?
build_lists = build_lists.limit(50)
project_ids = build_lists.pluck(:project_id).uniq
# Projects which should be removed:
# - /#{save_to_repository_id}\-#{build_for_platform_id}$/ - from repository;
# - /^(#{project_ids.join('|')})\-/ - not published in current transaction.
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ && k !~ /^(#{project_ids.join('|')})\-/ }
old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}
projects_for_cleanup.each do |key|