Skip to content

Commit

Permalink
MINOR: [CI] Only try to read vcpkg version from .env if it isn't spec…
Browse files Browse the repository at this point in the history
…ified (apache#41805)

### Rationale for this change

See apache#41599 (comment)

This is a small tidy up of `install_vcpkg.sh` based on code review in apache#41599 after it was merged. Some uses of `install_vcpkg.sh` are in Docker containers where the `.env` file hasn't been copied. Rather than try to read it and ignore any errors, only read the `.env` file if the vcpkg version wasn't specified as an argument to the script. This way if there is an error reading the `.env` file and we do need the default version, the error should be more helpful.

### What changes are included in this PR?

Update `install_vcpkg.sh` to only try to read the vcpkg version from `.env` if it isn't specified as an argument and don't ignore any errors.

### Are these changes tested?

Yes, this script already runs as part of CI.

### Are there any user-facing changes?

No

Authored-by: Adam Reeve <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
adamreeve authored May 24, 2024
1 parent 0c96be3 commit 19044ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ci/scripts/install_vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ if [ "$#" -lt 1 ]; then
fi

arrow_dir=$(cd -- "$(dirname -- "$0")/../.." && pwd -P)
default_vcpkg_version=$(source "${arrow_dir}/.env" && echo "$VCPKG" || echo "")
default_vcpkg_ports_patch="${arrow_dir}/ci/vcpkg/ports.patch"

vcpkg_destination=$1
vcpkg_version=${2:-$default_vcpkg_version}
vcpkg_version=${2:-}
vcpkg_ports_patch=${3:-$default_vcpkg_ports_patch}

if [ -z "${vcpkg_version}" ]; then
vcpkg_version=$(source "${arrow_dir}/.env" && echo "$VCPKG")
fi

# reduce the fetched data using a shallow clone
git clone --shallow-since=2021-04-01 https://github.com/microsoft/vcpkg ${vcpkg_destination}

Expand Down

0 comments on commit 19044ee

Please sign in to comment.