utils.sh
This file
The walk stopped after 200 commits: lines older than 5f5da48 point at it.
globset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 1–107why, one step back1#!/bin/bash23# Various utility functions used through CI.45# Finds Cargo's `OUT_DIR` directory from the most recent build.6#7# This requires one parameter corresponding to the target directory8# to search for the build output.9cargo_out_dir() {10 # This works by finding the most recent stamp file, which is produced by11 # every ripgrep build.12 target_dir="$1"13 find "$target_dir" -name ripgrep-stamp -print0 \14 | xargs -0 ls -t \15 | head -n1 \16 | xargs dirname17}1819host() {20 case "$TRAVIS_OS_NAME" in21 linux)22 echo x86_64-unknown-linux-gnu23 ;;24 osx)25 echo x86_64-apple-darwin26 ;;27 esac28}2930architecture() {31 case "$TARGET" in32 x86_64-*)33 echo amd6434 ;;35 i686-*|i586-*|i386-*)36 echo i38637 ;;38 arm*-unknown-linux-gnueabihf)39 echo armhf40 ;;41 *)42 die "architecture: unexpected target $TARGET"43 ;;44 esac45}4647gcc_prefix() {48 case "$(architecture)" in49 armhf)50 echo arm-linux-gnueabihf-51 ;;52 *)53 return54 ;;55 esac56}5758is_musl() {59 case "$TARGET" in60 *-musl) return 0 ;;61 *) return 1 ;;62 esac63}6465is_x86() {66 case "$(architecture)" in67 amd64|i386) return 0 ;;68 *) return 1 ;;69 esac70}7172is_x86_64() {73 case "$(architecture)" in74 amd64) return 0 ;;75 *) return 1 ;;76 esac77}7879is_arm() {80 case "$(architecture)" in81 armhf) return 0 ;;82 *) return 1 ;;83 esac84}8586is_linux() {87 case "$TRAVIS_OS_NAME" in88 linux) return 0 ;;89 *) return 1 ;;90 esac91}9293is_osx() {94 case "$TRAVIS_OS_NAME" in95 osx) return 0 ;;96 *) return 1 ;;97 esac98}99100builder() {101 if is_musl && is_x86_64; then102 cargo install cross103 echo "cross"104 else105 echo "cargo"106 fi107}