diff --git a/Gemfile b/Gemfile index 7a5bf7ceb..cea408700 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '3.2.8' #, :git => 'git://github.com/rails/rails.git' +gem 'rails', '3.2.9' #, :git => 'git://github.com/rails/rails.git' gem 'pg', '~> 0.14.0' # gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 5683760b9..c4c90b960 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,31 +25,31 @@ GEM remote: http://rubygems.org/ specs: RedCloth (4.2.9) - actionmailer (3.2.8) - actionpack (= 3.2.8) + actionmailer (3.2.9) + actionpack (= 3.2.9) mail (~> 2.4.4) - actionpack (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + actionpack (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) rack (~> 1.4.0) rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.3) - activemodel (3.2.8) - activesupport (= 3.2.8) + sprockets (~> 2.2.1) + activemodel (3.2.9) + activesupport (= 3.2.9) builder (~> 3.0.0) - activerecord (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + activerecord (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - activesupport (3.2.8) + activeresource (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) + activesupport (3.2.9) i18n (~> 0.6) multi_json (~> 1.0) airbrake (3.1.2) @@ -65,7 +65,7 @@ GEM daemons (~> 1.1.4, <= 1.1.6) i18n (>= 0.5.0) state_machine (~> 1.1.0) - builder (3.0.0) + builder (3.0.4) cancan (1.6.7) cape (1.4.0) capistrano (2.12.0) @@ -144,14 +144,14 @@ GEM highline (1.6.13) hike (1.2.1) hirb (0.7.0) - i18n (0.6.0) + i18n (0.6.1) jbuilder (0.8.2) activesupport (>= 3.0.0) journey (1.0.4) jquery-rails (2.0.2) railties (>= 3.2.0, < 5.0) thor (~> 0.14) - json (1.7.4) + json (1.7.5) kgio (2.7.4) libv8 (3.3.10.4) macaddr (1.6.1) @@ -172,7 +172,7 @@ GEM meta-tags (1.2.6) actionpack mime-types (1.19) - multi_json (1.3.6) + multi_json (1.5.0) mustache (0.99.4) net-scp (1.0.4) net-ssh (>= 1.99.1) @@ -215,18 +215,18 @@ GEM rack rack-ssl (1.3.2) rack - rack-test (0.6.1) + rack-test (0.6.2) rack (>= 1.0) rack-throttle (0.3.0) rack (>= 1.0.0) - rails (3.2.8) - actionmailer (= 3.2.8) - actionpack (= 3.2.8) - activerecord (= 3.2.8) - activeresource (= 3.2.8) - activesupport (= 3.2.8) + rails (3.2.9) + actionmailer (= 3.2.9) + actionpack (= 3.2.9) + activerecord (= 3.2.9) + activeresource (= 3.2.9) + activesupport (= 3.2.9) bundler (~> 1.0) - railties (= 3.2.8) + railties (= 3.2.9) rails-backbone (0.7.2) coffee-script (~> 2.2.0) ejs (~> 1.0.0) @@ -235,15 +235,15 @@ GEM railties (>= 3.0.0) rails3-jquery-autocomplete (1.0.7) rails (~> 3.0) - railties (3.2.8) - actionpack (= 3.2.8) - activesupport (= 3.2.8) + railties (3.2.9) + actionpack (= 3.2.9) + activesupport (= 3.2.9) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.10.0) - rake (0.9.2.2) + rake (10.0.3) rdiscount (1.6.8) rdoc (3.12) json (~> 1.4) @@ -314,8 +314,9 @@ GEM skinny (0.2.1) eventmachine (~> 0.12) thin (~> 1.2) - sprockets (2.1.3) + sprockets (2.2.2) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.6) @@ -330,10 +331,10 @@ GEM rack (>= 1.0.0) thor (0.16.0) tilt (1.3.3) - treetop (1.4.10) + treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.33) + tzinfo (0.3.35) uglifier (1.2.7) execjs (>= 0.3.0) multi_json (~> 1.3) @@ -393,7 +394,7 @@ DEPENDENCIES perform_later (~> 1.3.0) pg (~> 0.14.0) rack-throttle - rails (= 3.2.8) + rails (= 3.2.9) rails-backbone (~> 0.7.2) rails3-generators rails3-jquery-autocomplete (~> 1.0.7) diff --git a/app/models/platform.rb b/app/models/platform.rb index e5e75d560..d5962f9da 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -156,10 +156,6 @@ class Platform < ActiveRecord::Base end end - def create_directory - system("sudo mkdir -p -m 0777 #{build_path [name, 'repositories']}") - end - def symlink_directory # umount_directory_for_rsync # TODO ignore errors system("ln -s #{path} #{symlink_path}") @@ -212,8 +208,13 @@ class Platform < ActiveRecord::Base end later :destroy, :queue => :clone_build + protected + def create_directory + system("mkdir -p -m 0777 #{build_path([name, 'repository'])}") + end + def default_host EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] end diff --git a/app/models/repository.rb b/app/models/repository.rb index ceafea800..00314ddad 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -16,8 +16,7 @@ class Repository < ActiveRecord::Base scope :recent, order("name ASC") - before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]} - before_destroy :destroy_directory + before_destroy :detele_directory attr_accessible :name, :description, :publish_without_qa attr_readonly :name, :platform_id @@ -59,21 +58,30 @@ class Repository < ActiveRecord::Base end end + def destroy + with_skip {super} # avoid cascade XML RPC requests + end + later :destroy, :queue => :clone_build + protected - # TODO: remove it, when will be used new_core only. - def xml_rpc_create - result = BuildServer.create_repo name, platform.name - if result == BuildServer::SUCCESS - return true + def detele_directory + repository_path = platform.path + repository_path << '/repository' + if platform.personal? + Platform.main.pluck(:name).each do |main_platform_name| + detele_repositories_directory "#{repository_path}/#{main_platform_name}" + end else - raise "Failed to create repository #{name} inside platform #{platform.name} with code #{result}." + detele_repositories_directory repository_path end end - def destroy_directory - Resque.enqueue(AbfWorker::FileSystemWorker, - {:id => id, :action => 'destroy', :type => 'repository'}) - return true + def detele_repositories_directory(repository_path) + Arch.pluck(:name).each do |arch| + system("rm -rf #{repository_path}/#{arch}/#{name}") + end + system("rm -rf #{repository_path}/SRPMS/#{name}") end + end diff --git a/config/environments/development.rb b/config/environments/development.rb index 6e27623e8..1663eccf7 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -45,5 +45,5 @@ end require 'stub_xml_rpc' Rails.application.config.to_prepare { - Platform.send :include, Modules::Models::SymlinkStub + # Platform.send :include, Modules::Models::SymlinkStub }