62 lines
2.5 KiB
Ruby
62 lines
2.5 KiB
Ruby
class Skopeo < Formula
|
|
desc "Work with remote images registries"
|
|
homepage "https://github.com/containers/skopeo"
|
|
url "https://github.com/containers/skopeo/archive/v1.2.0.tar.gz"
|
|
sha256 "113290f6747b7a9946ddf50ad1a7d924d3e507fe923b2e0460df1e6823de0ffb"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
sha256 "99ce8458032e1360d467a2b23a661920457dcfc0abff0c697b5fc9fcee8b3d1e" => :big_sur
|
|
sha256 "f36d5a47905fe5a06efe727ddc44bd948eb4c55f9e18a6bccb7979f229e7e60f" => :catalina
|
|
sha256 "fb6dbdab20623d34703c7764f469caacf4108b3b88c1ae802f59e4ddde5e88eb" => :mojave
|
|
sha256 "ae339b7ad02045142355564a4144a12383acb23a32b5092c80a9c6985859b0b5" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "gpgme"
|
|
|
|
on_linux do
|
|
depends_on "pkg-config" => :build
|
|
end
|
|
|
|
def install
|
|
ENV["CGO_ENABLED"] = "1"
|
|
ENV.append "CGO_FLAGS", ENV.cppflags
|
|
ENV.append "CGO_FLAGS", Utils.safe_popen_read("#{Formula["gpgme"].bin}/gpgme-config", "--cflags")
|
|
|
|
buildtags = [
|
|
"containers_image_ostree_stub",
|
|
Utils.safe_popen_read("hack/btrfs_tag.sh").chomp,
|
|
Utils.safe_popen_read("hack/btrfs_installed_tag.sh").chomp,
|
|
Utils.safe_popen_read("hack/libdm_tag.sh").chomp,
|
|
].uniq.join(" ")
|
|
|
|
ldflags = [
|
|
"-X main.gitCommit=",
|
|
"-X github.com/containers/image/v5/docker.systemRegistriesDirPath=#{etc/"containers/registries.d"}",
|
|
"-X github.com/containers/image/v5/internal/tmpdir.unixTempDirForBigFiles=/var/tmp",
|
|
"-X github.com/containers/image/v5/signature.systemDefaultPolicyPath=#{etc/"containers/policy.json"}",
|
|
"-X github.com/containers/image/v5/pkg/sysregistriesv2.systemRegistriesConfPath=" \
|
|
"#{etc/"containers/registries.conf"}",
|
|
].join(" ")
|
|
|
|
system "go", "build", "-tags", buildtags, "-ldflags", ldflags, *std_go_args, "./cmd/skopeo"
|
|
|
|
(etc/"containers").install "default-policy.json" => "policy.json"
|
|
(etc/"containers/registries.d").install "default.yaml"
|
|
|
|
bash_completion.install "completions/bash/skopeo"
|
|
end
|
|
|
|
test do
|
|
cmd = "#{bin}/skopeo --override-os linux inspect docker://busybox"
|
|
output = shell_output(cmd)
|
|
assert_match "docker.io/library/busybox", output
|
|
|
|
# https://github.com/Homebrew/homebrew-core/pull/47766
|
|
# https://github.com/Homebrew/homebrew-core/pull/45834
|
|
assert_match /Invalid destination name test: Invalid image name .+, expected colon-separated transport:reference/,
|
|
shell_output("#{bin}/skopeo copy docker://alpine test 2>&1", 1)
|
|
end
|
|
end
|