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

Trevor Woerner twoerner at gmail.com
Mon Aug 9 21:48:15 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 an arbitrary
'git' command in all modules which are being built. E.g.:

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

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

diff --git a/build.sh b/build.sh
index 0bc366b..4a8e67f 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
@@ -843,7 +855,9 @@ fi
 # Create the log file directory
 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
 
-date
+if [ -z "$LISTONLY" ]; then
+    date
+fi
 
 # We must install the global macros before anything else
 build util macros
@@ -864,7 +878,9 @@ if test $LIB_ONLY -eq 0; then
     build_util
 fi
 
-date
+if [ -z "$LISTONLY" ]; then
+    date
+fi
 
 if test "x$nonexistent_components" != x ; then
     echo ""
-- 
1.7.1



More information about the xorg-devel mailing list