<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12-07-27 04:19 PM, Gaetan Nadon
      wrote:<br>
    </div>
    <blockquote cite="mid:5012F7D7.6010403@videotron.ca" type="cite">
      <pre wrap="">On 12-07-27 12:05 AM, Peter Hutterer wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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 <a class="moz-txt-link-rfc2396E" href="mailto:peter.hutterer@who-t.net"><peter.hutterer@who-t.net></a>
---
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
+
</pre>
      </blockquote>
      <pre wrap="">Ok for this. This will clone any missing modules and not git-pull
existing modules.
</pre>
      <blockquote type="cite">
        <pre wrap="">     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
+
</pre>
      </blockquote>
      <pre wrap="">
Ok, this will clone missing modules and git-pull others such that you
have a complete up-to-date source tree.
</pre>
      <blockquote type="cite">
        <pre wrap="">     # 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
+
</pre>
      </blockquote>
      <pre wrap="">Limited usefulness. When autogen.sh is not run, dependant modules will
fail in the config step as the .pc files are not installed. Is it worth
the confusion? It can always be added later given the open design.

</pre>
      <blockquote type="cite">
        <pre wrap="">     # 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
+
</pre>
      </blockquote>
      <pre wrap="">Limited usefulness. When make is not run, dependant modules will fail in
the config step as the .pc files are not installed. Is it worth the
confusion?

This is the wrong place to bail out. A user might have specified
--check. I don't think you meant the stop_at to be an override for
running the tests.


</pre>
      <blockquote type="cite">
        <pre wrap="">     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
+
</pre>
      </blockquote>
      <pre wrap="">
Same idea here, a user may have specified -c, -d or -D. Once fixed, I
can't see how stopping after install is any different from a normal
termination.
</pre>
      <blockquote type="cite">
        <pre wrap="">     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"
</pre>
      </blockquote>
      <pre wrap="">
It looks like 'clone' and 'update' are the only stages that would be
useful. In terms of naming the stages, consider using 'git-pull' as
opposed to 'update' as this is very generic and mean different things to
different people.

For testing, verify 'auto-resume' and 'single component build' features
are not affected. Also check the log.
Will the patch affect the '--cmd' or 'retry-v1'?
What should happen if a user enters 'build.sh --stop-at clone' without
using --clone? Noop, error message?
</pre>
    </blockquote>
    Consider this alternative:<br>
    <blockquote><tt>build.sh </tt>--clone -a -m<br>
    </blockquote>
    Where -m (or --no-make) is a new option that means "do not run make"
    which is analogous to -a.<br>
    <br>
    Existing option:<br>
    <tt>    -a          Do NOT run auto config tools (autogen.sh,
      configure)"<br>
          -p          Update source code before building (git pull --</tt>rebase)<br>
    <br>
    In the scenario where one wants to clone missing modules and update
    existing ones:<br>
    <blockquote><tt>build.sh --clone -a -p -m</tt><br>
    </blockquote>
    Note that the "install " make target is mandatory and there is no
    current way to skip this step.<br>
    <br>
    We already had options to control 3 out of 4 of the build stages.<br>
    <br>
    <blockquote cite="mid:5012F7D7.6010403@videotron.ca" type="cite">
      <pre wrap="">
_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development
Archives: <a class="moz-txt-link-freetext" href="http://lists.x.org/archives/xorg-devel">http://lists.x.org/archives/xorg-devel</a>
Info: <a class="moz-txt-link-freetext" href="http://lists.x.org/mailman/listinfo/xorg-devel">http://lists.x.org/mailman/listinfo/xorg-devel</a>

</pre>
    </blockquote>
    <br>
  </body>
</html>