Rollback to redhillonrails_core instead of schema_plus to avoid some bugs. Add platform reference to project_imports, change indexes and validators. Adjust sync algoritm to use platform_id. Improve rsync params. Refs #112, #138
This commit is contained in:
parent
7848681e2f
commit
fde298cc85
3
Gemfile
3
Gemfile
|
@ -4,7 +4,8 @@ gem 'rails', '3.0.11' #, :git => 'git://github.com/rails/rails.git'
|
||||||
|
|
||||||
gem 'pg', '~> 0.11.0'
|
gem 'pg', '~> 0.11.0'
|
||||||
gem 'silent-postgres', '~> 0.1.1'
|
gem 'silent-postgres', '~> 0.1.1'
|
||||||
gem 'schema_plus', '~> 0.2.1'
|
gem 'redhillonrails_core', '~> 1.2.0' # deprecated
|
||||||
|
# gem 'schema_plus', '~> 0.2.1' # buggy shit!
|
||||||
|
|
||||||
gem 'devise', '~> 1.5.2'
|
gem 'devise', '~> 1.5.2'
|
||||||
gem 'omniauth', '~> 1.0.1'
|
gem 'omniauth', '~> 1.0.1'
|
||||||
|
|
|
@ -155,6 +155,8 @@ GEM
|
||||||
rake (0.9.2.2)
|
rake (0.9.2.2)
|
||||||
rdoc (3.11)
|
rdoc (3.11)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
|
redhillonrails_core (1.2.0)
|
||||||
|
activerecord (>= 2)
|
||||||
rr (1.0.4)
|
rr (1.0.4)
|
||||||
rspec (2.7.0)
|
rspec (2.7.0)
|
||||||
rspec-core (~> 2.7.0)
|
rspec-core (~> 2.7.0)
|
||||||
|
@ -174,9 +176,6 @@ GEM
|
||||||
sexp_processor (~> 3.0)
|
sexp_processor (~> 3.0)
|
||||||
russian (0.6.0)
|
russian (0.6.0)
|
||||||
i18n (>= 0.5.0)
|
i18n (>= 0.5.0)
|
||||||
schema_plus (0.2.1)
|
|
||||||
rails
|
|
||||||
valuable
|
|
||||||
sexp_processor (3.0.8)
|
sexp_processor (3.0.8)
|
||||||
silent-postgres (0.1.1)
|
silent-postgres (0.1.1)
|
||||||
state_machine (0.9.4)
|
state_machine (0.9.4)
|
||||||
|
@ -189,7 +188,6 @@ GEM
|
||||||
kgio (~> 2.4)
|
kgio (~> 2.4)
|
||||||
rack
|
rack
|
||||||
raindrops (~> 0.6)
|
raindrops (~> 0.6)
|
||||||
valuable (0.9.2)
|
|
||||||
warden (1.1.0)
|
warden (1.1.0)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
web-app-theme (0.7.0)
|
web-app-theme (0.7.0)
|
||||||
|
@ -231,11 +229,11 @@ DEPENDENCIES
|
||||||
rails-xmlrpc (~> 0.3.6)
|
rails-xmlrpc (~> 0.3.6)
|
||||||
rails3-generators
|
rails3-generators
|
||||||
rails3-jquery-autocomplete
|
rails3-jquery-autocomplete
|
||||||
|
redhillonrails_core (~> 1.2.0)
|
||||||
rr
|
rr
|
||||||
rspec-rails (~> 2.7.0)
|
rspec-rails (~> 2.7.0)
|
||||||
ruby_parser
|
ruby_parser
|
||||||
russian
|
russian
|
||||||
schema_plus (~> 0.2.1)
|
|
||||||
silent-postgres (~> 0.1.1)
|
silent-postgres (~> 0.1.1)
|
||||||
unicorn (~> 4.1.1)
|
unicorn (~> 4.1.1)
|
||||||
web-app-theme
|
web-app-theme
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class ProjectImport < ActiveRecord::Base
|
class ProjectImport < ActiveRecord::Base
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
belongs_to :platform
|
||||||
|
|
||||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true
|
validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}
|
||||||
|
validates :name, :platform_id, :version, :presence => true
|
||||||
|
|
||||||
scope :by_name, lambda {|name| where('project_imports.name ILIKE ?', name)}
|
scope :by_name, lambda {|name| where('project_imports.name ILIKE ?', name)}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class AddPlatformReferenceToProjectImports < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :project_imports, :platform_id, :integer
|
||||||
|
remove_index :project_imports, :name
|
||||||
|
add_index :project_imports, [:name, :platform_id], :unique => true, :case_sensitive => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_index :project_imports, [:name, :platform_id]
|
||||||
|
add_index :project_imports, :name, :unique => true, :case_sensitive => false
|
||||||
|
remove_column :project_imports, :platform_id
|
||||||
|
end
|
||||||
|
end
|
51
db/schema.rb
51
db/schema.rb
|
@ -1,4 +1,4 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# encoding: UTF-8
|
||||||
# This file is auto-generated from the current state of the database. Instead
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
# of editing this file, please use the migrations feature of Active Record to
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
@ -11,25 +11,27 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20120127234602) do
|
ActiveRecord::Schema.define(:version => 20120131124517) do
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["name"], :name => "index_arches_on_name", :unique => true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
|
||||||
|
|
||||||
create_table "authentications", :force => true do |t|
|
create_table "authentications", :force => true do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "provider"
|
t.string "provider"
|
||||||
t.string "uid"
|
t.string "uid"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
|
||||||
t.index ["user_id"], :name => "index_authentications_on_user_id"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
||||||
|
add_index "authentications", ["user_id"], :name => "index_authentications_on_user_id"
|
||||||
|
|
||||||
create_table "auto_build_lists", :force => true do |t|
|
create_table "auto_build_lists", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "arch_id"
|
t.integer "arch_id"
|
||||||
|
@ -47,9 +49,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "version"
|
t.string "version"
|
||||||
t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "build_list_items", ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
|
||||||
|
|
||||||
create_table "build_lists", :force => true do |t|
|
create_table "build_lists", :force => true do |t|
|
||||||
t.integer "bs_id"
|
t.integer "bs_id"
|
||||||
t.string "container_path"
|
t.string "container_path"
|
||||||
|
@ -72,11 +75,12 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.boolean "auto_publish", :default => true
|
t.boolean "auto_publish", :default => true
|
||||||
t.string "package_version"
|
t.string "package_version"
|
||||||
t.string "commit_hash"
|
t.string "commit_hash"
|
||||||
t.index ["arch_id"], :name => "index_build_lists_on_arch_id"
|
|
||||||
t.index ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
|
||||||
t.index ["project_id"], :name => "index_build_lists_on_project_id"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||||
|
add_index "build_lists", ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
||||||
|
add_index "build_lists", ["project_id"], :name => "index_build_lists_on_project_id"
|
||||||
|
|
||||||
create_table "categories", :force => true do |t|
|
create_table "categories", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "ancestry"
|
t.string "ancestry"
|
||||||
|
@ -113,9 +117,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.string "locked_by"
|
t.string "locked_by"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["priority", "run_at"], :name => "delayed_jobs_priority"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||||
|
|
||||||
create_table "downloads", :force => true do |t|
|
create_table "downloads", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.string "version"
|
t.string "version"
|
||||||
|
@ -159,9 +164,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.string "status", :default => "open"
|
t.string "status", :default => "open"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
||||||
|
|
||||||
create_table "platforms", :force => true do |t|
|
create_table "platforms", :force => true do |t|
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -191,9 +197,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.datetime "notified_at"
|
t.datetime "notified_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["product_id"], :name => "index_product_build_lists_on_product_id"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||||
|
|
||||||
create_table "products", :force => true do |t|
|
create_table "products", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.integer "platform_id", :null => false
|
t.integer "platform_id", :null => false
|
||||||
|
@ -222,8 +229,11 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.datetime "file_mtime"
|
t.datetime "file_mtime"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.integer "platform_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "project_imports", ["platform_id", "name"], :name => "index_project_imports_on_name_and_platform_id", :unique => true, :case_sensitive => false
|
||||||
|
|
||||||
create_table "project_to_repositories", :force => true do |t|
|
create_table "project_to_repositories", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "repository_id"
|
t.integer "repository_id"
|
||||||
|
@ -246,10 +256,11 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.string "srpm_content_type"
|
t.string "srpm_content_type"
|
||||||
t.integer "srpm_file_size"
|
t.integer "srpm_file_size"
|
||||||
t.datetime "srpm_updated_at"
|
t.datetime "srpm_updated_at"
|
||||||
t.index ["category_id"], :name => "index_projects_on_category_id"
|
|
||||||
t.index ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
|
||||||
|
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||||
|
|
||||||
create_table "relations", :force => true do |t|
|
create_table "relations", :force => true do |t|
|
||||||
t.integer "object_id"
|
t.integer "object_id"
|
||||||
t.string "object_type"
|
t.string "object_type"
|
||||||
|
@ -276,10 +287,11 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.index ["project_id"], :name => "index_rpms_on_project_id"
|
|
||||||
t.index ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
||||||
|
add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id"
|
||||||
|
|
||||||
create_table "settings_notifiers", :force => true do |t|
|
create_table "settings_notifiers", :force => true do |t|
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
t.boolean "can_notify", :default => true
|
t.boolean "can_notify", :default => true
|
||||||
|
@ -312,9 +324,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.string "role"
|
t.string "role"
|
||||||
t.string "language", :default => "en"
|
t.string "language", :default => "en"
|
||||||
t.index ["email"], :name => "index_users_on_email", :unique => true
|
|
||||||
t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
|
||||||
t.index ["uname"], :name => "index_users_on_uname", :unique => true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
||||||
|
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||||
|
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace :import do
|
||||||
source = "rsync://mirror.yandex.ru/mandriva/#{release}/SRPMS/#{repository}/"
|
source = "rsync://mirror.yandex.ru/mandriva/#{release}/SRPMS/#{repository}/"
|
||||||
destination = ENV['DESTINATION'] || File.join(APP_CONFIG['root_path'], 'mirror.yandex.ru', 'mandriva', release, 'SRPMS', repository)
|
destination = ENV['DESTINATION'] || File.join(APP_CONFIG['root_path'], 'mirror.yandex.ru', 'mandriva', release, 'SRPMS', repository)
|
||||||
say "START rsync projects (*.src.rpm) from '#{source}' to '#{destination}'"
|
say "START rsync projects (*.src.rpm) from '#{source}' to '#{destination}'"
|
||||||
if system "rsync -rtv --delete #{source} #{destination}" # TODO --include='*.src.rpm' --exclude='*'
|
if system "rsync -rtv --delete --exclude='backports/*' --exclude='testing/*' #{source} #{destination}" # --include='*.src.rpm'
|
||||||
say 'Rsync ok!'
|
say 'Rsync ok!'
|
||||||
else
|
else
|
||||||
say 'Rsync failed!'
|
say 'Rsync failed!'
|
||||||
|
@ -69,7 +69,7 @@ namespace :import do
|
||||||
say "=== Processing '#{srpm_file}'..."
|
say "=== Processing '#{srpm_file}'..."
|
||||||
if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? and
|
if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? and
|
||||||
version = `rpm -q --qf '[%{Version}]' -p #{srpm_file}` and $?.success? and version.present?
|
version = `rpm -q --qf '[%{Version}]' -p #{srpm_file}` and $?.success? and version.present?
|
||||||
project_import = ProjectImport.find_by_name(name) || ProjectImport.by_name(name).first || ProjectImport.new(:name => name)
|
project_import = ProjectImport.find_by_name_and_platform_id(name, platform.id) || ProjectImport.by_name(name).where(:platform_id => platform.id).first || ProjectImport.new(:name => name, :platform_id => platform.id)
|
||||||
if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime
|
if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime
|
||||||
unless project = project_import.project
|
unless project = project_import.project
|
||||||
if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup
|
if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup
|
||||||
|
@ -89,6 +89,7 @@ namespace :import do
|
||||||
say "New version (#{version}) for '#{project.owner.uname}/#{project.name}' successfully imported to branch '#{branch}'!"
|
say "New version (#{version}) for '#{project.owner.uname}/#{project.name}' successfully imported to branch '#{branch}'!"
|
||||||
|
|
||||||
project_import.project = project
|
project_import.project = project
|
||||||
|
# project_import.platform = platform
|
||||||
project_import.version = version
|
project_import.version = version
|
||||||
project_import.file_mtime = File.mtime(srpm_file)
|
project_import.file_mtime = File.mtime(srpm_file)
|
||||||
project_import.save!
|
project_import.save!
|
||||||
|
|
Loading…
Reference in New Issue