lib/bosh/stemcell/build_environment.rb in bosh-stemcell-1.2824.0 vs lib/bosh/stemcell/build_environment.rb in bosh-stemcell-1.2827.0

- old
+ new

@@ -1,7 +1,8 @@ require 'bosh/core/shell' require 'bosh/stemcell/builder_options' +require 'bosh/stemcell/stemcell' require 'forwardable' module Bosh::Stemcell class BuildEnvironment extend Forwardable @@ -11,25 +12,29 @@ def initialize(env, definition, version, release_tarball_path, os_image_tarball_path) @environment = env @definition = definition @os_image_tarball_path = os_image_tarball_path + @version = version @stemcell_builder_options = BuilderOptions.new( env: env, definition: definition, version: version, release_tarball: release_tarball_path, os_image_tarball: os_image_tarball_path, ) @shell = Bosh::Core::Shell.new end + attr_reader :version + def prepare_build sanitize prepare_build_path copy_stemcell_builder_to_build_path prepare_work_root + prepare_stemcell_path persist_settings_for_bash end def os_image_rspec_command [ @@ -53,12 +58,15 @@ def build_path File.join(build_root, 'build') end - def stemcell_file - File.join(work_path, settings['stemcell_tgz']) + def stemcell_files + definition.disk_formats.map do |disk_format| + stemcell_filename = Stemcell.new(@definition, 'bosh-stemcell', @version, disk_format) + File.join(work_path, stemcell_filename.name) + end end def chroot_dir File.join(work_path, 'chroot') end @@ -69,10 +77,14 @@ def work_path File.join(work_root, 'work') end + def stemcell_tarball_path + work_path + end + def command_env "env #{hash_as_bash_env(proxy_settings_from_environment)}" end private @@ -112,9 +124,13 @@ end def prepare_build_path FileUtils.rm_rf(build_path, verbose: true) if File.exist?(build_path) FileUtils.mkdir_p(build_path, verbose: true) + end + + def prepare_stemcell_path + FileUtils.mkdir_p(File.join(work_path, 'stemcell')) end def copy_stemcell_builder_to_build_path FileUtils.cp_r(Dir.glob("#{STEMCELL_BUILDER_SOURCE_DIR}/*"), build_path, preserve: true, verbose: true) end