summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2020-12-07 02:11:09 -0500
committerFranklin Wei <franklin@rockbox.org>2020-12-07 02:11:36 -0500
commit40b6897f4fefb652432097da00c9c2bc5d0a655b (patch)
treedff6cb7e690e472a5232ac332504ba871f9ce94e
parentb7ce408f65b92b080337b3670da54e3c3aab79c5 (diff)
downloadrockbox-40b6897f4fefb652432097da00c9c2bc5d0a655b.tar.gz
rockbox-40b6897f4fefb652432097da00c9c2bc5d0a655b.zip
puzzles: tooling to automate the resyncing process
This adds a resync.sh script that handles most of the resyncing process: copying new sources, regenerating help, and staging for commit. I also took this opportunity to make the process more efficient and consistent by only selecting the types of files that we care about and ignoring any autogenerated temporary files that may be in the upstream tree. Change-Id: Ib0803462684b8ae3b40eec3742944e5bdb28508e
-rwxr-xr-xapps/plugins/puzzles/genhelp.sh6
-rwxr-xr-xapps/plugins/puzzles/resync.sh44
2 files changed, 47 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/genhelp.sh b/apps/plugins/puzzles/genhelp.sh
index 9aa304c0c1..3df7706b5d 100755
--- a/apps/plugins/puzzles/genhelp.sh
+++ b/apps/plugins/puzzles/genhelp.sh
@@ -1,10 +1,10 @@
#!/bin/bash
# usage: ./genhelp.sh
#
-# expects halibut to be installed in $PATH:
-# http://www.chiark.greenend.org.uk/~sgtatham/halibut
+# Expects halibut to be installed in $PATH:
+# https://www.fwei.tk/git/halibut
#
-# also requires host CC and lz4 library to be available
+# Also requires host CC and lz4 library to be available
halibut --text src/puzzles.but
diff --git a/apps/plugins/puzzles/resync.sh b/apps/plugins/puzzles/resync.sh
new file mode 100755
index 0000000000..76679971a4
--- /dev/null
+++ b/apps/plugins/puzzles/resync.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Usage: resync.sh PUZZLES_PATH
+#
+# Automatic resync tool. Removes the current source snapshot in src/
+# and copies just the source files we need from the puzzles source
+# tree. Handles help generation as well. Stages changes in git.
+#
+# Expects a modified Halibut (https://www.fwei.tk/git/halibut) to be
+# installed in $PATH. Also requires host CC and lz4 library to be
+# available
+
+
+if [ $# -ne 1 ]
+then
+ echo -e "Usage: $0 PUZZLES_PATH\n"
+ echo "Automatically resync with upstream."
+ echo "PUZZLES_PATH is the path to a puzzles source tree."
+ exit
+fi
+
+echo "=== POTENTIALLY DANGEROUS OPERATION ==="
+echo "Are you sure you want to remove all files in src/?"
+echo -n "If so, type \"yes\" in all caps: "
+read ans
+if [ "YES" == $ans ]
+then
+ pushd "$(dirname "$0")" > /dev/null
+
+ echo "[1/5] Removing current src/ directory"
+ rm -rf src
+ echo "[2/5] Copying new sources"
+ mkdir src
+ cp -r "$1"/{*.c,*.h,*.R,*.but,LICENCE,README} src
+ echo "[3/5] Regenerating help"
+ ./genhelp.sh
+
+ echo "[4/5] Staging for commit"
+ git add src help
+ echo "[5/5] Successfully resynced with upstream"
+
+ popd > /dev/null
+else
+ echo "Did nothing."
+fi