Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "bottle/github_packages: include path_exec_files, all_files." #17517

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions Library/Homebrew/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ def bottle_formula(formula)
tab.poured_from_bottle = false
tab.time = nil
tab.changed_files = changed_files.dup

if args.only_json_tab?
tab.changed_files.delete(Pathname.new(Tab::FILENAME))
tab.tabfile.unlink
Expand Down Expand Up @@ -629,18 +628,6 @@ def bottle_formula(formula)

return unless args.json?

if keg
keg_prefix = "#{keg}/"
path_exec_files = [keg/"bin", keg/"sbin"].select(&:exist?)
.flat_map(&:children)
.select(&:executable?)
.map { |path| path.to_s.delete_prefix(keg_prefix) }
all_files = keg.find
.select(&:file?)
.map { |path| path.to_s.delete_prefix(keg_prefix) }
.join(",")
end

json = {
formula.full_name => {
"formula" => {
Expand All @@ -665,12 +652,10 @@ def bottle_formula(formula)
"date" => Pathname(filename.to_s).mtime.strftime("%F"),
"tags" => {
bottle_tag.to_s => {
"filename" => filename.url_encode,
"local_filename" => filename.to_s,
"sha256" => sha256,
"tab" => tab.to_bottle_hash,
"path_exec_files" => path_exec_files,
"all_files" => all_files,
"filename" => filename.url_encode,
"local_filename" => filename.to_s,
"sha256" => sha256,
"tab" => tab.to_bottle_hash,
},
},
},
Expand Down
29 changes: 8 additions & 21 deletions Library/Homebrew/github_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
processed_image_refs << manifest["annotations"]["org.opencontainers.image.ref.name"]
end

manifests += bottle_hash["bottle"]["tags"].flat_map do |bottle_tag, tag_hash|
manifests += bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|

Check warning on line 326 in Library/Homebrew/github_packages.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/github_packages.rb#L326

Added line #L326 was not covered by tests
bottle_tag = Utils::Bottles::Tag.from_symbol(bottle_tag.to_sym)

tag = GitHubPackages.version_rebuild(version, rebuild, bottle_tag.to_s)
Expand Down Expand Up @@ -391,7 +391,6 @@
"sh.brew.bottle.glibc.version" => glibc_version,
"sh.brew.bottle.size" => local_file_size.to_s,
"sh.brew.tab" => tab.to_json,
"sh.brew.path_exec_files" => tag_hash["path_exec_files"]&.join(","),
}.compact_blank

annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
Expand Down Expand Up @@ -421,26 +420,14 @@
}
validate_schema!(IMAGE_MANIFEST_SCHEMA_URI, image_manifest)
manifest_json_sha256, manifest_json_size = write_hash(blobs, image_manifest)
all_files_json_sha256, all_files_size = write_hash(blobs, tag_hash["all_files"].split(","))

[
{
mediaType: "application/vnd.oci.image.manifest.v1+json",
digest: "sha256:#{manifest_json_sha256}",
size: manifest_json_size,
platform: platform_hash,
annotations: descriptor_annotations_hash,
},
{
mediaType: "application/sh.brew.all_files+json",
digest: "sha256:#{all_files_json_sha256}",
size: all_files_size,
annotations: {
"org.opencontainers.image.ref.name" => tag,
"sh.brew.bottle.cpu.variant" => cpu_variant,
}.compact_blank,
},
]
{
mediaType: "application/vnd.oci.image.manifest.v1+json",

Check warning on line 425 in Library/Homebrew/github_packages.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/github_packages.rb#L425

Added line #L425 was not covered by tests
digest: "sha256:#{manifest_json_sha256}",
size: manifest_json_size,
platform: platform_hash,
annotations: descriptor_annotations_hash,
}
end

index_json_sha256, index_json_size = write_image_index(manifests, blobs, formula_annotations_hash)
Expand Down