-
Notifications
You must be signed in to change notification settings - Fork 39
feat(cli): Makefile and build scripts #3208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alkalescent
merged 1 commit into
DSPX-2655-migrate-otdfctl
from
DSPX-2657-otdfctl-build
Mar 27, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Check if the required arguments are provided | ||
| if [ $# -ne 2 ]; then | ||
| echo "Usage: $0 <outputDir> <checksumFile>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Verifying checksums..." | ||
| # Location of the checksum file | ||
| checksumFile=$1/$2 | ||
| outputDir=$1 | ||
|
|
||
| echo "Looking for checksum file: $checksumFile" | ||
| test -f "$checksumFile" || { echo "ERROR: Checksum file not found!"; exit 1; } | ||
|
|
||
| # Iterate over each line in the checksum file | ||
| while read -r line; do | ||
| # Extract the expected checksum and filename from each line | ||
| read -ra ADDR <<< "$line" # Read the line into an array | ||
| expectedChecksum="${ADDR[0]}" | ||
| fileName="${ADDR[2]}" | ||
|
|
||
| # Calculate the actual checksum of the file | ||
| actualChecksum=$(shasum -a 256 "$outputDir/$fileName" | awk '{print $1}') | ||
|
|
||
| # Compare the expected checksum with the actual checksum | ||
| if [ "$expectedChecksum" == "$actualChecksum" ]; then | ||
| echo "SUCCESS: Checksum for $fileName is valid." | ||
| else | ||
| echo "ERROR: Checksum for $fileName does not match." | ||
| fi | ||
| done < "$checksumFile" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if the required arguments are provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ $# -ne 3 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Usage: $0 <build_semver> <binary_directory> <output_directory>" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Assign the arguments to variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_semver="$1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binary_dir="$2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output_dir="$3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Create the output directory if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p "$output_dir" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Create a checksums file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checksums_file="$output_dir/${build_semver}_checksums.txt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| touch $checksums_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Iterate over each binary file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for binary_file in "$binary_dir"/*; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| compressed="" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ $binary_file == *.exe ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # If the file is a Windows binary, zip it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filename=$(basename "$binary_file") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| compressed="${filename%.exe}.zip" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| zip -j "$output_dir/$compressed" "$binary_file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # For other binaries, tar and gzip them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filename=$(basename "$binary_file") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| compressed="${filename}.tar.gz" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tar -czf "$output_dir/$compressed" "$binary_file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Append checksums to the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "$(cat "$output_dir/$compressed" | shasum -a 256) $compressed" >> $checksums_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script can be improved for robustness and to follow standard practices:
Here is a suggested replacement for the loop that addresses these points. Note that this change will require a corresponding update to
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script can be improved for robustness and to align with the suggested changes in
zip-builds.sh:checksum filenameformat. Usingreadwith two variables is cleaner than creating an array.