Sha256: 89460b40d0f71a87f0f8a1ff57ab5b6241c4cb146477e7ad5161c39bcab29ab8

Contents?: true

Size: 1.88 KB

Versions: 92

Compression:

Stored size: 1.88 KB

Contents

#!/usr/bin/env bash

# Build tools on Mac OS X host and in all vms

set -e

MAKE_TASK='all -j'

filters=()
for arg in "$@"; do
  if [[ "$arg" =~ ^([A-Z_]+)=(.*)$ ]]; then
    eval "$(printf %q=%q "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}")"
  else
    filters+=($arg)
  fi
done
filters=$(IFS='|'; echo "${filters[*]}")

passes-filter() {
  [[ '' = "$filters" ]] || [[ "$1" =~ $filters ]]
}

header() {
  printf '\033[1;7m######## %s ########\033[0m\n' "$1"
}

if [[ $(uname -s) != 'Darwin' ]]; then
  echo 'expected to run on Mac OS X'
  exit 1
fi

for arch in x86_64; do
  platform="darwin-$arch"
  passes-filter "$platform" || continue
  header "$platform"

  build_dir=~_image_optim/pack

  mkdir -p "vendor/$platform"

  sudo -u _image_optim --set-home bash -c "
    set -e

    mkdir -p '$build_dir'
    cd '$build_dir'

    ln -nsf '$PWD/Makefile' '$PWD/checksums.mk' '$PWD/download' .
    rsync -aR --del '$PWD/./vendor/$platform' .

    make $MAKE_TASK ARCH=$arch
  "

  rsync -aR --del "$build_dir/./vendor/$platform" .
done

for vm in $(perl -pe "s/.*?'(.+?-.+?)'\s+=>\s+'.+?\/.+?'.*|.*/\$1/" Vagrantfile | uniq); do
  passes-filter "$vm" || continue
  header "$vm"

  if [[ -z "$NO_UP" ]]; then
    vagrant status "$vm" | grep -q running || vagrant up "$vm"
  fi

  # create ssh config
  ssh_config=".vagrant/ssh_config.$vm"
  vagrant ssh-config "$vm" > "$ssh_config"

  # rsync needed files to the box
  mkdir -p "vendor/$vm"
  rsync -e "ssh -F $ssh_config" -aR --del Makefile checksums.mk download "vendor/$vm" "$vm:/vagrant"

  # sync time and run make
  ssh -F "$ssh_config" "$vm" "
    set -e

    sudo ntpdate pool.ntp.org

    cd /vagrant
    if make -v 2>&1 | grep -q GNU\ Make; then
      make $MAKE_TASK
    else
      gmake $MAKE_TASK
    fi
  "

  # rsync files in vendor from the box
  rsync -e "ssh -F $ssh_config" -aR --del "$vm:/vagrant/./vendor/$vm" .

  [[ -n "$NO_HALT" ]] || vagrant halt "$vm"
done

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
image_optim_pack-0.10.1-x86_64-linux script/run
image_optim_pack-0.10.1-x86_64-darwin script/run
image_optim_pack-0.10.1 script/run
image_optim_pack-0.10.0.20231105-x86_64-linux script/run
image_optim_pack-0.10.0.20231105-x86_64-darwin script/run
image_optim_pack-0.10.0.20231105 script/run
image_optim_pack-0.10.0.20231014-x86_64-linux script/run
image_optim_pack-0.10.0.20231014-x86_64-darwin script/run
image_optim_pack-0.10.0.20231014 script/run
image_optim_pack-0.10.0-x86_64-linux script/run
image_optim_pack-0.10.0-x86_64-darwin script/run
image_optim_pack-0.10.0 script/run
image_optim_pack-0.9.1.20230828 script/run
image_optim_pack-0.9.1.20230828-x86_64-linux script/run
image_optim_pack-0.9.1.20230828-x86_64-darwin script/run
image_optim_pack-0.9.1.20230828-x86-linux script/run
image_optim_pack-0.9.1.20230814-x86-linux script/run
image_optim_pack-0.9.1.20230814-x86_64-linux script/run
image_optim_pack-0.9.1.20230814-x86_64-darwin script/run
image_optim_pack-0.9.1.20230814 script/run