2024-10-27 17:13:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# expects the following env variables:
|
|
|
|
# downstream: downstream repo
|
|
|
|
|
|
|
|
repo=${downstream/*\/}
|
|
|
|
|
|
|
|
curl --silent $downstream/x86_64/APKINDEX.tar.gz | tar -O -zx APKINDEX > APKINDEX
|
|
|
|
|
2024-12-01 17:41:32 +00:00
|
|
|
if [ "$ALL_PACKAGES" == "true" ]; then
|
|
|
|
owned_by_you=$(awk -F ':' '{if($1=="o"){print $2}}' APKINDEX | sort | uniq)
|
|
|
|
echo "Found $(printf '%s\n' $owned_by_you | wc -l ) packages"
|
|
|
|
else
|
|
|
|
owned_by_you=$(awk -v RS= -v ORS="\n\n" '/m:Antoine Martin \(ayakael\) <dev@ayakael.net>/' APKINDEX | awk -F ':' '{if($1=="o"){print $2}}' | sort | uniq)
|
|
|
|
echo "Found $(printf '%s\n' $owned_by_you | wc -l ) packages owned by you"
|
|
|
|
fi
|
2024-10-27 17:13:08 +00:00
|
|
|
|
|
|
|
rm -f out_of_date not_in_anitya
|
|
|
|
|
|
|
|
for pkg in $owned_by_you; do
|
|
|
|
upstream_version=$(curl --fail -X GET -sS -H 'Content-Type: application/json' "https://release-monitoring.org/api/v2/packages/?name=$pkg&distribution=Alpine" | jq -r '.items.[].stable_version')
|
2024-10-29 12:56:16 +00:00
|
|
|
downstream_version=$(sed -n "/^P:$pkg$/,/^$/p" APKINDEX | awk -F ':' '{if($1=="V"){print $2}}' | sort -V | tail -n 1)
|
2024-10-27 17:13:08 +00:00
|
|
|
downstream_version=${downstream_version/-*}
|
|
|
|
|
2024-12-13 15:26:58 +00:00
|
|
|
# special cases
|
|
|
|
case $pkg in
|
|
|
|
freetube) upstream_version=$(curl --fail -X GET -sS -H 'Content-Type: application/json' "https://release-monitoring.org/api/v2/packages/?name=$pkg&distribution=Alpine" | jq -r '.items.[].version' | sed "s|-beta||");;
|
2024-12-13 15:29:04 +00:00
|
|
|
dotnet9-sdk|dotnet9-stage0) upstream_version=${upstream_version/-*};;
|
2024-12-13 15:26:58 +00:00
|
|
|
esac
|
2024-12-13 15:19:17 +00:00
|
|
|
|
2024-10-27 17:13:08 +00:00
|
|
|
if [ -z "$upstream_version" ]; then
|
|
|
|
echo "$pkg not in anitya"
|
|
|
|
echo "$pkg" >> not_in_anitya
|
|
|
|
elif [ "$downstream_version" != "$(printf '%s\n' $upstream_version $downstream_version | sort -V | head -n 1)" ]; then
|
|
|
|
echo "$pkg higher downstream"
|
|
|
|
continue
|
|
|
|
elif [ "$upstream_version" != "$downstream_version" ]; then
|
|
|
|
echo "$pkg upstream version $upstream_version does not match downstream version $downstream_version"
|
|
|
|
echo "$pkg $downstream_version $upstream_version $repo" >> out_of_date
|
|
|
|
fi
|
|
|
|
done
|