diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 5f3c5689d..630a9534c 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -372,7 +372,7 @@ class BuildList < ActiveRecord::Base # @return [Boolean] # - false if no new packages # - false if version of packages is less than version of pubished packages. - # - true if version of packages is equal to version of pubished packages (only if platform is not released). + # - true if version of packages is equal to version of pubished packages (only if platform is not released or platform is RHEL). # - true if version of packages is greater than version of pubished packages. def has_new_packages? if last_bl = last_published.joins(:source_packages).where(build_list_packages: {actual: true}).last @@ -380,7 +380,8 @@ class BuildList < ActiveRecord::Base sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name } return true unless sp comparison = nsp.rpmvercmp(sp) - return comparison == 1 || (comparison == 0 && !save_to_platform.released?) + return true if comparison == 1 + return comparison == 0 && ( !save_to_platform.released? || save_to_platform.distrib_type == 'rhel' ) end else return true # no published packages diff --git a/spec/models/build_list_spec.rb b/spec/models/build_list_spec.rb index 53fa60ded..36929f6f3 100644 --- a/spec/models/build_list_spec.rb +++ b/spec/models/build_list_spec.rb @@ -235,6 +235,11 @@ describe BuildList do build_list.has_new_packages?.should be_false end + it 'ensures that return true if version of packages are same and platform RHEL is released' do + build_list.save_to_platform.update_attributes(released: true, distrib_type: 'rhel') + build_list.has_new_packages?.should be_true + end + it 'ensures that return true if version of packages are same and platform is not released' do build_list.has_new_packages?.should be_true end