Initial pkg version checker
This commit is contained in:
parent
18b17a1e23
commit
7bf927c2c3
3 changed files with 223 additions and 0 deletions
34
.forgejo/bin/check_ver.sh
Executable file
34
.forgejo/bin/check_ver.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# expects the following env variables:
|
||||
# downstream: downstream repo
|
||||
|
||||
repo=${downstream/*\/}
|
||||
|
||||
curl --silent $downstream/binary-amd64/Packages > Packages
|
||||
|
||||
owned_by_you=$(awk -F ': ' '{if($1=="Package"){print $2}}' Packages | sort | uniq)
|
||||
|
||||
echo "Found $(printf '%s\n' $owned_by_you | wc -l ) packages"
|
||||
|
||||
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=Debian" | jq -r '.items.[].stable_version')
|
||||
downstream_version=$(sed -n "/^Package: $pkg$/,/^$/p" Packages| awk -F ': ' '{if($1=="Version"){print $2 }}' | sort -V | tail -n 1)
|
||||
downstream_version=${downstream_version/-*}
|
||||
|
||||
echo $upstream_version
|
||||
echo $downstream_version
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue