From abeb7fbc1ad5dd4ea61b1903937413f699546175 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 14 Oct 2014 22:19:44 +0400 Subject: [PATCH 1/2] allow publish packages with same release versions for rhel --- app/models/build_list.rb | 5 +++-- spec/models/build_list_spec.rb | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) 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..30173079d 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) + 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 From 6ce333c5a9cfa0ac9f03fa66958f65df1ca5a99f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 14 Oct 2014 23:44:26 +0400 Subject: [PATCH 2/2] upadted specs --- spec/models/build_list_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/build_list_spec.rb b/spec/models/build_list_spec.rb index 30173079d..36929f6f3 100644 --- a/spec/models/build_list_spec.rb +++ b/spec/models/build_list_spec.rb @@ -236,7 +236,7 @@ describe BuildList do 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.save_to_platform.update_attributes(released: true, distrib_type: 'rhel') build_list.has_new_packages?.should be_true end