1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

Revert "OpenNebula/one#6245: Include HostSyncManager as a gem dependency (#2647)"

This reverts commit 4edec5ba3bd9df6603ab46c1c7dbbe92ee771c7c.
This commit is contained in:
Tino Vázquez 2023-06-22 15:18:22 +02:00
parent 4edec5ba3b
commit 6f31a24cec
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

View File

@ -19,15 +19,15 @@
require 'fileutils'
require 'tmpdir'
VERSION = '6.4.5'
VERSION = "6.4.5"
def version
v = VERSION
_, min, incr = v.split('.').collect {|e| e.to_i }
_, min, incr = v.split(".").collect{|e| e.to_i}
if min >= 80 || incr >= 80
v += '.pre'
v += ".pre"
end
v
@ -35,29 +35,29 @@ end
DEFAULTS={
:version => version,
:date => Time.now.strftime('%Y-%m-%d'),
:date => Time.now.strftime("%Y-%m-%d"),
:dependencies => []
}
TEMPLATE=<<~EOT
# This file is automatically generated
TEMPLATE=<<EOT
# This file is automatically generated
Gem::Specification.new do |s|
s.name = '$(NAME)'
s.version = '$(VERSION)'
s.date = '$(DATE)'
s.summary = "$(SUMMARY)"
s.description = "$(DESCRIPTION)"
s.authors = ["OpenNebula"]
s.email = 'contact@opennebula.io'
s.license = 'Apache-2.0'
s.files = [
$(FILES)
]
s.homepage = 'http://opennebula.io'
$(EXECUTABLES)
$(DEPENDENCIES)
end
Gem::Specification.new do |s|
s.name = '$(NAME)'
s.version = '$(VERSION)'
s.date = '$(DATE)'
s.summary = "$(SUMMARY)"
s.description = "$(DESCRIPTION)"
s.authors = ["OpenNebula"]
s.email = 'contact@opennebula.io'
s.license = 'Apache-2.0'
s.files = [
$(FILES)
]
s.homepage = 'http://opennebula.io'
$(EXECUTABLES)
$(DEPENDENCIES)
end
EOT
@ -79,7 +79,6 @@ GEM_DESCRIPTION={
['src/mad/ruby/OpenNebulaDriver.rb', '/lib'],
['src/mad/ruby/CommandManager.rb', '/lib'],
['src/mad/ruby/ActionManager.rb', '/lib'],
['src/mad/ruby/HostSyncManager.rb', '/lib'],
['src/mad/ruby/DriverExecHelper.rb', '/lib'],
['src/mad/ruby/scripts_common.rb', '/lib'],
@ -133,18 +132,18 @@ def sane_prefix(prefix)
p=prefix
p.slice!(0) if p[0, 1]=='/'
p<<'/' if p[-1, 1]!='/'
p.slice!(0) if p[0,1]=='/'
p<<'/' if p[-1,1]!='/'
p
end
def file_list(description)
files=[]
files=Array.new
description[:files].each do |f, prefix, exclude|
Dir.glob(f).each do |source|
next if !exclude.nil? and source.match(exclude)
next if (! exclude.nil?) and (source.match(exclude))
files << [source, sane_prefix(prefix)+File.basename(source)]
end
@ -153,14 +152,14 @@ def file_list(description)
files
end
def copy_files(files, source_prefix = '', destination_prefix = '')
def copy_files(files, source_prefix='', destination_prefix='')
files.each do |file|
source=source_prefix+file[0]
destination=destination_prefix+file[1]
dir=File.dirname destination
FileUtils.mkdir_p(dir) unless File.exist?(dir)
FileUtils.mkdir_p(dir) if !File.exist?(dir)
FileUtils.cp(source, destination)
end
@ -173,10 +172,10 @@ def generate_gem_file_list(files)
end
def generate_gem_executable_list(files)
executables=files
.select {|f| f.last.match(%r{^bin/}) }
.map {|f| "'#{File.basename(f.last)}'" }
.join(', ')
executables=files.
select {|f| f.last.match(/^bin\//) }.
map {|f| "'#{File.basename(f.last)}'" }.
join(", ")
if !executables.empty?
" s.executables=[#{executables}]"
@ -187,9 +186,9 @@ end
def generate_dependencies(dependencies)
dependencies.map do |d|
line=' s.add_runtime_dependency '
if d.is_a?(Array)
line<<d.map {|part| "'#{part}'" }.join(', ')
line=" s.add_runtime_dependency "
if Array===d
line<<d.map {|part| "'#{part}'" }.join(", ")
else
line<<"'#{d}'"
end
@ -207,8 +206,7 @@ def populate_gem_template(description, files)
generate_gem_file_list(files)
elsif var==:dependencies
generate_dependencies(
description[:dependencies]||DEFAULTS[:dependencies]
)
description[:dependencies]||DEFAULTS[:dependencies])
elsif var==:executables
generate_gem_executable_list(files)
elsif description[var]
@ -220,7 +218,7 @@ def populate_gem_template(description, files)
end
def generate_gem_file(gem_file, description, files)
File.open(gem_file, 'w') do |f|
File.open(gem_file, "w") do |f|
f.write(populate_gem_template(description, files))
end
end
@ -228,22 +226,22 @@ end
def generate_gem(description)
Dir.mktmpdir do |tmp|
files=file_list(description)
copy_files(files, '', tmp+'/')
copy_files(files, '', tmp+"/")
gem_file=tmp+'/gem.gemspec'
gem_file=tmp+"/gem.gemspec"
generate_gem_file(gem_file, description, files)
pwd=Dir.pwd
Dir.chdir(tmp) do
system('gem build gem.gemspec')
system("gem build gem.gemspec")
if $?.exitstatus!=0
puts 'Error generating gem'
puts "Error generating gem"
exit(-1)
end
Dir.glob('*.gem').each do |f|
Dir.glob("*.gem").each do |f|
FileUtils.cp(f, pwd)
end
end
@ -252,7 +250,8 @@ end
# Go to source code root dir
root=Dir.pwd
root.gsub!(%r{/share/rubygems$}, '')
root.gsub!(/\/share\/rubygems$/, '')
Dir.chdir(root)
GEM_DESCRIPTION.each {|_name, gem| generate_gem(gem) }
GEM_DESCRIPTION.each {|name, gem| generate_gem(gem) }