From 925e957c85c7a7fdc0f159c18c9ff69ee096990a Mon Sep 17 00:00:00 2001 From: Ojus Chugh Date: Thu, 25 Dec 2025 20:13:35 +0530 Subject: [PATCH] Add commit-hash.sh for recipe troubleshooting Signed-off-by: Ojus Chugh --- scripts/commit-hash.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/commit-hash.sh b/scripts/commit-hash.sh index 19235faea..50653af1c 100755 --- a/scripts/commit-hash.sh +++ b/scripts/commit-hash.sh @@ -1,15 +1,27 @@ #!/usr/bin/env bash -# This script show the current Git branch and commit of the recipe source +# This script shows the current Git commit hash of system recipes at recipes/core -if [ $# -ne 1 ] +set -e + +# Check if recipes/core directory exists +if [ ! -d "recipes/core" ] then - echo "Usage: $0 recipe_name" - echo " Print the commit hash for recipe_name" + echo "Error: recipes/core directory not found" exit 1 fi -recipe_path="$(target/release/find_recipe $1)" - -cd "$recipe_path"/source -git branch -v +# Iterate through all system recipes in recipes/core +for recipe_dir in recipes/core/*/ +do + recipe_name=$(basename "$recipe_dir") + source_dir="$recipe_dir/source" + + # Check if source directory exists and is a git repository + if [ -d "$source_dir" ] && [ -d "$source_dir/.git" ] + then + # Get the commit hash + commit_hash=$(cd "$source_dir" && git rev-parse HEAD) + echo "$recipe_name: $commit_hash" + fi +done