diff --git a/cook.sh b/cook.sh index 9a20c173aea9b21da5616a3cacca441207e5ac93..ac18a7e01154872b1defaf43205af20881f93f44 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" @@ -215,6 +223,7 @@ then done else echo "cook.sh: recipe '$1' not found" >&2 + exit 1 fi else usage "{package}" diff --git a/update-packages.sh b/update-packages.sh new file mode 100755 index 0000000000000000000000000000000000000000..6a3aba2f9c477ee673ace80b5564eb2ee3f8cb42 --- /dev/null +++ b/update-packages.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +if [ $# = 0 ] +then + recipes=$(ls -1 recipes) +else + recipes=$@ +fi + +for recipe in $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