Merge branch 'allow-publish-packages-with-same-release-versions-for-rhel'

This commit is contained in:
Vokhmin Alexey V 2014-10-15 00:41:00 +04:00
commit d474895c3c
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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