Add commit-hash.sh for recipe troubleshooting

Signed-off-by: Ojus Chugh <ojuschugh@gmail.com>
This commit is contained in:
Ojus Chugh 2025-12-25 20:13:35 +05:30
parent 499530768a
commit 925e957c85

View File

@ -1,15 +1,27 @@
#!/usr/bin/env bash #!/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 then
echo "Usage: $0 recipe_name" echo "Error: recipes/core directory not found"
echo " Print the commit hash for recipe_name"
exit 1 exit 1
fi fi
recipe_path="$(target/release/find_recipe $1)" # Iterate through all system recipes in recipes/core
for recipe_dir in recipes/core/*/
cd "$recipe_path"/source do
git branch -v 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