#!/bin/bash# Check if a Bootstrap Jam repository file matches the availability of the contents of haikuports.crossif [ $# -ne 1 ]; thenecho "usage: $0 <haikuports.cross>"exit 1fiif [ ! -d "$1" ]; thenecho "Error: Unable to read haikuports directory '$1'!"exit 1fiHAIKUPORTS="$1"REPOFILES="build/jam/repositories/HaikuPortsCross"if [[ ! -d $REPOFILES ]]; thenecho "Unable to locate ${REPOFILES}! Run me from the haiku source root!"exit 2fiRESULT=0for f in $(find $REPOFILES -maxdepth 1 -type f -print); doARCHITECTURE=$(cat $f | tr '\n' ' ' | awk '{ print $4 } ')echo "================ Scanning $ARCHITECTURE / $f"REPO_EXPECT=$(cat $f | grep -v "#" | grep '-' | grep 'bootstrap' | grep -v 'bootstrap_')for i in $REPO_EXPECT; doPACKAGE=$(echo $i | cut -d'-' -f1)if [[ $PACKAGE == *_devel* ]]; thencontinuefiRECIPE_NAME=$(echo $i | sed 's/\-[0-9]$//g')RECIPE=$(find $HAIKUPORTS -name ${RECIPE_NAME}.recipe)if [[ "$RECIPE" == "" ]]; thenecho " $ARCHITECTURE $i... ERROR (Missing recipe $RECIPE_NAME!)"RESULT=1continuefiREV=$(echo $i | cut -d'-' -f3)grep "REVISION=\"$REV\"" $RECIPE > /dev/nullif [[ $? -eq 0 ]]; thenecho " $ARCHITECTURE $i... OK"elseFOUND_REV=$(grep "REVISION=" $RECIPE | cut -d'=' -f2)echo " $ARCHITECTURE $i... ERROR (Incorrect revision! Found $FOUND_REV!)"RESULT=1fi#echo $i - $PACKAGEdonedoneexit $RESULT