57 lines
2.2 KiB
Ruby
57 lines
2.2 KiB
Ruby
class Skopeo < Formula
|
|
desc "Work with remote images registries"
|
|
homepage "https://github.com/containers/skopeo"
|
|
url "https://github.com/containers/skopeo/archive/v0.1.41.tar.gz"
|
|
sha256 "d9f4a0dcf4a43469768dbf16865d5bc98e5434fadd65af35051edb36767c9c70"
|
|
|
|
bottle do
|
|
sha256 "ac2a94aa69c27200495cb48638ad9a3eff4909cde798849d0ee079776869a34f" => :catalina
|
|
sha256 "55ff7bdfe1db38e9016ba45057cf95e44cdc4c05843c507b02c8df1b5d27099f" => :mojave
|
|
sha256 "91c57b7acf8d0ee159fc83cdc48b2e1bc88af2f88a63d33dfd11502ebf2d8c18" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "gpgme"
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["CGO_ENABLED"] = "1"
|
|
ENV.append "CGO_FLAGS", ENV.cppflags
|
|
ENV.append "CGO_FLAGS", Utils.popen_read("#{Formula["gpgme"].bin}/gpgme-config --cflags")
|
|
|
|
(buildpath/"src/github.com/containers/skopeo").install buildpath.children
|
|
cd buildpath/"src/github.com/containers/skopeo" do
|
|
buildtags = [
|
|
"containers_image_ostree_stub",
|
|
Utils.popen_read("hack/btrfs_tag.sh").chomp,
|
|
Utils.popen_read("hack/btrfs_installed_tag.sh").chomp,
|
|
Utils.popen_read("hack/libdm_tag.sh").chomp,
|
|
Utils.popen_read("hack/ostree_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", "-v", "-x", "-tags", buildtags, "-ldflags", ldflags, "-o", bin/"skopeo", "./cmd/skopeo"
|
|
|
|
(etc/"containers").install "default-policy.json" => "policy.json"
|
|
(etc/"containers/registries.d").install "default.yaml"
|
|
|
|
bash_completion.install "completions/bash/skopeo"
|
|
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
cmd = "#{bin}/skopeo --override-os linux inspect docker://busybox"
|
|
output = shell_output(cmd)
|
|
assert_match "docker.io/library/busybox", output
|
|
end
|
|
end
|