Store the formula used to build the keg in the keg

Store the formula used to build the keg inside the keg in a
file named NAME/VERSION/.brew/NAME.rb after removing the
bottle do ... end block.

See https://github.com/Homebrew/brew-evolution/pull/6.
Closes https://github.com/Homebrew/brew/issues/931.
This commit is contained in:
Shaun Jackman 2016-09-20 14:42:29 -07:00
parent 12aad5c65f
commit 25df0c03d6
3 changed files with 9 additions and 0 deletions

View File

@ -140,6 +140,8 @@ class PrettyListing
# dylibs have multiple symlinks and we don't care about them
(pnn.extname == ".dylib" || pnn.extname == ".pc") && !pnn.symlink?
end
when ".brew"
# Ignore .brew
else
if pn.directory?
if pn.symlink?

View File

@ -260,6 +260,12 @@ class FormulaInstaller
compute_and_install_dependencies if not_pouring && !ignore_deps?
build
clean
# Store the formula used to build the keg in the keg.
s = formula.path.read.gsub(/ bottle do.+?end\n\n?/m, "")
brew_prefix = formula.prefix/".brew"
brew_prefix.mkdir
Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s)
end
build_bottle_postinstall if build_bottle?

View File

@ -58,6 +58,7 @@ class InstallTests < Homebrew::TestCase
bin = HOMEBREW_PREFIX+"bin"
assert_predicate bin, :directory?
assert_equal 3, bin.children.length
assert_predicate f.prefix/".brew/testball.rb", :readable?
end
end