Merge pull request #17518 from Homebrew/revert-17517-revert-17507-path_exec_files
This commit is contained in:
commit
0fa8e80a8f
@ -628,6 +628,17 @@ module Homebrew
|
|||||||
|
|
||||||
return unless args.json?
|
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) }
|
||||||
|
end
|
||||||
|
|
||||||
json = {
|
json = {
|
||||||
formula.full_name => {
|
formula.full_name => {
|
||||||
"formula" => {
|
"formula" => {
|
||||||
@ -652,10 +663,12 @@ module Homebrew
|
|||||||
"date" => Pathname(filename.to_s).mtime.strftime("%F"),
|
"date" => Pathname(filename.to_s).mtime.strftime("%F"),
|
||||||
"tags" => {
|
"tags" => {
|
||||||
bottle_tag.to_s => {
|
bottle_tag.to_s => {
|
||||||
"filename" => filename.url_encode,
|
"filename" => filename.url_encode,
|
||||||
"local_filename" => filename.to_s,
|
"local_filename" => filename.to_s,
|
||||||
"sha256" => sha256,
|
"sha256" => sha256,
|
||||||
"tab" => tab.to_bottle_hash,
|
"tab" => tab.to_bottle_hash,
|
||||||
|
"path_exec_files" => path_exec_files,
|
||||||
|
"all_files" => all_files,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -323,7 +323,7 @@ class GitHubPackages
|
|||||||
processed_image_refs << manifest["annotations"]["org.opencontainers.image.ref.name"]
|
processed_image_refs << manifest["annotations"]["org.opencontainers.image.ref.name"]
|
||||||
end
|
end
|
||||||
|
|
||||||
manifests += bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|
|
manifests += bottle_hash["bottle"]["tags"].flat_map do |bottle_tag, tag_hash|
|
||||||
bottle_tag = Utils::Bottles::Tag.from_symbol(bottle_tag.to_sym)
|
bottle_tag = Utils::Bottles::Tag.from_symbol(bottle_tag.to_sym)
|
||||||
|
|
||||||
tag = GitHubPackages.version_rebuild(version, rebuild, bottle_tag.to_s)
|
tag = GitHubPackages.version_rebuild(version, rebuild, bottle_tag.to_s)
|
||||||
@ -384,6 +384,10 @@ class GitHubPackages
|
|||||||
|
|
||||||
local_file_size = File.size(local_file)
|
local_file_size = File.size(local_file)
|
||||||
|
|
||||||
|
path_exec_files_string = if (path_exec_files = tag_hash["path_exec_files"].presence)
|
||||||
|
path_exec_files.join(",")
|
||||||
|
end
|
||||||
|
|
||||||
descriptor_annotations_hash = {
|
descriptor_annotations_hash = {
|
||||||
"org.opencontainers.image.ref.name" => tag,
|
"org.opencontainers.image.ref.name" => tag,
|
||||||
"sh.brew.bottle.cpu.variant" => cpu_variant,
|
"sh.brew.bottle.cpu.variant" => cpu_variant,
|
||||||
@ -391,6 +395,7 @@ class GitHubPackages
|
|||||||
"sh.brew.bottle.glibc.version" => glibc_version,
|
"sh.brew.bottle.glibc.version" => glibc_version,
|
||||||
"sh.brew.bottle.size" => local_file_size.to_s,
|
"sh.brew.bottle.size" => local_file_size.to_s,
|
||||||
"sh.brew.tab" => tab.to_json,
|
"sh.brew.tab" => tab.to_json,
|
||||||
|
"sh.brew.path_exec_files" => path_exec_files_string,
|
||||||
}.compact_blank
|
}.compact_blank
|
||||||
|
|
||||||
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
|
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
|
||||||
@ -421,13 +426,28 @@ class GitHubPackages
|
|||||||
validate_schema!(IMAGE_MANIFEST_SCHEMA_URI, image_manifest)
|
validate_schema!(IMAGE_MANIFEST_SCHEMA_URI, image_manifest)
|
||||||
manifest_json_sha256, manifest_json_size = write_hash(blobs, image_manifest)
|
manifest_json_sha256, manifest_json_size = write_hash(blobs, image_manifest)
|
||||||
|
|
||||||
{
|
bottle_manifests = T.let([{
|
||||||
mediaType: "application/vnd.oci.image.manifest.v1+json",
|
mediaType: "application/vnd.oci.image.manifest.v1+json",
|
||||||
digest: "sha256:#{manifest_json_sha256}",
|
digest: "sha256:#{manifest_json_sha256}",
|
||||||
size: manifest_json_size,
|
size: manifest_json_size,
|
||||||
platform: platform_hash,
|
platform: platform_hash,
|
||||||
annotations: descriptor_annotations_hash,
|
annotations: descriptor_annotations_hash,
|
||||||
}
|
}], T::Array[T::Hash[Symbol, String]])
|
||||||
|
|
||||||
|
if (all_files = tag_hash["all_files"].presence)
|
||||||
|
all_files_json_sha256, all_files_size = write_hash(blobs, all_files)
|
||||||
|
bottle_manifests << {
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
bottle_manifests
|
||||||
end
|
end
|
||||||
|
|
||||||
index_json_sha256, index_json_size = write_image_index(manifests, blobs, formula_annotations_hash)
|
index_json_sha256, index_json_size = write_image_index(manifests, blobs, formula_annotations_hash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user