blob: 29705da2f433c0abcec8238eab55ee6892c8e180 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#! /usr/bin/env bash
# Test build2 toolchain (and brep) upgrade. The old packages come from
# cppget.org/alpha and the new ones from cppget.org/queue. Run from build2/
# root.
#
# Usage: test-upgrade [options] <old-toolchain>
#
# -c <option>|<module>|<var>
# Specify additional options, modules, or configuration variables to pass
# to the bpkg create command. For example:
#
usage="usage: $0 -t <old-toolchain>"
owd=`pwd`
trap "{ cd $owd; exit 1; }" ERR
set -o errtrace # Trap in functions.
function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }
cfg=/tmp/upgrade-cfg
ins=/tmp/upgrade-install
toolchain=
co=() # Use a bash array to handle arguments with spaces (say "-Ifoo -Ibar").
while [ $# -gt 0 ]; do
case $1 in
-c)
shift
co=("${co[@]}" "$1")
shift
;;
*)
toolchain=${1%/}
shift
break
;;
esac
done
if [ -z "$toolchain" ]; then
error $usage
fi
ob="$toolchain/bin/b"
if [ ! -x $ob ]; then
error "$ob does not exist or is not executable"
fi
obo="--build $ob"
obpkg="$toolchain/bin/bpkg"
if [ ! -x $obpkg ]; then
error "$obpkg does not exist or is not executable"
fi
# First create the configuration and build old packages using the old
# toolchain.
#
$obpkg $obo create -d $cfg --wipe "${co[@]}"
$obpkg add -d $cfg cppget.org/repository/1/alpha
$obpkg fetch -d $cfg
$obpkg $obo build -d $cfg --yes build2 bpkg brep
# Now upgrade to new packages but still using the old toolchain.
#
$obpkg add -d $cfg cppget.org/repository/1/queue
$obpkg fetch -d $cfg
$obpkg $obo build -d $cfg --yes build2 bpkg brep
# Install the new packages still using the old toolchain.
#
$obpkg $obo install -d $cfg config.install.root=$ins \
config.bin.rpath=$ins/lib build2 bpkg brep
$ins/bin/b --version 1>&2
$ins/bin/bpkg --version 1>&2
$ins/bin/brep-load --version 1>&2
# Check the use of the new toolchain on the old configuration.
#
nb="$ins/bin/b"
nbo="--build $nb"
nbpkg="$ins/bin/bpkg"
$nbpkg $nbo clean -d $cfg build2 bpkg brep
$nbpkg $nbo build -d $cfg --yes build2 bpkg brep
$nbpkg $nbo install -d $cfg config.install.root=$ins \
config.bin.rpath=$ins/lib build2 bpkg brep
$ins/bin/b --version 1>&2
$ins/bin/bpkg --version 1>&2
$ins/bin/brep-load --version 1>&2
|