Skip to content
Snippets Groups Projects
Commit 0ca28e08 authored by Steven Danna's avatar Steven Danna
Browse files

Merge pull request #452 from chef/ssd/builder-shasum-fix

Cache Builder#shasum before Builder#build to ensure consistent result
parents edb06414 be342106
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -580,7 +580,8 @@ module Omnibus
#
def build
log.info(log_key) { 'Starting build' }
shasum # ensure shashum is calculated before build since the build can alter the shasum
log.internal(log_key) { 'Cached builder checksum before build: #{shasum}'}
if software.overridden?
log.info(log_key) do
"Version overridden from #{software.default_version} to "\
Loading
Loading
Loading
Loading
@@ -519,7 +519,7 @@ module Omnibus
}
)
end
env.merge(compiler_flags).
merge(extra_linker_flags).
# always want to favor pkg-config from embedded location to not hose
Loading
Loading
Loading
Loading
@@ -180,5 +180,38 @@ module Omnibus
subject.make(timeout: 3600)
end
end
describe "#shasum" do
let(:build_step) do
Proc.new {
block do
command("true")
end
}
end
let(:tmp_dir) { Dir.mktmpdir }
after { FileUtils.rmdir(tmp_dir) }
let(:software) do
double(Software,
name: 'chefdk',
install_dir: tmp_dir,
project_dir: tmp_dir,
overridden?: false)
end
let(:before_build_shasum) do
b = described_class.new(software)
b.evaluate(&build_step)
b.shasum
end
it "returns the same value when called before or after the build" do
subject.evaluate(&build_step)
subject.build
expect(subject.shasum).to eq(before_build_shasum)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment