#! /usr/bin/env bash # Test examples from the intro2, the TL;DR section. # # Usage: intro [options] # usage="usage: $0 [options]" owd=`pwd` trap "{ cd $owd; exit 1; }" ERR set -o errtrace # Trap in functions. function error () { echo "$*" 1>&2; exit 1; } tmp=/tmp show=y # Keep in sync with *-tour. # function show () # ... { if [ $show = "y" ]; then echo echo "+ $*" fi local p=("$1") if [ "$1" = b -o "$1" = bpkg -o "$1" = bdep ]; then p+=(--no-progress) fi if [ "$1" = tree ]; then p+=(-n) # No color. fi shift "${p[@]}" "${@}" } cd "$tmp" rm -rf hello.git hello hello-gcc # Prepare hello.git repository. # bdep new -t exe -l c++ --no-init -o hello.git hello cd hello.git sed -i -re 's/version: .+/version: 0.1.0/' manifest git add . git commit -m "first commit" cd .. show git clone --no-progress file://$tmp/hello.git show tree hello show cd hello show bdep init --config-create ../hello-gcc cc config.cxx=g++ show b show hello/hello World cat <>repositories.manifest : role: prerequisite location: https://git.build2.org/hello/libhello.git#v1.0.0 EOF cat <>manifest depends: libhello ^1.0.0 EOF sed -i -re 's/#import/import/' hello/buildfile cat <>hello/hello.cxx #include EOF show b sed -i -re 's/#v1.0.0//' repositories.manifest show bdep fetch bdep sync --no-progress show bdep status -i show bdep sync libhello show bdep sync libhello/1.0.0 cd ..