Skip to content

Commit

Permalink
Formula#bottle_hash: various fixes/updates.
Browse files Browse the repository at this point in the history
- remove `cellar` because it's no longer global
- remove `prefix` because it's no longer customisable
- add `cellar` for each bottle tag
- fix `url` for GitHub Packages
  • Loading branch information
MikeMcQuaid committed Apr 9, 2021
1 parent 6f071a0 commit 4633ec7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Library/Homebrew/formula.rb
Expand Up @@ -1896,17 +1896,23 @@ def bottle_hash
bottle_spec = stable.bottle_specification
hash = {
"rebuild" => bottle_spec.rebuild,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
"prefix" => bottle_spec.prefix,
"root_url" => bottle_spec.root_url,
"files" => {},
}
bottle_spec.collector.each_key do |os|
bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}"
checksum = bottle_spec.collector[os][:checksum]
collector_os = bottle_spec.collector[os]
os_cellar = collector_os[:cellar]
os_cellar = os_cellar.is_a?(Symbol) ? os_cellar.inspect : os_cellar

checksum = collector_os[:checksum].hexdigest
filename = Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray
path, = bottle_spec.path_resolved_basename(name, checksum, filename)
url = "#{bottle_spec.root_url}/#{path}"

hash["files"][os] = {
"url" => bottle_url,
"sha256" => checksum.hexdigest,
"cellar" => os_cellar,
"url" => url,
"sha256" => checksum,
}
end
hash
Expand Down

0 comments on commit 4633ec7

Please sign in to comment.