class ChefCLI::Policyfile::IncludedPoliciesCookbookSource

def build_source_options

# Collect all the source options
def build_source_options
  included_policy_location_specs.inject({}) do |acc, policy_spec|
    lock = policy_spec.policyfile_lock
    lock.cookbook_locks.each do |(name, cookbook_lock)|
      version = cookbook_lock.version
      if acc[name]
        if acc[name][version]
          if acc[name][version] != cookbook_lock.source_options
            raise ConflictingCookbookSources.new("Conflicting sources provided for cookbook #{name}")
          end
        else
          raise ConflictingCookbookVersions.new("Multiple sources provided for cookbook #{name}")
        end
      else
        acc[name] = {}
        acc[name][version] = cookbook_lock.source_options
      end
    end
    acc
  end
end