Class: ToplevelInstallerMulti

Inherits:
ToplevelInstaller show all
Includes:
FileOperations
Defined in:
lib/roebe/setup/setup.rb

Constant Summary

Constants included from FileOperations

FileOperations::DIR_REJECT

Constants inherited from ToplevelInstaller

ToplevelInstaller::Copyright, ToplevelInstaller::TASKS, ToplevelInstaller::Version

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileOperations

#command, #diff?, #directories_of, #extdir?, #files_of, #force_remove_file, #install, #make, #mkdir_p, #move_file, #remove_file, #remove_tree, #remove_tree0, #rm_f, #rm_rf, #ruby

Methods inherited from ToplevelInstaller

#config, #exec_show, #inspect, invoke, #invoke, load_rbconfig, multipackage?, #objdir_root, #parsearg_config, #parsearg_global, #parsearg_install, #parsearg_no_options, #relpath, #srcdir_root, #valid_task?, #valid_task_re

Constructor Details

#initialize(ardir_root, config) ⇒ ToplevelInstallerMulti

Returns a new instance of ToplevelInstallerMulti.



1093
1094
1095
1096
1097
1098
# File 'lib/roebe/setup/setup.rb', line 1093

def initialize(ardir_root, config)
  super
  @packages = directories_of("#{@ardir}/packages")
  raise 'no package exists' if @packages.empty?
  @root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
end

Instance Attribute Details

#packagesObject

Returns the value of attribute packages.



1107
1108
1109
# File 'lib/roebe/setup/setup.rb', line 1107

def packages
  @packages
end

Instance Method Details

#each_selected_installersObject

lib



1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
# File 'lib/roebe/setup/setup.rb', line 1195

def each_selected_installers
  Dir.mkdir 'packages' unless File.dir?('packages')
  @selected.each do |pack|
    $stderr.puts "Processing the package `#{pack}' ..." if verbose?
    Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
    Dir.chdir "packages/#{pack}"
    yield @installers[pack]
    Dir.chdir '../..'
  end
end

#exec_cleanObject



1177
1178
1179
1180
1181
1182
# File 'lib/roebe/setup/setup.rb', line 1177

def exec_clean
  rm_f @config.savefile
  run_hook 'pre-clean'
  each_selected_installers {|inst| inst.exec_clean }
  run_hook 'post-clean'
end

#exec_configObject

Task Handlers



1152
1153
1154
1155
1156
1157
# File 'lib/roebe/setup/setup.rb', line 1152

def exec_config
  run_hook 'pre-config'
  each_selected_installers {|inst| inst.exec_config }
  run_hook 'post-config'
  @config.save   # must be final
end

#exec_distcleanObject



1184
1185
1186
1187
1188
1189
# File 'lib/roebe/setup/setup.rb', line 1184

def exec_distclean
  rm_f @config.savefile
  run_hook 'pre-distclean'
  each_selected_installers {|inst| inst.exec_distclean }
  run_hook 'post-distclean'
end

#exec_installObject



1165
1166
1167
1168
1169
# File 'lib/roebe/setup/setup.rb', line 1165

def exec_install
  run_hook 'pre-install'
  each_selected_installers {|inst| inst.exec_install }
  run_hook 'post-install'
end

#exec_setupObject



1159
1160
1161
1162
1163
# File 'lib/roebe/setup/setup.rb', line 1159

def exec_setup
  run_hook 'pre-setup'
  each_selected_installers {|inst| inst.exec_setup }
  run_hook 'post-setup'
end

#exec_testObject



1171
1172
1173
1174
1175
# File 'lib/roebe/setup/setup.rb', line 1171

def exec_test
  run_hook 'pre-test'
  each_selected_installers {|inst| inst.exec_test }
  run_hook 'post-test'
end

#extract_selection(list) ⇒ Object



1133
1134
1135
1136
1137
1138
1139
# File 'lib/roebe/setup/setup.rb', line 1133

def extract_selection(list)
  a = list.split(/,/)
  a.each do |name|
    setup_rb_error "no such package: #{name}"  unless @installers.key?(name)
  end
  a
end

#init_installersObject



1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
# File 'lib/roebe/setup/setup.rb', line 1118

def init_installers
  @installers = {}
  @packages.each do |pack|
    @installers[pack] = Installer.new(@config,
                                     "#{@ardir}/packages/#{pack}",
                                     "packages/#{pack}")
  end
  with    = extract_selection(config('with'))
  without = extract_selection(config('without'))
  @selected = @installers.keys.select {|name|
                (with.empty? or with.include?(name)) \
                    and not without.include?(name)
              }
end

#no_harm?Boolean

module FileOperations requires this

Returns:

  • (Boolean)


1216
1217
1218
# File 'lib/roebe/setup/setup.rb', line 1216

def no_harm?
  @config.no_harm?
end


1141
1142
1143
1144
1145
1146
# File 'lib/roebe/setup/setup.rb', line 1141

def print_usage(f)
  super
  f.puts 'Inluded packages:'
  f.puts '  ' + @packages.sort.join(' ')
  f.puts
end

#run_hook(id) ⇒ Object



1206
1207
1208
# File 'lib/roebe/setup/setup.rb', line 1206

def run_hook(id)
  @root_installer.run_hook id
end

#run_metaconfigsObject



1100
1101
1102
1103
1104
1105
# File 'lib/roebe/setup/setup.rb', line 1100

def run_metaconfigs
  @config.load_script "#{@ardir}/metaconfig", self
  @packages.each do |name|
    @config.load_script "#{@ardir}/packages/#{name}/metaconfig"
  end
end

#verbose?Boolean

module FileOperations requires this

Returns:

  • (Boolean)


1211
1212
1213
# File 'lib/roebe/setup/setup.rb', line 1211

def verbose?
  @config.verbose?
end