[RFC util-modular] build.sh: add --stop-at to skip some stages of each module
Peter Hutterer
peter.hutterer at who-t.net
Thu Jul 26 21:05:58 PDT 2012
Add a new command to stop each module after the given stage.
Main use-case:
build.sh --clone --stop-at clone
to quickly clone the source tree without building.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
There's an argument to be made for --start-at as well to quickly force a
rebuild of all modules as well, without the autogen/configure stage.
Likewise, once the NOCONFIGURE work hits, we could split autotools and
configure as well, but that's all future work. Meanwhile, I just wanted
build.sh to give me a full source tree without having to wait.
build.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/build.sh b/build.sh
index 4d0efb5..ed4a195 100755
--- a/build.sh
+++ b/build.sh
@@ -390,6 +390,11 @@ process() {
return 0
fi
+ stop_here "clone"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+
old_pwd=`pwd`
cd $SRCDIR
if [ $? -ne 0 ]; then
@@ -424,6 +429,11 @@ process() {
fi
fi
+ stop_here "update"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+
# Build outside source directory
if [ X"$DIR_ARCH" != X ] ; then
mkdir -p "$DIR_ARCH"
@@ -464,6 +474,11 @@ process() {
fi
fi
+ stop_here "configure"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+
# A custom 'make' target list was supplied through --cmd option
if [ X"$MAKECMD" != X ]; then
${MAKE} $MAKEFLAGS $MAKECMD
@@ -490,6 +505,11 @@ process() {
return 1
fi
+ stop_here "build"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+
if [ X"$CHECK" != X ]; then
${MAKE} $MAKEFLAGS check
if [ $? -ne 0 ]; then
@@ -524,6 +544,11 @@ process() {
return 1
fi
+ stop_here "install"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+
if [ X"$CLEAN" != X ]; then
${MAKE} $MAKEFLAGS clean
if [ $? -ne 0 ]; then
@@ -1041,6 +1066,8 @@ process_module_file() {
return 0
}
+stages="clone update configure build install"
+
usage() {
basename="`expr "//$0" : '.*/\([^/]*\)'`"
echo "Usage: $basename [options] [prefix]"
@@ -1070,6 +1097,10 @@ usage() {
echo " is assumed to be configuration options for the configuration"
echo " of each module/component specifically"
echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
+ echo " --stop-at <stage>"
+ echo " Stop module processing after <stage> and continue "
+ echo " with success. Allowed stages are:"
+ echo " $stages"
echo ""
echo "Usage: $basename -L"
echo " -L Just list modules to build"
@@ -1077,6 +1108,17 @@ usage() {
envoptions
}
+stop_here() {
+ current_stage=$1
+
+ if [ x$current_stage = x$STOP_STAGE ]; then
+ echo "Stopping at stage $STOP_STAGE as requested"
+ return 1
+ fi
+
+ return 0
+}
+
# Ensure the named variable value contains a full path name
# arguments:
# $1 - the variable value (the path to examine)
@@ -1282,6 +1324,23 @@ do
--retry-v1)
RETRY_VERBOSE=1
;;
+ --stop-at)
+ shift
+ STOP_STAGE=$1
+ found=0
+ for stage in $stages; do
+ if [ "$stage" = "$STOP_STAGE" ]; then
+ found=1
+ break
+ fi
+ done
+ if [ $found -ne 1 ]; then
+ echo "Invalid stage '$STOP_STAGE'. Allowed stages are: "
+ echo " $stages"
+ usage
+ exit 1
+ fi
+ ;;
*)
if [ X"$too_many" = Xyes ]; then
echo "unrecognized and/or too many command-line arguments"
--
1.7.10.4
More information about the xorg-devel
mailing list