From d25f65c565b2dee5d18d1f3a0d5b370e0d9c9c56 Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Thu, 5 Aug 2021 11:26:55 +0200 Subject: [PATCH] Add tool for applying/saving Tock patches --- maintainers/patches | 82 +++++++++++++++++++ .../reproduce_board.sh | 0 .../reproduce_hashes.sh | 0 .../update_hashes.sh | 0 4 files changed, 82 insertions(+) create mode 100755 maintainers/patches rename reproduce_board.sh => maintainers/reproduce_board.sh (100%) rename reproduce_hashes.sh => maintainers/reproduce_hashes.sh (100%) rename update_hashes.sh => maintainers/update_hashes.sh (100%) diff --git a/maintainers/patches b/maintainers/patches new file mode 100755 index 0000000..89b3e52 --- /dev/null +++ b/maintainers/patches @@ -0,0 +1,82 @@ +#!/bin/zsh + +PROGRAM=$0 + +success() { + echo "\e[1;32mDone:\e[m $1" + exit 0 +} + +fail() { + echo "\e[1;31mError:\e[m $1" + exit 1 +} + +help() { + cat < ../../patches/tock/${file#*-} + done + git clean -qfxd + top=$(get_head) + git checkout -q $root + rm -r boards + patch -sp1 < ../../patches/tock/00-boards.patch + rm ../../patches/tock/00-boards.patch + rsync -a --delete boards ../.. + git reset -q --hard + git clean -qfxd + git checkout -q $top + ) || exit + success 'Saved the Tock submodule to the patches.' +} + +[[ $(basename $PWD) == OpenSK ]] || fail 'Not running from OpenSK directory.' +[[ $# -eq 1 ]] || help +case $1 in + apply) apply ;; + save) save ;; + *) fail 'Unexpected argument. Run without argument for help.' ;; +esac diff --git a/reproduce_board.sh b/maintainers/reproduce_board.sh similarity index 100% rename from reproduce_board.sh rename to maintainers/reproduce_board.sh diff --git a/reproduce_hashes.sh b/maintainers/reproduce_hashes.sh similarity index 100% rename from reproduce_hashes.sh rename to maintainers/reproduce_hashes.sh diff --git a/update_hashes.sh b/maintainers/update_hashes.sh similarity index 100% rename from update_hashes.sh rename to maintainers/update_hashes.sh