summaryrefslogtreecommitdiff
path: root/intro
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-13 12:01:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-13 12:01:50 +0200
commitbd3ce4d1c33b53b26a7de54e4a701d90640ceac7 (patch)
tree6500c17d89d7b858124f3ba4e9507d4cfba0ae11 /intro
parent48cf7b58f3f210ba94667ee8aaaa11da347a3511 (diff)
Add support for showing commands to intro script
Diffstat (limited to 'intro')
-rwxr-xr-xintro111
1 files changed, 70 insertions, 41 deletions
diff --git a/intro b/intro
index 1aa31d5..7b713dd 100755
--- a/intro
+++ b/intro
@@ -19,6 +19,9 @@
# -h
# The hello2 source directory, by default hello/hello2
#
+# -s
+# Show the commands being executed.
+#
# For example:
#
# intro https://pkg.cppget.org/1/hello
@@ -36,6 +39,7 @@ tmp=/tmp
rep=
toolchain=
hello2=hello/hello2
+show=n
c1=g++-5
c2=clang++-3.6
@@ -68,6 +72,10 @@ while [ $# -gt 0 ]; do
hello2=${1%/}
shift
;;
+ -s)
+ show=y
+ shift
+ ;;
*)
rep=${1%/}
break
@@ -105,6 +113,17 @@ else
tree=tree
fi
+function show () # <cmd> ...
+{
+ if [ $show = "y" ]; then
+ echo "$*"
+ $*
+ echo
+ else
+ $*
+ fi
+}
+
function create () # <dir> <bpkg-args>
{
local d=$1; shift
@@ -112,54 +131,62 @@ function create () # <dir> <bpkg-args>
rm -rf $tmp/$d
mkdir $tmp/$d
cd $tmp/$d
- bpkg create $*
+ show bpkg create $*
}
function info () # stable|testing
{
local d=$1; shift
- bpkg rep-info $rep/$d
+ show bpkg rep-info $rep/$d
}
function add () # stable|testing
{
local d=$1; shift
- bpkg add $rep/$d
+ show bpkg add $rep/$d
}
function fetch ()
{
- bpkg fetch
+ show bpkg fetch
}
function build () # <bpkg-args>
{
- bpkg build -y $*
+ show bpkg build -y $*
}
function drop () # <bpkg-args>
{
- bpkg drop -y $*
+ show bpkg drop -y $*
}
function status () # <pkg> <expected>
{
+ if [ $show = "y" ]; then
+ echo "bpkg status $1"
+ fi
+
local s=`bpkg status $1`
echo "$s"
if [ "$s" != "$2" ]; then
error "status $1: '"$s"', expected: '"$2"'"
fi
+
+ if [ $show = "y" ]; then
+ echo
+ fi
}
function update () # <bpk>
{
- bpkg update $*
+ show bpkg update $*
}
function test () # <bpk>
{
- bpkg test $*
+ show bpkg test $*
}
create hello-gcc5-release cxx config.cxx=$c1 config.cxx.coptions=-O3
@@ -169,7 +196,7 @@ fetch
build hello
drop hello
build -v hello
-status libhello "configured 1.0.0+1"
+status libhello "configured 1.0.1"
status hello "configured 1.0.0 hold_package"
drop hello
status hello "available 1.0.0"
@@ -178,50 +205,52 @@ status libfoobar "unknown"
build hello
add testing
fetch
+status libhello "configured 1.0.1; available 1.1.1 1.1.0"
build hello
build libhello
update hello
-build libhello/1.0.0 hello
+build libhello/1.0.1 hello
test libhello hello
-ls -1F
-ls -1F hello-1.0.0/
-hello-1.0.0/hello || true
-hello-1.0.0/hello World
-
-bpkg install config.install.root=/opt/hello config.install.root.sudo=sudo \
- config.bin.rpath=/opt/hello/lib hello
-$tree -F /opt/hello/
-/opt/hello/bin/hello World
+show ls -1F
+show ls -1F hello-1.0.0/
+show hello-1.0.0/hello || true
+show hello-1.0.0/hello World
+
+show bpkg install config.install.root=/opt/hello \
+ config.install.root.sudo=sudo \
+ config.bin.rpath=/opt/hello/lib hello
+show $tree -F /opt/hello/
+show /opt/hello/bin/hello World
sudo rm -rf /opt/hello
-cd $hello2
-b config.cxx=$c1 config.import.libhello=$tmp/hello-gcc5-release
-$tree -F
-./hello
-b config.cxx=$c1 config.import.libhello=$tmp/hello-gcc5-release clean # Extra.
+show cd $hello2
+show b config.cxx=$c1 config.import.libhello=$tmp/hello-gcc5-release
+show $tree -F
+show ./hello
+show b config.cxx=$c1 config.import.libhello=$tmp/hello-gcc5-release clean # Extra.
-cd $tmp
+show cd $tmp
rm -rf hello2-gcc5-release
-mkdir hello2-gcc5-release
-b config.cxx=$c1 config.cxx.coptions=-O3 \
-config.import.libhello=$tmp/hello-gcc5-release \
-"configure($hello2/@hello2-gcc5-release/)"
-b hello2-gcc5-release/
-cd hello2-gcc5-release/
-b
-b clean
-b -v
-
-cd $tmp
-b "configure($hello2/@$tmp/hello-gcc5-release/hello2/)"
-b $tmp/hello-gcc5-release/hello2/
-b "{clean disfigure}($tmp/hello-gcc5-release/hello2/)"
+show mkdir hello2-gcc5-release
+show b config.cxx=$c1 config.cxx.coptions=-O3 \
+ config.import.libhello=$tmp/hello-gcc5-release \
+ "configure($hello2/@hello2-gcc5-release/)"
+show b hello2-gcc5-release/
+show cd hello2-gcc5-release/
+show b
+show b clean
+show b -v
+
+show cd $tmp
+show b "configure($hello2/@$tmp/hello-gcc5-release/hello2/)"
+show b $tmp/hello-gcc5-release/hello2/
+show b "{clean disfigure}($tmp/hello-gcc5-release/hello2/)"
build -d $tmp/hello-gcc5-release $hello2/
build -d $tmp/hello-gcc5-release libhello
update -d $tmp/hello-gcc5-release hello2
-$tmp/hello-gcc5-release/hello2-1.0.0/hello
+show $tmp/hello-gcc5-release/hello2-1.0.0/hello
if [ -n "$c2" ]; then
create hello-clang36-release cxx config.cxx=$c2 config.cxx.coptions=-O3
@@ -239,5 +268,5 @@ if [ -n "$c3" ]; then
fetch
build hello
export WINEDEBUG=fixme-all
- wine hello-1.0.0/hello.exe Windows
+ show wine hello-1.0.0/hello.exe Windows
fi