From dc7f3cd85d61ca7af6a935c30b32d71026efdffe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 8 May 2018 19:30:55 +0200 Subject: Add intro2 scripts --- intro2-tldr | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 intro2-tldr (limited to 'intro2-tldr') diff --git a/intro2-tldr b/intro2-tldr new file mode 100755 index 0000000..31d5f49 --- /dev/null +++ b/intro2-tldr @@ -0,0 +1,73 @@ +#! /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 + +function show () # ... +{ + if [ $show = "y" ]; then + echo + echo "+ $*" + "${@}" + else + "${@}" + fi +} + +cd "$tmp" + +rm -rf hello.git hello hello-gcc + +# Prepare hello.git repository. +# +bdep new -t exe -l c++ --no-init -d 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 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 +show bdep status -i + +show bdep sync libhello +show bdep sync libhello/1.0.0 + +cd .. -- cgit v1.1