Merge pull request #283 from warpc/282-build_projects
[Refs #282] * Add configurable arch parameter to project build_for method * Write rake task for projects build
This commit is contained in:
commit
cb86ae6959
|
@ -61,12 +61,13 @@ class Project < ActiveRecord::Base
|
|||
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|
|
||||
bl.pl = platform
|
||||
bl.bpl = platform
|
||||
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.build_requires = false # already set as db default
|
||||
bl.user = user
|
||||
|
|
|
@ -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'
|
||||
user = User.find_by_uname(ENV['USER'] || '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}, user=#{user.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, user, arch)
|
||||
say "== Build #{p.name} =="
|
||||
else
|
||||
say "== Not found #{name} =="
|
||||
end
|
||||
sleep 0.2
|
||||
end
|
||||
say 'DONE'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue