diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 0f8b8cade..3a513161b 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -280,6 +280,20 @@ class BuildList < ActiveRecord::Base build_started? || build_pending? end + def can_auto_publish? + return false if !(auto_publish? && can_publish?) + + if last_bl = last_published.last + return true if last_bl.source_packages.count != source_packages.count + last_bl.source_packages.each do |sp| + return true if source_packages.find{ |nsp| nsp.name == sp.name && nsp.version > sp.version } + end + else + return true # no published packages + end + return false # no new packages + end + def can_publish? [SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(:id => project_id) end diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb index bc128adfc..eebe2f669 100644 --- a/lib/abf_worker/rpm_worker_observer.rb +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -17,7 +17,7 @@ module AbfWorker case status when COMPLETED subject.build_success - subject.now_publish if subject.auto_publish? && subject.can_publish? + subject.now_publish if subject.can_auto_publish? when FAILED subject.build_error item.update_attributes({:status => BuildList::BUILD_ERROR})