[PATCH build] Add -L command-line option to list build components.

Trevor Woerner twoerner at gmail.com
Tue Aug 10 06:45:06 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

I don't know if others have a better way of doing this, but sometimes it
would be nice to sit in the top-most directory and perform arbitrary git
commands in all modules which are being built. E.g.:

for module in `util/modular/build.sh -L`; do
    pushd $module
    git status
    popd
done

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 build.sh |   68 ++++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/build.sh b/build.sh
index 0bc366b..aef5641 100755
--- a/build.sh
+++ b/build.sh
@@ -145,6 +145,10 @@ clone() {
 }
 
 build() {
+    if [ -n "$LISTONLY" ]; then
+	echo "$1/$2"
+	return 0
+    fi
     if [ -n "$RESUME" ]; then
 	if [ "$RESUME" = "$1/$2" ]; then
 	    unset RESUME
@@ -701,6 +705,9 @@ usage() {
     echo "  --autoresume file : autoresume from file"
     echo "  --check : run make check in addition to others"
     echo ""
+    echo "Usage: $0 -L"
+    echo "  -L : just list modules to build"
+    echo ""
     envoptions
 }
 
@@ -779,6 +786,9 @@ do
 	shift
 	SUDO=$1
 	;;
+    -L)
+	LISTONLY=1
+	;;
     *)
 	PREFIX=$1
 	;;
@@ -787,7 +797,7 @@ do
     shift
 done
 
-if test x"${PREFIX}" = x ; then
+if test x"${PREFIX}" = x -a -z "$LISTONLY" ; then
     usage
     exit
 fi
@@ -803,11 +813,13 @@ export HOST_OS
 export HOST_CPU
 export LIBDIR
 
-echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
+if [ -z "$LISTONLY" ]; then
+    echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
 
-# Must create local aclocal dir or aclocal fails
-ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
-$SUDO mkdir -p ${ACLOCAL_LOCALDIR}
+    # Must create local aclocal dir or aclocal fails
+    ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
+    $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
+fi
 
 # The following is required to make aclocal find our .m4 macros
 if test x"$ACLOCAL" = x; then
@@ -840,10 +852,12 @@ if test x"$FONTPATH" = x; then
     export FONTPATH
 fi
 
-# Create the log file directory
-$SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
+if [ -z "$LISTONLY" ]; then
+    # Create the log file directory
+    $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
 
-date
+    date
+fi
 
 # We must install the global macros before anything else
 build util macros
@@ -864,26 +878,28 @@ if test $LIB_ONLY -eq 0; then
     build_util
 fi
 
-date
+if [ -z "$LISTONLY" ]; then
+    date
 
-if test "x$nonexistent_components" != x ; then
-    echo ""
-    echo "***** Skipped components (not available) *****"
-    echo "$nonexistent_components"
-    echo ""
-fi
+    if test "x$nonexistent_components" != x ; then
+	echo ""
+	echo "***** Skipped components (not available) *****"
+	echo "$nonexistent_components"
+	echo ""
+    fi
 
-if test "x$failed_components" != x ; then
-    echo ""
-    echo "***** Failed components *****"
-    echo "$failed_components"
-    echo ""
-fi
+    if test "x$failed_components" != x ; then
+	echo ""
+	echo "***** Failed components *****"
+	echo "$failed_components"
+	echo ""
+    fi
 
-if test "x$CLONE" != x && test "x$clonefailed_components" != x ;  then
-    echo ""
-    echo "***** Components failed to clone *****"
-    echo "$clonefailed_components"
-    echo ""
+    if test "x$CLONE" != x && test "x$clonefailed_components" != x ;  then
+	echo ""
+	echo "***** Components failed to clone *****"
+	echo "$clonefailed_components"
+	echo ""
+    fi
 fi
 
-- 
1.7.1



More information about the xorg-devel mailing list