Merge pull request #134 from abf/rosa-build:133-only-personal-repositories-should-be-attached-to-the-build
[refs #133] Only personal repositories should be attached to the build
This commit is contained in:
commit
6aede76ef2
|
@ -120,7 +120,8 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
if save_to_platform.main?
|
if save_to_platform.main?
|
||||||
bl = bl.where(:save_to_platform_id => save_to_platform.id)
|
bl = bl.where(:save_to_platform_id => save_to_platform.id)
|
||||||
else
|
else
|
||||||
platforms = Platform.includes(:repositories).search(params[:term]).
|
# Only personal repositories can be attached to the build
|
||||||
|
platforms = Platform.includes(:repositories).personal.search(params[:term]).
|
||||||
accessible_by(current_ability, :read).search_order.limit(5)
|
accessible_by(current_ability, :read).search_order.limit(5)
|
||||||
platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
|
platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -409,13 +409,11 @@ class BuildList < ActiveRecord::Base
|
||||||
repos = include_repos
|
repos = include_repos
|
||||||
include_repos_hash = {}.tap do |h|
|
include_repos_hash = {}.tap do |h|
|
||||||
Repository.where(:id => (repos | (extra_repositories || [])) ).each do |repo|
|
Repository.where(:id => (repos | (extra_repositories || [])) ).each do |repo|
|
||||||
path = repo.platform.public_downloads_url(arch.name, repo.name)
|
path = repo.platform.public_downloads_url(
|
||||||
# path.gsub!(/^http:\/\/(0\.0\.0\.0|localhost)\:[\d]+/, 'https://abf.rosalinux.ru') unless Rails.env.production?
|
repo.platform.main? ? nil : build_for_platform.name,
|
||||||
# Path looks like:
|
arch.name,
|
||||||
# http://abf-downloads.rosalinux.ru/rosa-server2012/repository/x86_64/base/
|
repo.name
|
||||||
# so, we should append:
|
)
|
||||||
# - release
|
|
||||||
# - updates
|
|
||||||
h["#{repo.platform.name}_#{repo.name}_release"] = path + 'release'
|
h["#{repo.platform.name}_#{repo.name}_release"] = path + 'release'
|
||||||
h["#{repo.platform.name}_#{repo.name}_updates"] = path + 'updates' if repo.platform.main?
|
h["#{repo.platform.name}_#{repo.name}_updates"] = path + 'updates' if repo.platform.main?
|
||||||
end
|
end
|
||||||
|
@ -428,7 +426,11 @@ class BuildList < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
if save_to_platform.personal? && use_save_to_repository
|
if save_to_platform.personal? && use_save_to_repository
|
||||||
include_repos_hash["#{save_to_platform.name}_release"] = save_to_platform.
|
include_repos_hash["#{save_to_platform.name}_release"] = save_to_platform.
|
||||||
urpmi_list(nil, nil, false, save_to_repository.name)["#{build_for_platform.name}"]["#{arch.name}"]
|
public_downloads_url(
|
||||||
|
build_for_platform.name,
|
||||||
|
arch.name,
|
||||||
|
save_to_repository.name
|
||||||
|
) + 'release'
|
||||||
end
|
end
|
||||||
|
|
||||||
git_project_address = project.git_project_address(user)
|
git_project_address = project.git_project_address(user)
|
||||||
|
@ -488,7 +490,8 @@ class BuildList < ActiveRecord::Base
|
||||||
if save_to_platform && save_to_platform.main?
|
if save_to_platform && save_to_platform.main?
|
||||||
self.extra_repositories = nil
|
self.extra_repositories = nil
|
||||||
else
|
else
|
||||||
self.extra_repositories = Repository.where(:id => extra_repositories).
|
self.extra_repositories = Repository.joins(:platform).
|
||||||
|
where(:id => extra_repositories, :platforms => {:platform_type => 'personal'}).
|
||||||
accessible_by(current_ability, :read).pluck('repositories.id')
|
accessible_by(current_ability, :read).pluck('repositories.id')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,11 +91,14 @@ class Platform < ActiveRecord::Base
|
||||||
Rails.root.join("public", "downloads", name)
|
Rails.root.join("public", "downloads", name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def public_downloads_url(arch = nil, repo = nil, suffix = nil)
|
# Returns URL to repository, for example:
|
||||||
|
# - http://abf-downloads.rosalinux.ru/rosa-server2012/repository/x86_64/base/
|
||||||
|
# - http://abf-downloads.rosalinux.ru/uname_personal/repository/rosa-server2012/x86_64/base/
|
||||||
|
def public_downloads_url(subplatform_name = nil, arch = nil, repo = nil)
|
||||||
"#{APP_CONFIG['downloads_url']}/#{name}/repository/".tap do |url|
|
"#{APP_CONFIG['downloads_url']}/#{name}/repository/".tap do |url|
|
||||||
|
url << "#{subplatform_name}/" if subplatform_name.present?
|
||||||
url << "#{arch}/" if arch.present?
|
url << "#{arch}/" if arch.present?
|
||||||
url << "#{repo}/" if repo.present?
|
url << "#{repo}/" if repo.present?
|
||||||
url << "#{suffix}/" if suffix.present?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue