|
|
|
@ -1,14 +1,15 @@
|
|
|
|
|
require_relative "spork"
|
|
|
|
|
require_relative "runner"
|
|
|
|
|
require "fileutils"
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
#mock -r /home/alexey/workspace/ruby-projects/mock-gui/projects/prjt1.prj/configs/prjt1.cfg --buildsrpm --spec srcprp/bayrepo_neuro_farm.spec --sources srcprp/ --resultdir result/ --isolation=simple --disable-plugin=ccache
|
|
|
|
|
#mock -r /home/alexey/workspace/ruby-projects/mock-gui/projects/prjt1.prj/configs/prjt1.cfg result/bayrepo-neuro-farm-0.1-2.src.rpm --resultdir result2/ --isolation simple
|
|
|
|
|
|
|
|
|
|
class MockManager
|
|
|
|
|
attr :path, :config, :error, :last_status, :last_pid, :prep_dir, :db
|
|
|
|
|
attr :path, :config, :error, :last_status, :last_pid, :prep_dir, :db, :resultpath, :process_log, :repo_path
|
|
|
|
|
|
|
|
|
|
def initialize(path, config, cfg_counter_path, db)
|
|
|
|
|
def initialize(path, config, cfg_counter_path, db, result_path, repo_path)
|
|
|
|
|
@error = nil
|
|
|
|
|
unless File.exist? (path)
|
|
|
|
|
Dir.mkdir(path)
|
|
|
|
@ -17,6 +18,8 @@ class MockManager
|
|
|
|
|
@config = config
|
|
|
|
|
cntr = 0
|
|
|
|
|
@db = db
|
|
|
|
|
@resultpath = result_path
|
|
|
|
|
@repo_path = repo_path
|
|
|
|
|
|
|
|
|
|
File.open(cfg_counter_path, "r+") do |f|
|
|
|
|
|
f.flock(File::LOCK_EX)
|
|
|
|
@ -28,6 +31,20 @@ class MockManager
|
|
|
|
|
end
|
|
|
|
|
tmp_name = (0...10).map { ("a".."z").to_a[rand(26)] }.join
|
|
|
|
|
@prep_dir = File.join(path, "#{cntr}_#{tmp_name}")
|
|
|
|
|
pp @prep_dir
|
|
|
|
|
@process_log = File.join(@prep_dir, "process.log")
|
|
|
|
|
Dir.mkdir(@prep_dir)
|
|
|
|
|
FileUtils.touch(@process_log)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_build_process_log()
|
|
|
|
|
@process_log
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def finalize_build_task()
|
|
|
|
|
FileUtils.rm_rf(@path)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def build_task()
|
|
|
|
|
finalize_build_task
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|