This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 19044ee609 MINOR: [CI] Only try to read vcpkg version from .env if it 
isn't specified (#41805)
19044ee609 is described below

commit 19044ee609d8618aeea086c3a199ae5a002e92d7
Author: Adam Reeve <[email protected]>
AuthorDate: Fri May 24 17:53:27 2024 +1200

    MINOR: [CI] Only try to read vcpkg version from .env if it isn't specified 
(#41805)
    
    ### Rationale for this change
    
    See https://github.com/apache/arrow/pull/41599#discussion_r1612517256
    
    This is a small tidy up of `install_vcpkg.sh` based on code review in 
#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]>
---
 ci/scripts/install_vcpkg.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ci/scripts/install_vcpkg.sh b/ci/scripts/install_vcpkg.sh
index 861aeeea8b..08989d6444 100755
--- a/ci/scripts/install_vcpkg.sh
+++ b/ci/scripts/install_vcpkg.sh
@@ -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}
 

Reply via email to