diff --git a/lib/tebako/cli.rb b/lib/tebako/cli.rb index cbf201f9..ff1dcaa0 100755 --- a/lib/tebako/cli.rb +++ b/lib/tebako/cli.rb @@ -53,7 +53,7 @@ class Cli < Thor # rubocop:disable Metrics/ClassLength desc: "tebako configuration file 'tebafile', '$PWD/.tebako.yml' by default" desc "clean", "Clean tebako packaging environment" def clean - (_, cm) = bootstrap + (_, cm) = bootstrap(clean: true) cm.clean_cache end @@ -63,7 +63,7 @@ def clean desc: "Ruby version to clean, all available versions by default" def clean_ruby puts "Cleaning Ruby sources from tebako packaging environment" - (om,) = bootstrap + (om,) = bootstrap(clean: true) suffix = options["Ruby"].nil? ? "" : "_#{options["Ruby"]}" nmr = "src/_ruby#{suffix}*" @@ -127,7 +127,7 @@ def press def setup (om, cm) = bootstrap - do_setup(om, cm) + do_setup(om) cm.ensure_version_file rescue Tebako::Error => e puts "Tebako script failed: #{e.message} [#{e.error_code}]" @@ -139,11 +139,11 @@ def self.exit_on_failure? end no_commands do - def bootstrap + def bootstrap(clean: false) options_manager = Tebako::OptionsManager.new(options) cache_manager = Tebako::CacheManager.new(options_manager.deps, options_manager.source, options_manager.output_folder) - cache_manager.version_cache_check unless options[:devmode] + cache_manager.version_cache_check unless options[:devmode] || clean [options_manager, cache_manager] end diff --git a/lib/tebako/cli_helpers.rb b/lib/tebako/cli_helpers.rb index 891ffc00..0169d1bc 100644 --- a/lib/tebako/cli_helpers.rb +++ b/lib/tebako/cli_helpers.rb @@ -71,7 +71,7 @@ def do_press_runtime(options_manager, scenario_manager) true end - def do_setup(options_manager, scenario_manager) + def do_setup(options_manager) puts "Setting up tebako packaging environment" cfg_cmd = "cmake -DSETUP_MODE:BOOLEAN=ON #{options_manager.cfg_options}" @@ -80,7 +80,7 @@ def do_setup(options_manager, scenario_manager) Tebako.packaging_error(101) unless system(merged_env, cfg_cmd) Tebako.packaging_error(102) unless system(merged_env, build_cmd) - FileUtils.chmod("+x", File.join(options_manager.deps_bin_dir, "mkdwarfs#{scenario_manager.exe_suffix}")) + fix_mkdwarfs_permissions(options_manager) true end @@ -98,6 +98,11 @@ def generate_files(options_manager, scenario_manager) Tebako::Codegen.generate_stub_rb(options_manager) end + def fix_mkdwarfs_permissions(options_manager) + scenario_manager = Tebako::ScenarioManager.new(options_manager.root, options_manager.fs_entrance) + FileUtils.chmod("+x", File.join(options_manager.deps_bin_dir, "mkdwarfs#{scenario_manager.exe_suffix}")) + end + def options_from_tebafile(tebafile) ::YAML.load_file(tebafile)["options"] || {} rescue Psych::SyntaxError => e