version=4

# Track upstream pi releases (GitHub: earendil-works/pi).
#
# The version list is read from the tags page. The download URL is then
# rewritten (downloadurlmangle) to the versioned *source* archive attached to
# the matching GitHub release:
#   .../releases/download/v<version>/pi-<version>-source.tar.gz
# That archive contains the generated provider model data, so builds can use
# the release snapshot instead of regenerating mutable model catalogs.
#
# In downloadurlmangle the version is captured with (…) and re-inserted with
# $1 (Perl s/// semantics); the @ANY_VERSION@/@VERSION@ shorthand is only valid
# in the watch pattern and filenamemangle, NOT inside downloadurlmangle.
#
# uscan downloads the release source archive and mk-origtargz places it beside
# the source tree as ../pi-dev_<version>.orig.tar.*.

opts="\
filenamemangle=s%.*/archive/refs/tags/v?(\d+\.\d+\.\d+)\.tar\.gz%pi-dev-$1.tar.gz%,\
downloadurlmangle=s%^.*/archive/refs/tags/v?(\d+\.\d+\.\d+)\.tar\.gz$%https://github.com/earendil-works/pi/releases/download/v$1/pi-$1-source.tar.gz%\
" \
  https://github.com/earendil-works/pi/tags \
  .*/archive/refs/tags/v?(\d+\.\d+\.\d+)\.tar\.gz
