Only rebuild packages as necessary.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 24 Sep 2008 13:07:49 +0000 (14:07 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 24 Sep 2008 13:07:49 +0000 (14:07 +0100)
build-everything-in-mock.sh

index 6b079ad..a4179d6 100755 (executable)
@@ -1,6 +1,12 @@
-#!/bin/sh -
+#!/bin/bash -
 
 DIST=fedora-9
 
 DIST=fedora-9
+SKIP_BUILT_RPMS=1
+
+LOCALREPO=$HOME/public_html/smock/yum
+ARCHES="i386 x86_64"
+
+export DIST SKIP_BUILT_SRPMS LOCALREPO ARCHES
 
 specs=`perl show-build-order.pl |
        grep -v '^#' |
 
 specs=`perl show-build-order.pl |
        grep -v '^#' |
@@ -15,7 +21,26 @@ for spec in $specs
 do
     set -e
     dir=`dirname $spec`
 do
     set -e
     dir=`dirname $spec`
-    srcrpm=`rpmbuild --define "_sourcedir $pwd/$dir" -bs $spec |
-            awk '{print $2}'`
-    smock/smock $DIST $srcrpm
+    srcrpm=`rpmbuild --define "_sourcedir $pwd/$dir" -bs $spec`
+    if [ $? != 0 ]; then exit 1; fi
+    srcrpm=`echo $srcrpm | awk '{print $2}'`
+
+    # Test if all the output RPMs exist already.
+    skip=
+    if [ $SKIP_BUILT_RPMS ]; then
+       skip=1
+       baserpm=`basename $srcrpm | sed 's/\.fc[[:digit:]]*\.src\.rpm//g'`
+       for arch in $ARCHES; do
+           if [ ! -f $LOCALREPO/$DIST/$arch/RPMS/$baserpm.* ]; then
+               skip=
+           fi
+       done
+    fi
+    echo result of skip = $skip
+
+    if [ $skip ]; then
+       echo "skipping $srcrpm"
+    else
+       echo smock/smock.sh $DIST $srcrpm
+    fi
 done 2>&1 | tee -a buildall.log
 done 2>&1 | tee -a buildall.log