Files
TheRock/compiler/amd-llvm/libcxx/utils/zos_rename_dll_side_deck.sh
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

58 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Script to rename DLL name within side deck.
#
# Stops execution if a command or pipeline has an error.
set -e
sidedeck=$1
old_dll_name=$2
new_dll_name=$3
function error() {
printf "ERROR: %s\n" "$*"
exit 1
}
function usage() {
cat <<EOF
Usage: $(basename $0) <side deck file> <old dll name> <new dll name>:
[-h|--help] Display this help and exit.
EOF
}
rename_dll_name_inside_side_deck() {
if [[ -z "$sidedeck" || -z "$old_dll_name" || -z "$new_dll_name" ]]; then
usage
error "All 3 parameters must be specified."
fi
[[ -f "$sidedeck" ]] || error "The '$sidedeck' file must exists."
old_len=${#old_dll_name}
new_len=${#new_dll_name}
if (( $new_len > $old_len )); then
error "New DLL name $new_dll_name must have $old_len characters or less."
fi
if ((padding_len=$old_len-$new_len )); then
pad=$(printf "%*s" $padding_len "")
fi
# Touch the temp. file and set the tag to 1047 first so the redirecting statement
# will write in 1047 and not 819 encoding.
touch $sidedeck.tmp; chtag -tc1047 $sidedeck.tmp
sed "/ IMPORT /s/'$old_dll_name/$pad'$new_dll_name/g" $sidedeck > $sidedeck.tmp
mv $sidedeck.tmp $sidedeck
}
function main() {
rename_dll_name_inside_side_deck
}
main "$@"