Merge branch 'master' into 3.2-master

This commit is contained in:
Pavel Chipiga 2012-03-11 23:39:11 +02:00
commit a78b7b4155
2 changed files with 28 additions and 2 deletions

View File

@ -65,12 +65,13 @@ class Project < ActiveRecord::Base
end end
end end
def build_for(platform, user) def build_for(platform, user, arch = 'x86_64') # Return i586 after mass rebuild
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
build_lists.create do |bl| build_lists.create do |bl|
bl.pl = platform bl.pl = platform
bl.bpl = platform bl.bpl = platform
bl.update_type = 'newpackage' bl.update_type = 'newpackage'
bl.arch = Arch.find_by_name('x86_64') # Return i586 after mass rebuild bl.arch = arch
bl.project_version = "latest_#{platform.name}" # "latest_import_mandriva2011" bl.project_version = "latest_#{platform.name}" # "latest_import_mandriva2011"
bl.build_requires = false # already set as db default bl.build_requires = false # already set as db default
bl.user = user bl.user = user

25
lib/tasks/build.rake Normal file
View File

@ -0,0 +1,25 @@
require 'highline/import'
require 'open-uri'
namespace :build do
desc "Build projects from list"
task :projects => :environment do
source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/rebuild_list.txt'
owner = User.find_by_uname!(ENV['OWNER'] || 'warpc')
platform = Platform.find_by_name!(ENV['PLATFORM'] || 'rosa2012lts')
arch = Arch.find_by_name!(ENV['ARCH'] || 'i586')
say "START build projects from #{source} for platform=#{platform.name}, owner=#{owner.uname}, arch=#{arch.name}"
open(source).readlines.each do |name|
name.chomp!; name.strip! #; name.downcase!
if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name)
p.build_for(platform, owner, arch)
say "== Build #{p.name} =="
else
say "== Not found #{name} =="
end
sleep 0.2
end
say 'DONE'
end
end