haiku/3rdparty/kallisti5/validateBootstrapRepo
Alexander von Gluck IV a165c670fd 3rdparty: Fix revision check
* Add a few nice to haves

Change-Id: I53e1fd7d067357af5ad625ebf86de3ee68903cbe
2023-06-22 10:02:29 -05:00

52 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Check if a Bootstrap Jam repository file matches the availability of the contents of haikuports.cross
if [ $# -ne 1 ]; then
echo "usage: $0 <haikuports.cross>"
exit 1
fi
if [ ! -d "$1" ]; then
echo "Error: Unable to read haikuports directory '$1'!"
exit 1
fi
HAIKUPORTS="$1"
REPOFILES="build/jam/repositories/HaikuPortsCross"
if [[ ! -d $REPOFILES ]]; then
echo "Unable to locate ${REPOFILES}! Run me from the haiku source root!"
exit 2
fi
RESULT=0
for f in $(find $REPOFILES -maxdepth 1 -type f -print); do
ARCHITECTURE=$(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; do
PACKAGE=$(echo $i | cut -d'-' -f1)
if [[ $PACKAGE == *_devel* ]]; then
continue
fi
RECIPE_NAME=$(echo $i | sed 's/\-[0-9]$//g')
RECIPE=$(find $HAIKUPORTS -name ${RECIPE_NAME}.recipe)
if [[ "$RECIPE" == "" ]]; then
echo " $ARCHITECTURE $i... ERROR (Missing recipe $RECIPE_NAME!)"
RESULT=1
continue
fi
REV=$(echo $i | cut -d'-' -f3)
grep "REVISION=\"$REV\"" $RECIPE > /dev/null
if [[ $? -eq 0 ]]; then
echo " $ARCHITECTURE $i... OK"
else
FOUND_REV=$(grep "REVISION=" $RECIPE | cut -d'=' -f2)
echo " $ARCHITECTURE $i... ERROR (Incorrect revision! Found $FOUND_REV!)"
RESULT=1
fi
#echo $i - $PACKAGE
done
done
exit $RESULT