class ChefCLI::PolicyfileLock

def build_from_compiler(compiler)

def build_from_compiler(compiler)
  @name = compiler.name
  @run_list = compiler.normalized_run_list
  @named_run_lists = compiler.normalized_named_run_lists
  compiler.all_cookbook_location_specs.each do |cookbook_name, spec|
    if spec.mirrors_canonical_upstream?
      cached_cookbook(cookbook_name) do |cached_cb|
        cached_cb.cache_key = spec.cache_key
        cached_cb.origin = spec.uri
        cached_cb.source_options = spec.source_options_for_lock
      end
    else
      local_cookbook(cookbook_name) do |local_cb|
        local_cb.source = spec.relative_path
        local_cb.source_options = spec.source_options_for_lock
      end
    end
  end
  @default_attributes = compiler.default_attributes
  @override_attributes = compiler.override_attributes
  @solution_dependencies = compiler.solution_dependencies
  @included_policy_locks = compiler.included_policies.map do |policy|
    {
      "name" => policy.name,
      "revision_id" => policy.revision_id,
      "source_options" => policy.source_options_for_lock,
    }
  end
  self
end