allow publish packages with same release versions for rhel

This commit is contained in:
Vokhmin Alexey V 2014-10-14 22:19:44 +04:00
parent 5fb74d90bc
commit abeb7fbc1a
2 changed files with 8 additions and 2 deletions

View File

@ -372,7 +372,7 @@ class BuildList < ActiveRecord::Base
# @return [Boolean] # @return [Boolean]
# - false if no new packages # - false if no new packages
# - false if version of packages is less than version of pubished 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. # - true if version of packages is greater than version of pubished packages.
def has_new_packages? def has_new_packages?
if last_bl = last_published.joins(:source_packages).where(build_list_packages: {actual: true}).last 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 } sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
return true unless sp return true unless sp
comparison = nsp.rpmvercmp(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 end
else else
return true # no published packages return true # no published packages

View File

@ -235,6 +235,11 @@ describe BuildList do
build_list.has_new_packages?.should be_false build_list.has_new_packages?.should be_false
end 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)
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 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 build_list.has_new_packages?.should be_true
end end