
base_url="https://download.suse.de/ibs/SUSE/Products/SL-Micro/6.0"

for arch in x86_64 aarch64 s390x; do
 updateinfo=`curl -L -s -o - $base_url/$arch/product/repodata/repomd.xml | sed -n 's,.* href="repodata/\(.*-updateinfo.xml.zst\)".*,\1,p'`
 curl -L -s -o - $base_url/$arch/product/repodata/$updateinfo | zstdcat - > $arch.updateinfo.xml
done

version=`sed -n 's,.*issued date="\([^"]*\)".*,\1,p' x86_64.updateinfo.xml  | sort | tail -n 1`

sed -i "s,^%define snapshot_version.*,%define snapshot_version $version," *.spec

