forked from rubinius/rubinius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
72 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require './rakelib/digest_files' | ||
|
||
def build_ruby | ||
bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"] | ||
bin += (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '') | ||
File.join(RbConfig::CONFIG['bindir'], bin) | ||
end | ||
|
||
def build_signature_name | ||
".build_signature" | ||
end | ||
|
||
def load_build_signature | ||
File.read(build_signature_name).chomp if File.exist? build_signature_name | ||
end | ||
|
||
def write_build_signature | ||
File.open build_signature_name, "w" do |f| | ||
f.puts build_signature | ||
end | ||
end | ||
|
||
def build_ruby_name | ||
".build_ruby" | ||
end | ||
|
||
def write_build_ruby | ||
File.open build_ruby_name, "w" do |f| | ||
f.puts build_ruby | ||
end | ||
end | ||
|
||
def build_signature | ||
write_build_ruby | ||
digest_files Dir[*%W[configure config.rb #{build_ruby} Rakefile rakelib/*]] | ||
end | ||
|
||
def verify_build_signature | ||
load_build_signature == build_signature | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'digest/sha1' | ||
|
||
def digest_files(files) | ||
digest = Digest::SHA1.new | ||
|
||
files.each do |name| | ||
File.open name, "r" do |file| | ||
while chunk = file.read(1024) | ||
digest << chunk | ||
end | ||
end | ||
end | ||
|
||
digest.hexdigest | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters