2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-04-05 22:35:22 +01:00
|
|
|
require 'xmlrpc/client'
|
2011-11-22 19:21:09 +00:00
|
|
|
|
2011-04-05 22:35:22 +01:00
|
|
|
class BuildServer
|
|
|
|
|
|
|
|
SUCCESS = 0
|
|
|
|
ERROR = 1
|
|
|
|
|
|
|
|
PLATFORM_NOT_FOUND = 1
|
|
|
|
PLATFORM_PENDING = 2
|
|
|
|
PROJECT_NOT_FOUND = 3
|
2011-10-23 11:34:42 +01:00
|
|
|
PROJECT_VERSION_NOT_FOUND = 4
|
2011-12-12 12:34:20 +00:00
|
|
|
PROJECT_SOURCE_ERROR = 6
|
|
|
|
|
|
|
|
DEPENDENCY_TEST_FAILED = 21
|
|
|
|
BINARY_TEST_FAILED = 22
|
2011-04-05 22:35:22 +01:00
|
|
|
|
2011-12-12 12:34:20 +00:00
|
|
|
DEPENDENCIES_ERROR = 555
|
2011-10-29 18:50:47 +01:00
|
|
|
BUILD_ERROR = 666
|
2011-12-12 12:34:20 +00:00
|
|
|
BUILD_STARTED = 3000
|
2011-04-05 22:35:22 +01:00
|
|
|
|
|
|
|
def self.client
|
2011-04-14 08:23:08 +01:00
|
|
|
@@client ||= XMLRPC::Client.new3('host' => APP_CONFIG['build_server_ip'], 'port' => APP_CONFIG['build_server_port'], 'path' => APP_CONFIG['build_server_path'])
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2011-10-27 22:14:08 +01:00
|
|
|
def self.add_platform name, platforms_root_folder, distrib_type, repos = {:src => [], :rpm => []}
|
|
|
|
self.client.call('add_platform', name, platforms_root_folder, repos, distrib_type)
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.delete_platform name
|
|
|
|
self.client.call('delete_platform', name)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.clone_platform new_name, old_name, new_root_folder
|
|
|
|
self.client.call('clone_platform', new_name, old_name, new_root_folder)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.create_repo name, platform_name
|
2011-04-07 10:27:30 +01:00
|
|
|
self.client.call('create_repository', name, platform_name)
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2011-04-07 10:27:30 +01:00
|
|
|
def self.delete_repo name, platform_name
|
|
|
|
self.client.call('delete_repository', name, platform_name)
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.clone_repo new_name, old_name, new_platform_name
|
|
|
|
self.client.call('clone_repo', new_name, old_name, new_platform_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.publish_container container_id
|
|
|
|
self.client.call('publish_container', container_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.delete_container container_id
|
|
|
|
self.client.call('delete_container', container_id)
|
|
|
|
end
|
|
|
|
|
2011-10-28 13:27:13 +01:00
|
|
|
def self.create_project name, platform_name, repo_name, git_project_path
|
2011-10-28 14:53:46 +01:00
|
|
|
self.client.call('create_project', name, platform_name, repo_name, git_project_path)
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.delete_project name, platform_name
|
|
|
|
self.client.call('delete_project', name, platform_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.add_to_repo name, repo_name
|
|
|
|
self.client.call('add_to_repo', name, repo_name)
|
|
|
|
end
|
|
|
|
|
2011-12-21 14:01:50 +00:00
|
|
|
def self.add_build_list project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos
|
2011-12-21 18:59:19 +00:00
|
|
|
include_repos_hash = {}.tap do |h|
|
2011-12-21 14:01:50 +00:00
|
|
|
include_repos.each do |r|
|
|
|
|
repo = Repository.find r
|
|
|
|
h[repo.name] = repo.platform.public_downloads_url(nil, arch, repo.name)
|
|
|
|
end
|
2011-12-21 18:59:19 +00:00
|
|
|
end
|
|
|
|
# raise include_repos_hash.inspect
|
|
|
|
self.client.call('add_build_list', project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos_hash)
|
2011-10-22 16:28:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.delete_build_list idlist
|
|
|
|
self.client.call('delete_build_list', idlist)
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|
2011-10-29 14:38:01 +01:00
|
|
|
|
2011-10-29 15:49:43 +01:00
|
|
|
def self.get_status
|
2011-10-29 14:38:01 +01:00
|
|
|
self.client.call('get_status')
|
|
|
|
end
|
2011-04-11 09:34:50 +01:00
|
|
|
|
|
|
|
def self.freeze platform_name, new_repo_name = nil
|
|
|
|
self.client.call('freeze_platform', platform_name, new_repo_name)
|
|
|
|
end
|
2011-04-05 22:35:22 +01:00
|
|
|
end
|