Skip to content

Install gnu-tar if missing on Mac OS #64

@anlowee

Description

@anlowee

Request

I am trying to setup on my Mac, but when run task deps:install-all it just told me that it failed without reasons:

xiaochong@Xiaochongs-MBP ~/Develop/ystdlib-cpp ?201 % task deps:install-all 
task: [deps:install-all-init] rm -rf /Users/xiaochong/Develop/ystdlib-cpp/build/deps/cmake-settings
task: [deps:install-all-init] mkdir -p /Users/xiaochong/Develop/ystdlib-cpp/build/deps/cmake-settings
task: Task "utils:cmake:remote:curl-/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src.tar.gz" is up to date
task: [utils:cmake:remote:curl-/Users/xiaochong/Develop/ystdlib-cpp/build/deps/quickcpplib/quickcpplib-src.tar.gz] mkdir -p "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/quickcpplib"
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
  if curl \
      --fail \
      --location \
      --show-error \
      --connect-timeout 10 \
      --max-time 300 \
      "https://github.com/ned14/quickcpplib/archive/f3e452e.tar.gz" \
      --output "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/quickcpplib/quickcpplib-src.tar.gz";
  then
    break
  fi
  attempt=$((attempt + 1))
  sleep 5
done
if [ $attempt -gt $max_attempts ]; then
  echo "Failed to download after $max_attempts attempts."
  exit 1
fi
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0task: [utils:cmake:remote:download-and-extract-tar-/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src] rm -rf "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src"
mkdir -p  "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src"
task: [utils:cmake:remote:download-and-extract-tar-/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src] gtar --extract --strip-components="1" --directory "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src" --file "/Users/xiaochong/Develop/ystdlib-cpp/build/deps/Catch2/Catch2-src.tar.gz" --no-anchored --wildcards 2> /dev/null
task: Failed to run task "deps:install-all": exit status 127

And it turns out that I am missing gnu-tar and after I run brew install gnu-tar it succeeds.

Possible implementation

Detect the OS and install gnu-tar if missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions