4 echo "btr v0.2.0, (c) Michael Wallner <mike@php.net>"
6 echo "Usage: $(basename $0) [-hv] [<options>] <repository>"
8 echo " -h, --help Display this help"
9 echo " -v, --verbose Be more verbose"
12 echo " -s, --source=<rules> Use the specified source ruleset"
13 echo " -b, --build=<rules> Use the specified build ruleset"
14 echo " -r, --report=<rules> Use the specifued report ruleset"
15 echo " -B, --branch=<branch> Checkout this branch"
16 echo " -D, --directory=<directory> Use this directory as work root"
17 echo " -S, --suffix=<suffix> Append suffix to the build name"
18 echo " -C, --configure=<options> Define \$CONFIGURE options"
21 for ruleset
in source build report
23 printf " %10s: %s\n" $ruleset \
24 "$(find "$LIBDIR/$ruleset" -name '*.mk' -exec basename {} .mk \; | sort | xargs)"
31 local shortoptions
="hvB:D:S:C:s:b:r:"
32 local longoptions
="help,verbose,branch:,directory:,suffix:,configure:,source:,build:,report:"
33 local options
=$
(getopt \
34 --options "$shortoptions" \
35 --longoptions "$longoptions" \
39 if test $?
-ne 0 ; then
43 eval set -- "$options"
76 test -z "$BRANCH" && BRANCH
="master"
80 test -z "$BRANCH" && BRANCH
="trunk"
117 if test -z "$SOURCE_URL" -o -z "$SOURCE_RULES" -o -z "$BUILD_RULES" -o -z "$REPORT_RULES"
122 export SOURCE_URL BRANCH SOURCE_RULES BUILD_RULES REPORT_RULES
126 export BTRDIR
="/tmp/btr"
128 export BTRDIR
=$
(realpath
"$BTRDIR")
131 export REPO
=$
(basename $
(sed -re 's~^.*[/:]~~' <<<"$SOURCE_URL") .git
)
132 export SAFE_BRANCH
=$
(tr ":" "_" <<<$
(basename "$BRANCH"))
136 export BUILD
="$REPO@$SAFE_BRANCH"
138 export BUILD
="$REPO@$SAFE_BRANCH-$SUFFIX"
141 export CLEAN_DIR
="btr+clean-$REPO"
142 export BRANCH_DIR
="btr+branch-$REPO@$SAFE_BRANCH"
143 export BUILD_DIR
="btr+build-$BUILD"
144 export CONFIG_REPORT
="btr+config-$BUILD-$DATE"
145 export BUILD_REPORT
="btr+build-$BUILD-$DATE"
146 export TEST_REPORT
="btr+tests-$BUILD-$DATE"
147 export LAST_REPORT
=$
(basename $
(ls -t "$BTRDIR/btr+tests-$BUILD"* |
tail -n1))
153 echo "BTRDIR = $BTRDIR"
154 echo "BINDIR = $BINDIR"
155 echo "LIBDIR = $LIBDIR"
156 echo "SOURCE_URL = $SOURCE_URL"
157 echo "SOURCE_RULES = $SOURCE_RULES"
158 echo "BUILD_RULES = $BUILD_RULES"
159 echo "REPORT_RULES = $REPORT_RULES"
160 echo "BRANCH = $BRANCH"
161 echo "SAFE_BRANCH = $SAFE_BRANCH"
162 echo "CLEAN_DIR = $CLEAN_DIR"
163 echo "BRANCH_DIR = $BRANCH_DIR"
164 echo "BUILD_DIR = $BUILD_DIR"
165 echo "CONFIG_REPORT = $CONFIG_REPORT"
166 echo "BUILD_REPORT = $BUILD_REPORT"
167 echo "TEST_REPORT = $TEST_REPORT"
168 echo "LAST_REPORT = $LAST_REPORT"