Skip to content

Commit 9869291

Browse files
committed
wip
1 parent 655a383 commit 9869291

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

eng/scripts/get-aspire-cli.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ readonly RESET='\033[0m'
1919
INSTALL_PATH=""
2020
VERSION=""
2121
QUALITY=""
22-
OS=""
23-
ARCH=""
22+
OS_ARG=""
23+
ARCH_ARG=""
2424
SHOW_HELP=false
2525
VERBOSE=false
2626
KEEP_ARCHIVE=false
2727
DRY_RUN=false
28+
HOST_OS="unset"
2829
DEFAULT_QUALITY="release"
2930

3031
# Function to show help
@@ -111,7 +112,7 @@ parse_args() {
111112
say_info "Use --help for usage information."
112113
exit 1
113114
fi
114-
OS="$2"
115+
OS_ARG="$2"
115116
shift 2
116117
;;
117118
--arch)
@@ -120,7 +121,7 @@ parse_args() {
120121
say_info "Use --help for usage information."
121122
exit 1
122123
fi
123-
ARCH="$2"
124+
ARCH_ARG="$2"
124125
shift 2
125126
;;
126127
-k|--keep-archive)
@@ -662,14 +663,17 @@ construct_aspire_cli_url() {
662663
# Function to download and install archive
663664
download_and_install_archive() {
664665
local temp_dir="$1"
665-
local os arch runtimeIdentifier url filename checksum_url checksum_filename extension
666+
local target_os="$2"
667+
local target_arch="$3"
668+
669+
local runtimeIdentifier url filename checksum_url checksum_filename extension
666670
local cli_exe cli_path
667671

668672
# Construct the runtime identifier using the function
669-
runtimeIdentifier=$(get_runtime_identifier "$os" "$arch")
673+
runtimeIdentifier=$(get_runtime_identifier "$target_os" "$target_arch")
670674

671675
# Determine file extension based on OS
672-
if [[ "$os" == "win" ]]; then
676+
if [[ "$target_os" == "win" ]]; then
673677
extension="zip"
674678
else
675679
extension="tar.gz"
@@ -705,11 +709,11 @@ download_and_install_archive() {
705709
fi
706710

707711
# Install the archive
708-
if ! install_archive "$filename" "$INSTALL_PATH" "$os"; then
712+
if ! install_archive "$filename" "$INSTALL_PATH" "$target_os"; then
709713
return 1
710714
fi
711715

712-
if [[ "$os" == "win" ]]; then
716+
if [[ "$target_os" == "win" ]]; then
713717
cli_exe="aspire.exe"
714718
else
715719
cli_exe="aspire"
@@ -727,6 +731,8 @@ if [[ "$SHOW_HELP" == true ]]; then
727731
exit 0
728732
fi
729733

734+
HOST_OS=$(detect_os)
735+
730736
# Validate that both --version and --quality are not provided together
731737
if [[ -n "$VERSION" && -n "$QUALITY" ]]; then
732738
say_error "Cannot specify both --version and --quality. Use --version for a specific version or --quality for a quality level."
@@ -760,7 +766,7 @@ fi
760766
trap cleanup EXIT
761767

762768
# Download and install the archive
763-
if ! download_and_install_archive "$temp_dir"; then
769+
if ! download_and_install_archive "$temp_dir" "$OS_ARG" "$ARCH_ARG"; then
764770
exit 1
765771
fi
766772

eng/scripts/tests/test-get-aspire-cli-pr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ test_keep_archive_flag() {
148148
# Test: NuGet hive path construction
149149
test_nuget_hive_path() {
150150
local test_install_path="$TEST_BASE_DIR/test-install-nuget-hive"
151-
run_test "NuGet hive path is correctly constructed" "$SCRIPT_UNDER_TEST $TEST_PR_NUMBER --install-path $test_install_path --dry-run --verbose" 0 "hive/pr-$TEST_PR_NUMBER" ""
151+
run_test "NuGet hive path is correctly constructed" "$SCRIPT_UNDER_TEST $TEST_PR_NUMBER --install-path $test_install_path --dry-run --verbose" 0 "hives/pr-$TEST_PR_NUMBER" ""
152152
}
153153

154154
# Test: Large PR number validation (should fail for non-existent PR)

0 commit comments

Comments
 (0)