Fix installing a local bottle from source
Factor Utils::Bottles.formula_contents out of BottleLoader.
This commit is contained in:
parent
3ed832d4f0
commit
2e77de3b58
@ -308,7 +308,12 @@ class FormulaInstaller
|
||||
clean
|
||||
|
||||
# Store the formula used to build the keg in the keg.
|
||||
s = formula.path.read.gsub(/ bottle do.+?end\n\n?/m, "")
|
||||
formula_contents = if formula.local_bottle_path
|
||||
Utils::Bottles.formula_contents formula.local_bottle_path, name: formula.name
|
||||
else
|
||||
formula.path.read
|
||||
end
|
||||
s = formula_contents.gsub(/ bottle do.+?end\n\n?/m, "")
|
||||
brew_prefix = formula.prefix/".brew"
|
||||
brew_prefix.mkdir
|
||||
Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s)
|
||||
|
@ -54,6 +54,15 @@ module Utils
|
||||
def resolve_version(bottle_file)
|
||||
PkgVersion.parse receipt_path(bottle_file).split("/")[1]
|
||||
end
|
||||
|
||||
def formula_contents(bottle_file,
|
||||
name: resolve_formula_names(bottle_file)[0])
|
||||
bottle_version = resolve_version bottle_file
|
||||
formula_path = "#{name}/#{bottle_version}/.brew/#{name}.rb"
|
||||
contents = Utils.popen_read "tar", "-xOzf", bottle_file, formula_path
|
||||
raise BottleFormulaUnavailableError.new(bottle_file, formula_path) unless $CHILD_STATUS.success?
|
||||
contents
|
||||
end
|
||||
end
|
||||
|
||||
class Bintray
|
||||
|
Loading…
x
Reference in New Issue
Block a user