From 3bd2f7cfd65e70f85a658dbaa793524569b18ab3 Mon Sep 17 00:00:00 2001
From: Ian Douglas Scott <ian@iandouglasscott.com>
Date: Sat, 8 Apr 2017 11:13:24 -0700
Subject: [PATCH] Add update-all.sh script to rebuild only out of date packages

---
 cook.sh       |  8 ++++++++
 update-all.sh | 23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100755 update-all.sh

diff --git a/cook.sh b/cook.sh
index 9a20c173a..7fb8c9dea 100755
--- a/cook.sh
+++ b/cook.sh
@@ -101,6 +101,14 @@ function op {
             fi
             popd > /dev/null
             ;;
+        gitversion)
+            if [ -d build/.git ]
+            then
+                echo "$(op $1 version)-$(git -C build rev-parse --short HEAD)"
+            else
+                op $1 version
+            fi
+            ;;
         update)
             pushd build > /dev/null
             skip="0"
diff --git a/update-all.sh b/update-all.sh
new file mode 100755
index 000000000..18a41e85c
--- /dev/null
+++ b/update-all.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+for recipe in `ls -1 recipes`
+do
+    if [ ! -f "recipes/$recipe/stage.tar" ]
+    then
+        echo "$recipe: building..."
+        ./cook.sh $recipe dist
+    else
+        oldver=$(./cook.sh $recipe gitversion)
+        ./cook.sh $recipe update
+        newver=$(./cook.sh $recipe gitversion)
+        if [ "$oldver" = "$newver" ]
+        then
+            echo "$recipe: up to date (version $newver)."
+        else
+            echo "$recipe: updating $oldver -> $newver..."
+    	    ./cook.sh $recipe dist
+        fi
+    fi
+done
-- 
GitLab