From 54638057279654218446729eda0fb36ffbc063a2 Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Thu, 27 Apr 2023 11:49:43 +0200 Subject: [PATCH] Build and publish ppc builds Before the next release, fake dependencies will be referenced for the ppc builds. --- cmd/BUILD.bazel | 2 ++ deps.bzl | 12 +++++++++ hack/prepare-release.sh | 58 +++++++++++++++++++++++++---------------- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/cmd/BUILD.bazel b/cmd/BUILD.bazel index 7c9aa14..7bd2d60 100644 --- a/cmd/BUILD.bazel +++ b/cmd/BUILD.bazel @@ -53,6 +53,8 @@ alias( actual = select({ "@io_bazel_rules_go//go/platform:linux_amd64": "@bazeldnf-linux-amd64//file:downloaded", "@io_bazel_rules_go//go/platform:linux_arm64": "@bazeldnf-linux-arm64//file:downloaded", + "@io_bazel_rules_go//go/platform:linux_ppc64": "@bazeldnf-linux-ppc64//file:downloaded", + "@io_bazel_rules_go//go/platform:linux_ppc64le": "@bazeldnf-linux-ppc64le//file:downloaded", "@io_bazel_rules_go//go/platform:darwin_amd64": "@bazeldnf-darwin-amd64//file:downloaded", "@io_bazel_rules_go//go/platform:darwin_arm64": "@bazeldnf-darwin-arm64//file:downloaded", "//conditions:default": "cmd", diff --git a/deps.bzl b/deps.bzl index d1082af..085f056 100644 --- a/deps.bzl +++ b/deps.bzl @@ -49,3 +49,15 @@ def bazeldnf_dependencies(): sha256 = "261b11758afc7ce03568026691f62a78fe63ba6e87d1fc51771d3715eec44bcd", urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-darwin-arm64"], ) + http_file( + name = "bazeldnf-linux-ppc64", + executable = True, + sha256 = "d658a09108bd4c4975aa6bca5372c3a7f72ddcd4abd937f9dc882b5fada57694", + urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-linux-amd64"], + ) + http_file( + name = "bazeldnf-linux-ppc64le", + executable = True, + sha256 = "6ad9a260655bbf7591f52553aaa20436814c1426ae37b1f26e066a257a72890c", + urls = ["https://github.com/rmohr/bazeldnf/releases/download/v0.5.6/bazeldnf-v0.5.6-linux-arm64"], + ) diff --git a/hack/prepare-release.sh b/hack/prepare-release.sh index 08523ba..23033a7 100755 --- a/hack/prepare-release.sh +++ b/hack/prepare-release.sh @@ -12,14 +12,36 @@ BASE_DIR="$( rm -rf dist mkdir -p dist -bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd -cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-linux-amd64 -bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd -cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-linux-arm64 -bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd -cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-darwin-amd64 -bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd -cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-darwin-arm64 +function build_arch() { + os=$1 + arch=$2 + + bazel build --platforms=@io_bazel_rules_go//go/toolchain:${os}_${arch} //cmd + cp -L bazel-bin/cmd/cmd_/cmd dist/bazeldnf-${VERSION}-${os}-${arch} +} + +function write_arch() { + os=$1 + arch=$2 + + DIGEST=$(sha256sum dist/bazeldnf-${VERSION}-${os}-${arch} | cut -d " " -f 1) + cat <>./deps.bzl + http_file( + name = "bazeldnf-${os}-${arch}", + executable = True, + sha256 = "${DIGEST}", + urls = ["https://github.com/rmohr/bazeldnf/releases/download/${VERSION}/bazeldnf-${VERSION}-${os}-${arch}"], + ) +EOT + +} + +build_arch linux amd64 +build_arch linux arm64 +build_arch darwin amd64 +build_arch darwin arm64 +build_arch linux ppc64 +build_arch linux ppc64le cat <./deps.bzl load( @@ -51,20 +73,12 @@ xattrs = _xattrs def bazeldnf_dependencies(): EOT -for os in linux darwin; do - for arch in amd64 arm64; do - - DIGEST=$(sha256sum dist/bazeldnf-${VERSION}-${os}-${arch} | cut -d " " -f 1) - cat <>./deps.bzl - http_file( - name = "bazeldnf-${os}-${arch}", - executable = True, - sha256 = "${DIGEST}", - urls = ["https://github.com/rmohr/bazeldnf/releases/download/${VERSION}/bazeldnf-${VERSION}-${os}-${arch}"], - ) -EOT - done -done +write_arch linux amd64 +write_arch linux arm64 +write_arch darwin amd64 +write_arch darwin arm64 +write_arch linux ppc64 +write_arch linux ppc64le git commit -a -m "Bump prebuilt binary references for ${VERSION}"