From befbab002a7eef1a9d366ce212864dfab64dbe22 Mon Sep 17 00:00:00 2001 From: greysoh Date: Sat, 13 Jul 2024 18:45:54 -0400 Subject: [PATCH] feature: Changes build script to only rebuild upon changes. --- .gitignore | 3 ++- build.sh | 2 +- buildall.sh | 12 +++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4a0ac37..59d3f8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ out build.log -secrets.nix \ No newline at end of file +secrets.nix +meta \ No newline at end of file diff --git a/build.sh b/build.sh index 21f5887..8afc561 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,6 @@ echo "Copying file to the output directory..." # Hack! # TODO: Fix this mess later mkdir -p out/$1 -rm -rf out/$1 +rm -rf out/$1 out/$1.vma.zst OUT_FILE="$(sed -n '$p' build.log)" cp -r $OUT_FILE out/$1.vma.zst \ No newline at end of file diff --git a/buildall.sh b/buildall.sh index d0a5759..317ac46 100755 --- a/buildall.sh +++ b/buildall.sh @@ -1,12 +1,22 @@ #!/usr/bin/env bash +mkdir meta > /dev/null 2> /dev/null + for FILE in kitteh-node-*/*; do FILE_NO_EXTENSION="${FILE/".nix"/""}" - if [ ! -f "out/$FILE_NO_EXTENSION.vma.zst" ] || git diff --exit-code $FILE; then + # Hacky! + mkdir -p meta/$FILE + rm -rf meta/$FILE + + sha512sum $FILE > /tmp/kt-clusterbuild_sha512sum + + if [ ! -f "meta/$FILE.sha" ] || ! diff -q "/tmp/kt-clusterbuild_sha512sum" "meta/$FILE.sha" > /dev/null; then ./build.sh $FILE_NO_EXTENSION else echo "Not building '$FILE_NO_EXTENSION'." fi + + mv "/tmp/kt-clusterbuild_sha512sum" "meta/$FILE.sha" done echo "Done building." \ No newline at end of file