bazel: used sed from nixpkgs (#2706)

This is required since sed on macos has different flags and may behave differently.

Co-authored-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Adrian Stobbe 2023-12-12 14:46:11 +01:00 committed by GitHub
parent 6db0318b2f
commit 4c8041d2cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -91,6 +91,11 @@ nixpkgs_package(
repository = "@nixpkgs",
)
nixpkgs_package(
name = "gnused",
repository = "@nixpkgs",
)
load("//nix/cc:nixpkgs_cc_libraries.bzl", "nixpkgs_cc_library_deps")
nixpkgs_cc_library_deps()

View File

@ -12,6 +12,7 @@ sh_template(
"//terraform-provider-constellation:terraform_rc",
"//terraform-provider-constellation:tf_provider",
"//upgrade-agent/cmd:upgrade_agent_linux_amd64",
"@gnused//:bin/sed",
"@yq_toolchains//:resolved_toolchain",
],
substitutions = {
@ -20,6 +21,7 @@ sh_template(
"@@CLI@@": "$(rootpath //cli:cli_edition_host)",
"@@CONTAINER_SUMS@@": "$(rootpath //bazel/release:container_sums)",
"@@EDITION@@": "$(rootpath :devbuild_cli_edition)",
"@@SED@@": "$(rootpath @gnused//:bin/sed)",
"@@TERRAFORM_PROVIDER@@": "$(rootpath //terraform-provider-constellation:tf_provider)",
"@@TERRAFORM_RC@@": "$(rootpath //terraform-provider-constellation:terraform_rc)",
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd:upgrade_agent_linux_amd64)",

View File

@ -16,6 +16,8 @@ fi
yq=$(realpath @@YQ@@)
stat "${yq}" >> /dev/null
sed=$(realpath @@SED@@)
stat "${sed}" >> /dev/null
bootstrapper=$(realpath @@BOOTSTRAPPER@@)
stat "${bootstrapper}" >> /dev/null
upgrade_agent=$(realpath @@UPGRADE_AGENT@@)
@ -70,7 +72,7 @@ TF_PROVIDER_DIR="${workdir}/terraform"
mkdir -p "${TF_PROVIDER_DIR}"
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${terraform_provider}")" "${TF_PROVIDER_DIR}/terraform-provider-constellation"
cp "$(replace_prefix "${host_cache}" "${builder_cache}" "${terraform_rc}")" "${TF_PROVIDER_DIR}/config.tfrc"
sed -i "s|@@TERRAFORM_PROVIDER_PATH@@|$(dirname "${terraform_provider}")|g" "${TF_PROVIDER_DIR}/config.tfrc"
${sed} -i "s|@@TERRAFORM_PROVIDER_PATH@@|$(dirname "${terraform_provider}")|g" "${TF_PROVIDER_DIR}/config.tfrc"
build_version=$("${cli}" version | grep ^Version: | awk '{print $2}')
if [[ ! -f "${workdir}/constellation-conf.yaml" ]]; then