# Watch control file for uscan and hence bzr merge-upstream.
# See uscan(1) for the file format.


# Compulsory line, this is a version 4 file.
version=4


# GitHub host.
# ============

# Prior to October 2022.
# Gitub releases produce source tarballs with just the release as filename, eg
# v1.0.1.tar.gz. So, apart from finding the tarball, this watch line also
# renames the downloaded tarball to package-version.tar.gz.

# The below now no longer works as GitHub have changed their web UI releases
# page. Changing to use the tags page would work but given the release page
# breakage, it could happen to the tags page. See the solution below.
#opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)@ARCHIVE_EXT@%@PACKAGE@-$1.tar.gz%" \
#https://github.com/m-grant-prg/@PACKAGE@/releases \
#(?:.*?/)?v?(\d[\d.]*)@ARCHIVE_EXT@ debian

# Possible situation.
# So using the GitHub API is a possibility. However, no working watch file
# configuration was found to be perfect. The following came closest but screwed
# up uversion to look like 1.7.0.1.7.0 which gave the orig tarball a bad name.
# Using --no-symlink and relying on brz builddeb to generate an orig file worked
# but is clumsy. So this solution will not be used.
#opts="searchmode=plain, \
#	pgpmode=none, \
#	dversionmangle=auto" \
#https://api.github.com/repos/m-grant-prg/@PACKAGE@/releases \
#https://github.com/m-grant-prg/@PACKAGE@/releases/download/v@ANY_VERSION@/@PACKAGE@-@ANY_VERSION@@ARCHIVE_EXT@ \
#debian

# Current situation. October 2022 onwards.
# Use mode=git to get a copy of the tag. The tarball has the correct root
# directory name and the orig is named properly and is a symlink.
# Need to filenamemangle the upstream name otherwise -rc tags will still be
# offered as greater than 1.1.1 releases.
opts="searchmode=plain, \
	pgpmode=none, \
	mode=git, \
	compression=gzip, \
	dversionmangle=auto, \
	uversionmangle=s/\-rc/\~rc/, \
	filenamemangle=s/\-rc/\~rc/" \
https://github.com/m-grant-prg/@PACKAGE@ refs/tags/v@ANY_VERSION@ debian


# Hermes host.
# ============

# The regex below allows for tarball name formats of package-1.0.1.tar.gz,
# package-1.0.1-rc1, package-1.0.1+rc1.tar.gz, package-1.0.1~rc1 and
# package-1.0.1-4-g6650f8e.tar.gz.
opts="dversionmangle=auto, \
	uversionmangle=s/\-rc/\~rc/, \
	filenamemangle=s/\-rc/\~rc/" \
	http://hermes.mgent.home/tarballrepos/source/ \
		@PACKAGE@-(\d[\d.]*[\w~]*[\w-]*[\w+]*)@ARCHIVE_EXT@ debian

