diff mbox series

[auh,6/6] weeklyjob.sh: Add options to handle upgrading meta-oe

Message ID 20231101000534.241551-7-yoann.congal@smile.fr
State New
Headers show
Series Extend AUH to meta-openembedded | expand

Commit Message

Yoann Congal Nov. 1, 2023, 12:05 a.m. UTC
For example:
  ./weeklyjob.sh --layer-dir ../meta-openembedded/ --layer-names "meta-oe"

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 weeklyjob.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/weeklyjob.sh b/weeklyjob.sh
index 94598a2..00f3575 100755
--- a/weeklyjob.sh
+++ b/weeklyjob.sh
@@ -13,6 +13,59 @@  poky_dir=~/poky
 build_dir=~/build-tmp-auh-upgrades
 sstate_dir=~/sstate-cache
 
+ARGS=$(getopt -o '' --long 'layer-dir:,layer-names:,layer-machines:' -n 'weeklyjob.sh' -- "$@")
+if [ $? -ne 0 ]; then
+    echo 'Cannot parse arguments...' >&2
+    exit 1
+fi
+eval set -- "$ARGS"
+unset ARGS
+
+LAYERDIR="."
+LAYERNAMES=""
+LAYERMACHINES=""
+DEFAULT=1
+
+while true; do
+    case "$1" in
+        '--layer-dir')
+            LAYERDIR=$(realpath $2)
+			DEFAULT=0
+            shift 2
+            continue
+        ;;
+        '--layer-names')
+            LAYERNAMES+=" $2"
+			DEFAULT=0
+            shift 2
+            continue
+        ;;
+        '--layer-machines')
+            LAYERMACHINES+=" $2"
+			DEFAULT=0
+            shift 2
+            continue
+        ;;
+        '--')
+            shift
+            break
+        ;;
+        *)
+            echo "Unexpected value $1" >&2
+            exit 1
+        ;;
+    esac
+done
+
+# Default to poky/meta
+if [ "$LAYERNAMES" == "" ]; then
+    LAYERNAMES="meta"
+fi
+# Default to qemux86-64
+if [ "$LAYERMACHINES" == "" ]; then
+    LAYERMACHINES="qemux86-64"
+fi
+
 pushd $poky_dir
 
 # Base the upgrades on poky master
@@ -20,7 +73,11 @@  git fetch origin
 git checkout -B tmp-auh-upgrades origin/master
 
 source $poky_dir/oe-init-build-env $build_dir
-$auh_dir/upgrade-helper.py -e all
+if [ "$DEFAULT" -ne 0 ]; then
+	$auh_dir/upgrade-helper.py -e all
+else
+	$auh_dir/upgrade-helper.py -e all --layer-dir $LAYERDIR --layer-names "$LAYERNAMES" --layer-machines "$LAYERMACHINES"
+fi
 
 # clean up to avoid the disk filling up
 rm -rf $build_dir/tmp/