.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "DEBIAN-WATCH-4 5"
.TH DEBIAN-WATCH-4 5 2026-03-09 "Debian Utilities" " "
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
debian/watch \- Format specification for version 4
.SH DESCRIPTION
.IX Header "DESCRIPTION"
This document describes the version 4 format of \fIdebian/watch\fR.
.SH "FORMAT OF THE WATCH FILE, VERSION 4"
.IX Header "FORMAT OF THE WATCH FILE, VERSION 4"
The version 4 format of \fIdebian/watch\fR can be summarized as follows:
.IP \(bu 4
Leading spaces and tabs are dropped.
.IP \(bu 4
Empty lines are dropped.
.IP \(bu 4
A line started by \fB#\fR (hash) is a comment line and dropped.
.IP \(bu 4
A single \fB\e\fR (back slash) at the end of a line is dropped and the
next line is concatenated after removing leading spaces and tabs. The
concatenated line is parsed as a single line. (The existence or non-existence
of the space before the tailing single \fB\e\fR is significant.)
.IP \(bu 4
The first non-comment line is:
.RS 4
.IP \fBversion=4\fR 4
.IX Item "version=4"
.RE
.RS 4
.Sp
This is a required line and the recommended version number.
.Sp
If you use "\fBversion=3\fR" instead here, some features may not work as
documented here.  See "HISTORY AND UPGRADING" in \fBuscan\fR\|(1).
.RE
.IP \(bu 4
The following non-comment lines (watch lines) specify the rules for the
selection of the candidate upstream tarball URLs and are in one of the
following three formats:
.RS 4
.IP \(bu 4
\&\fBopts="\fR \fI...\fR \fB"\fR \fBhttp://\fR\fIURL\fR \fImatching-pattern\fR [\fIversion\fR [\fIscript\fR]]
.IP \(bu 4
\&\fBhttp://\fR\fIURL\fR \fImatching-pattern\fR [\fIversion\fR [\fIscript\fR]]
.IP \(bu 4
\&\fBopts="\fR \fI...\fR \fB"\fR
.RE
.RS 4
.Sp
Here,
.IP \(bu 4
\&\fBopts="\fR \fI...\fR \fB"\fR specifies the behavior of \fBuscan\fR.  See
"WATCH FILE OPTIONS" in \fBuscan\fR\|(1).
.IP \(bu 4
\&\fBhttp://\fR\fIURL\fR specifies the web page where upstream publishes
the link to the latest source archive.
.RS 4
.IP \(bu 4
\&\fBhttps://\fR\fIURL\fR may also be used, as may
.IP \(bu 4
\&\fBftp://\fR\fIURL\fR
.IP \(bu 4
Some parts of \fIURL\fR may be in the regex match pattern surrounded
between \fB(\fR and \fB)\fR such as \fB/foo/bar\-([\e.\ed]+)/\fR.  (If multiple
directories match, the highest version is picked.) Otherwise, the \fIURL\fR
is taken as verbatim.
.RE
.RS 4
.RE
.IP \(bu 4
\&\fImatching-pattern\fR specifies the full string matching pattern for
hrefs in the web page.  See "WATCH FILE EXAMPLES" in \fBuscan\fR\|(1).
.RS 4
.IP \(bu 4
All matching parts in \fB(\fR and \fB)\fR are concatenated with \fB.\fR (period)
to form the upstream version.
.IP \(bu 4
If the hrefs do not contain directories, you can combine this with the
previous entry. I.e., \fBhttp://\fR\fIURL\fR\fB/\fR\fImatching-pattern\fR .
.RE
.RS 4
.RE
.IP \(bu 4
\&\fIversion\fR restricts the upstream tarball which may be downloaded.
The newest available version is chosen in each case.
.RS 4
.IP \(bu 4
\&\fBdebian\fR \fI(default)\fR requires the downloading upstream tarball to be
newer than the version obtained from \fIdebian/changelog\fR.
.IP \(bu 4
\&\fIversion-number\fR such as \fB12.5\fR requires the upstream
tarball to be newer than the \fIversion-number\fR.
.IP \(bu 4
\&\fBsame\fR requires the downloaded version of the secondary tarballs to be
exactly the same as the one for the first upstream tarball downloaded. (Useful
only for MUT)
.IP \(bu 4
\&\fBprevious\fR restricts the version of the signature
file. (Used with pgpmode=previous)
.IP \(bu 4
\&\fBignore\fR does not restrict the version of the secondary
tarballs. (Maybe useful for MUT)
.IP \(bu 4
\&\fBgroup\fR requires the downloading upstream tarball to be newer than
the version obtained from \fIdebian/changelog\fR. Package version is the
concatenation of all "group" upstream version.
.IP \(bu 4
\&\fBchecksum\fR requires the downloading upstream tarball to be newer than
the version obtained from \fIdebian/changelog\fR. Package version is the
concatenation of the version of the main tarball, followed by a checksum of all
the tarballs using the "checksum" version system.
At least the main upstream source has to be declared as "group".
.RE
.RS 4
.RE
.IP \(bu 4
If set, \fIscript\fR is executed at the end of \fBuscan\fR execution
with appropriate arguments provided by \fBuscan\fR \fI(default: no action)\fR.
See "Custom script" in uscan for more details on these scripts and
"HISTORY AND UPGRADING" in uscan for how \fBuscan\fR invokes the custom
\&\fIscript\fR (or uupdate).
.RS 4
.IP \(bu 4
The typical Debian package is a non-native package made from one
upstream tarball.  Only a single line of the watch line in one of the first two
formats is usually used with its \fIversion\fR set to \fBdebian\fR and \fIscript\fR
set to \fBuupdate\fR.
.IP \(bu 4
A native package should not specify \fIscript\fR.
.IP \(bu 4
A multiple upstream tarball (MUT) package should specify \fBuupdate\fR
as \fIscript\fR in the last watch line and should skip specifying \fIscript\fR in the
rest of the watch lines.
.RE
.RS 4
.RE
.IP \(bu 4
The last format of the watch line is useful to set the persistent
parameters: \fBuser-agent\fR, \fBcompression\fR.  If this format is used, this must
be followed by the \fIURL\fR defining watch line(s).
.IP \(bu 4
[ and ] in the above format are there to mark the optional parts and
should not be typed.
.RE
.RS 4
.RE
.PP
There are a few special strings which are substituted by \fBuscan\fR to make it easy
to write the watch file.
.ie n .IP \fR\fB@PACKAGE\fR\fB@\fR 4
.el .IP \fR\f(CB@PACKAGE\fR\fB@\fR 4
.IX Item "@PACKAGE@"
This is substituted with the source package name found in the first line of the
\&\fIdebian/changelog\fR file.
.ie n .IP \fR\fB@ANY_VERSION\fR\fB@\fR 4
.el .IP \fR\f(CB@ANY_VERSION\fR\fB@\fR 4
.IX Item "@ANY_VERSION@"
This is substituted by the legal upstream version regex (capturing).
.Sp
.Vb 1
\&  [\-_]?[Vv]?(\ed[\e\-+\e.:\e~\eda\-zA\-Z]*)
.Ve
.ie n .IP \fR\fB@ARCHIVE_EXT\fR\fB@\fR 4
.el .IP \fR\f(CB@ARCHIVE_EXT\fR\fB@\fR 4
.IX Item "@ARCHIVE_EXT@"
This is substituted by the typical archive file extension regex (non-capturing).
.Sp
.Vb 1
\&  (?i)(?:\e.(?:tar\e.xz|tar\e.bz2|tar\e.gz|tar\e.zstd?|zip|tgz|tbz|txz))
.Ve
.ie n .IP \fR\fB@SIGNATURE_EXT\fR\fB@\fR 4
.el .IP \fR\f(CB@SIGNATURE_EXT\fR\fB@\fR 4
.IX Item "@SIGNATURE_EXT@"
This is substituted by the typical signature file extension regex (non-capturing).
.Sp
.Vb 1
\&  (?i)(?:\e.(?:tar\e.xz|tar\e.bz2|tar\e.gz|tar\e.zstd?|zip|tgz|tbz|txz))(?:\e.(?:asc|pgp|gpg|sig|sign))
.Ve
.ie n .IP \fR\fB@DEB_EXT\fR\fB@\fR 4
.el .IP \fR\f(CB@DEB_EXT\fR\fB@\fR 4
.IX Item "@DEB_EXT@"
This is substituted by the typical Debian extension regexp (capturing).
.Sp
.Vb 1
\&  [\e+~](debian|dfsg|ds|deb)(\e.)?(\ed+)?$
.Ve
.PP
Some file extensions are not included in the above intentionally to avoid false
positives.  You can still set such file extension patterns manually.
.SH "WATCH FILE OPTIONS"
.IX Header "WATCH FILE OPTIONS"
\&\fBuscan\fR reads the watch options specified in \fBopts="\fR \fI...\fR \fB"\fR to
customize its behavior. Multiple options \fIoption1\fR, \fIoption2\fR, \fIoption3\fR,
\&... can be set as \fBopts="\fR\fIoption1\fR\fB,\fR \fIoption2\fR\fB,\fR \fIoption3\fR\fB,\fR \fI ...
\&\fR\fB"\fR .  The double quotes are necessary if options contain any spaces.
.PP
Unless otherwise noted as persistent, most options are valid only within their
containing watch line.
.PP
The available watch options are:
.IP \fBcomponent=\fR\fIcomponent\fR 4
.IX Item "component=component"
Set the name of the secondary source tarball as \fI<spkg>_<oversion>.orig\-<component>.tar.gz\fR for a MUT package.
.IP \fBctype=\fR\fIcomponent-type\fR 4
.IX Item "ctype=component-type"
Set the type of component \fI(only "nodejs" and "perl" are available for now)\fR.
This will help uscan to find current version if component version is ignored.
.Sp
When using \fBctype=nodejs\fR, uscan tries to find a version in \f(CW\*(C`package.json\*(C'\fR,
when using \fBctype=perl\fR, uscan tries to find a version in \f(CW\*(C`META.json\*(C'\fR.
If a version is found, it is used as current version for this component,
regardless version found in Debian version string. This permits a better
change detection when using \fIignore\fR or \fIchecksum\fR as Debian version.
.IP \fBcompression=\fR\fImethod\fR 4
.IX Item "compression=method"
Set the compression \fImethod\fR when the tarball is repacked (persistent).
.Sp
Available \fImethod\fR values are what mk-origtargz supports, so \fBxz\fR, \fBgzip\fR
(alias \fBgz\fR), \fBbzip2\fR (alias \fBbz2\fR), \fBlzma\fR, \fBdefault\fR. The default method
is currently \fBxz\fR.
When uscan is launched in a debian source repository which format is "1.0" or
undefined, the method switches to \fBgzip\fR.
.Sp
Please note the repacking of the upstream tarballs by \fBmk-origtargz\fR happens
only if one of the following conditions is satisfied:
.RS 4
.IP \(bu 4
\&\fBUSCAN_REPACK\fR is set in the devscripts configuration.  See
"DEVSCRIPTS CONFIGURATION VARIABLES" in \fBuscan\fR\|(1).
.IP \(bu 4
\&\fB\-\-repack\fR is set on the commandline.  See "COMMANDLINE OPTIONS" in \fBuscan\fR\|(1).
.IP \(bu 4
\&\fBrepack\fR is set in the watch line as \fBopts="repack,\fR\fI...\fR\fB"\fR.
.IP \(bu 4
The upstream archive is of \fBzip\fR type including \fBjar\fR, \fBxpi\fR, ...
.IP \(bu 4
The upstream archive is of \fBzstd\fR (Zstandard) type.
.IP \(bu 4
\&\fBFiles-Excluded\fR or \fBFiles\-Excluded\-\fR\fIcomponent\fR stanzas are set in
\&\fIdebian/copyright\fR to make \fBmk-origtargz\fR invoked from \fBuscan\fR remove
files from the upstream tarball and repack it.  See
"COPYRIGHT FILE EXAMPLES" in \fBuscan\fR\|(1) and \fBmk\-origtargz\fR\|(1).
.RE
.RS 4
.RE
.IP \fBrepack\fR 4
.IX Item "repack"
Force repacking of the upstream tarball using the compression \fImethod\fR.
.IP \fBrepacksuffix=\fR\fIsuffix\fR 4
.IX Item "repacksuffix=suffix"
Add \fIsuffix\fR to the Debian package upstream version only when the
source tarball is repackaged.  This rule should be used only for a single
upstream tarball package.
.IP \fBmode=\fR\fImode\fR 4
.IX Item "mode=mode"
Set the archive download \fImode\fR.
.RS 4
.IP \fBLWP\fR 4
.IX Item "LWP"
This mode is the default one which downloads the specified tarball from the
archive URL on the web.  Automatically internal \fBmode\fR value is updated to
either \fBhttp\fR or \fBftp\fR by URL.
.IP \fBgit\fR 4
.IX Item "git"
This mode accesses the upstream git archive directly with the \fBgit\fR command
and packs the source tree with the specified tag via \fImatching-pattern\fR into
\&\fIspkg-version\fR\fB.tar.xz\fR.
.Sp
If the upstream publishes the released tarball via its web interface, please
use it instead of using this mode. This mode is the last resort method.
.Sp
For git mode, \fImatching-pattern\fR specifies the full string matching pattern for
tags instead of hrefs. If \fImatching-pattern\fR is set to
\&\fBrefs/tags/\fR\fItag-matching-pattern\fR, \fBuscan\fR downloads source from the
\&\fBrefs/tags/\fR\fImatched-tag\fR of the git repository.  The upstream version is
extracted from concatenating the matched parts in \fB(\fR ... \fB)\fR with \fB.\fR .  See
"WATCH FILE EXAMPLES".
.Sp
If \fImatching-pattern\fR is set to \fBHEAD\fR, \fBuscan\fR downloads source from the
\&\fBHEAD\fR of the git repository and the pertinent \fIversion\fR is automatically
generated with the date and hash of the \fBHEAD\fR of the git repository.
.Sp
If \fImatching-pattern\fR is set to \fBheads/\fR\fIbranch\fR, \fBuscan\fR downloads source
from the named \fIbranch\fR of the git repository.
.Sp
The local repository is created temporarily as either a bare git repository or
a cloned git repository if \fBgitmodules\fR is specified. The tarball is then
generated from the temporary git repository and saved in the destination
directory.
.Sp
The temporary repository is normally erased after
\&\fBuscan\fR execution but is kept if the \fB\-\-debug\fR option is specified.
.Sp
If the current directory is a git repository and the searched repository is
listed among the registered "remotes", then uscan will use it instead of cloning
separately.  The only local change is that uscan will run a "fetch" command to
refresh the repository.
.IP \fBsvn\fR 4
.IX Item "svn"
This mode accesses the upstream Subversion archive directly with the \fBsvn\fR
command and packs the source tree.
.Sp
For svn mode, \fImatching-pattern\fR specifies the full string matching pattern for
directories under Subversion repository directory, specified via URL.  The
upstream version is extracted from concatenating the matched parts in \fB(\fR ...
\&\fB)\fR with \fB.\fR .
.Sp
If \fImatching-pattern\fR is set to \fBHEAD\fR, \fBuscan\fR downloads the latest source
tree of the URL.  The upstream version is then constructed by appending the last
revision of the URL to \fB0.0~svn\fR.
.Sp
As commit signing is not possible with Subversion, the default \fBpgpmode\fR is set
to \fBnone\fR when \fBmode=svn\fR. Settings of \fBpgpmode\fR other than \fBdefault\fR and
\&\fBnone\fR are reported as errors.
.RE
.RS 4
.RE
.IP \fBpretty=\fR\fIrule\fR 4
.IX Item "pretty=rule"
Set the upstream version string to an arbitrary format as an optional \fBopts\fR
argument when the \fImatching-pattern\fR is \fBHEAD\fR or \fBheads/\fR\fIbranch\fR for
\&\fBgit\fR mode. For the exact syntax, see the \fBgit-log\fR manpage under \fBtformat\fR.
The default is \fBpretty=0.0~git%cd.%h\fR. No version mangling rule is necessary
for this case.
.Sp
When \fBpretty=describe\fR is used, the upstream version string is the output of
the "\fBgit describe \-\-tags | sed s/\-/./g\fR" command instead. For example, if the
commit is the \fB5\fR\-th after the last tag \fBv2.17.12\fR and its short hash is
\&\fBged992511\fR, then the string is \fBv2.17.12.5.ged992511\fR. For this case, it is
recommended to add \fBfilenamemangle=s/^(@PACKAGE@)\-/$1\-0.0~/\fR or
\&\fBfilenamemangle=s/^(@PACKAGE@\-)v/$1/\fR to make the upstream version string
suitable for Debian. Please note that in order for \fBpretty=describe\fR to
function well, upstream needs to avoid tagging with random alphabetic tags.
.Sp
Using \fBpretty=describe\fR also sets \fBgitmode=full\fR to make a full local clone
of the repository automatically.
.IP \fBdate=\fR\fIrule\fR 4
.IX Item "date=rule"
Set the date string used by the \fBpretty\fR option to an arbitrary format as an
optional \fBopts\fR argument when the \fImatching-pattern\fR is \fBHEAD\fR or
\&\fBheads/\fR\fIbranch\fR for \fBgit\fR mode.  For the exact syntax, see the
\&\fBstrftime\fR manpage.  The default is \fBdate=%Y%m%d\fR.
.IP \fBgitexport=\fR\fImode\fR 4
.IX Item "gitexport=mode"
Set the git archive export operation \fImode\fR. The default is
\&\fBgitexport=default\fR.  Set this to \fBgitexport=all\fR to include all files in the
\&.orig.tar archive, ignoring any \fIexport-ignore\fR git attributes defined by the
upstream. This option also applies to submodules, if \fBgitmodules\fR is specified.
.Sp
This option is valid only in git mode.
.IP \fBgitmode=\fR\fImode\fR 4
.IX Item "gitmode=mode"
Set the git clone operation \fImode\fR. The default is \fBgitmode=shallow\fR.  For
some dumb git server, you may need to manually set \fBgitmode=full\fR to force full
clone operation.
.Sp
If the current directory is a git repository and the searched repository is
listed among the registered "remotes", then uscan will use it instead of cloning
separately.
.IP \fBgitmodules\fR[=\fImodules\fR] 4
.IX Item "gitmodules[=modules]"
Clone one or more submodules after cloning the main git repository. By default,
uscan will clone all submodules linked to the git repository.
.Sp
To clone selected submodules, use a semicolon-separated list. For example:
gitmodules=m4;doc/common.
.IP \fBpgpmode=\fR\fImode\fR 4
.IX Item "pgpmode=mode"
Set the OpenPGP signature verification \fImode\fR.
.RS 4
.IP \fBauto\fR 4
.IX Item "auto"
\&\fBuscan\fR checks possible URLs for the signature file and autogenerates a
\&\fBpgpsigurlmangle\fR rule to use it.
.IP \fBdefault\fR 4
.IX Item "default"
Use \fBpgpsigurlmangle=\fR\fIrules\fR to generate the candidate upstream signature
file URL string from the upstream tarball URL. (default)
.Sp
If the specified \fBpgpsigurlmangle\fR is missing, \fBuscan\fR checks possible URLs
for the signature file and suggests adding a \fBpgpsigurlmangle\fR rule.
.IP \fBmangle\fR 4
.IX Item "mangle"
Use \fBpgpsigurlmangle=\fR\fIrules\fR to generate the candidate upstream signature
file URL string from the upstream tarball URL.
.IP \fBnext\fR 4
.IX Item "next"
Verify this downloaded tarball file with the signature file specified in the
next watch line.  The next watch line must be \fBpgpmode=previous\fR.  Otherwise,
no verification occurs.
.IP \fBprevious\fR 4
.IX Item "previous"
Verify the downloaded tarball file specified in the previous watch line with
this signature file.  The previous watch line must be \fBpgpmode=next\fR.
.IP \fBself\fR 4
.IX Item "self"
Verify the downloaded file \fIfoo.ext\fR with its self signature and extract its
content tarball file as \fIfoo\fR.
.IP \fBgittag\fR 4
.IX Item "gittag"
Verify tag signature if \fBmode=git\fR.
.IP \fBnone\fR 4
.IX Item "none"
No signature available. (No warning.)
.RE
.RS 4
.RE
.IP \fBsearchmode=\fR\fImode\fR 4
.IX Item "searchmode=mode"
Set the parsing search mode.
.RS 4
.IP "\fBhtml\fR \fI(default)\fR: search pattern in ""href"" parameter of <a> HTML tags" 4
.IX Item "html (default): search pattern in ""href"" parameter of <a> HTML tags"
.PD 0
.IP "\fBplain\fR: search pattern in the full page" 4
.IX Item "plain: search pattern in the full page"
.PD
This is useful if page content is not HTML but JSON. Example with
npmjs.com:
.Sp
.Vb 4
\&  version=4
\&  opts="searchmode=plain" \e
\&   https://registry.npmjs.org/aes\-js \e
\&   https://registry.npmjs.org/aes\-js/\-/aes\-js\-(\ed[\ed\e.]*)@ARCHIVE_EXT@
.Ve
.RE
.RS 4
.RE
.IP \fBdecompress\fR 4
.IX Item "decompress"
Decompress compressed archive before the OpenPGP signature verification.
.IP \fBbare\fR 4
.IX Item "bare"
Disable all site specific special case code such as URL redirector uses and
page content alterations. (persistent)
.IP \fBuser\-agent=\fR\fIuser-agent-string\fR 4
.IX Item "user-agent=user-agent-string"
Set the user-agent string used to contact the HTTP(S) server as
\&\fIuser-agent-string\fR. (persistent)
.Sp
\&\fBuser-agent\fR option should be specified by itself in the watch line without
\&\fIURL\fR, to allow using semicolons and commas in it.
.IP \fBunzipopt=\fR\fIoptions\fR 4
.IX Item "unzipopt=options"
Add the extra options to use with the \fBunzip\fR command, such as \fB\-a\fR, \fB\-aa\fR,
and \fB\-b\fR, when executed by \fBmk-origtargz\fR.
.IP \fBdversionmangle=\fR\fIrules\fR 4
.IX Item "dversionmangle=rules"
Normalize the last upstream version string found in \fIdebian/changelog\fR to
compare it to the available upstream tarball version.  Removal of the Debian
specific suffix such as \fBs/@DEB_EXT@//\fR is usually done here.
.Sp
You can also use \fBdversionmangle=auto\fR, this is exactly the same than
\&\fBdversionmangle=s/@DEB_EXT@//\fR
.IP \fBdirversionmangle=\fR\fIrules\fR 4
.IX Item "dirversionmangle=rules"
Normalize the directory path string matching the regex in a set of parentheses
of \fBhttp://\fR\fIURL\fR as the sortable version index string.  This is used as the
directory path sorting index only.
.Sp
Substitution such as \fBs/PRE/~pre/; s/RC/~rc/\fR may help.
.IP \fBpagemangle=\fR\fIrules\fR 4
.IX Item "pagemangle=rules"
Normalize the downloaded web page string.  (Don't use this unless this is
absolutely needed.  Generally, \fBg\fR flag is required for these \fIrules\fR.)
.Sp
This is handy if you wish to access Amazon AWS or Subversion repositories in
which <a href="..."> is not used.
.IP \fBuversionmangle=\fR\fIrules\fR 4
.IX Item "uversionmangle=rules"
Normalize the candidate upstream version strings extracted from hrefs in the
source of the web page.  This is used as the version sorting index when
selecting the latest upstream version.
.Sp
Substitution such as \fBs/PRE/~pre/; s/RC/~rc/\fR may help.
.IP \fBversionmangle=\fR\fIrules\fR 4
.IX Item "versionmangle=rules"
Syntactic shorthand for \fBuversionmangle=\fR\fIrules\fR\fB, dversionmangle=\fR\fIrules\fR
.IP \fBhrefdecode=percent\-encoding\fR 4
.IX Item "hrefdecode=percent-encoding"
Convert the selected upstream tarball href string from the percent-encoded
hexadecimal string to the decoded normal URL string for obfuscated web sites.
Only \fBpercent-encoding\fR is available and it is decoded with
\&\fBs/%([A\-Fa\-f\ed]{2})/chr hex \fR\f(CB$1\fR\fB/eg\fR.
.IP \fBdownloadurlmangle=\fR\fIrules\fR 4
.IX Item "downloadurlmangle=rules"
Convert the selected upstream tarball href string into the accessible URL for
obfuscated web sites.  This is run after \fBhrefdecode\fR.
.IP \fBfilenamemangle=\fR\fIrules\fR 4
.IX Item "filenamemangle=rules"
Generate the upstream tarball filename from the selected href string if
\&\fImatching-pattern\fR can extract the latest upstream version \fI<uversion>\fR
from the selected href string.  Otherwise, generate the upstream tarball
filename from its full URL string and set the missing \fI<uversion>\fR from
the generated upstream tarball filename.
.Sp
Without this option, the default upstream tarball filename is generated by
taking the last component of the URL and removing everything after any '?' or
\&'#'.
.IP \fBpgpsigurlmangle=\fR\fIrules\fR 4
.IX Item "pgpsigurlmangle=rules"
Generate the candidate upstream signature file URL string from the upstream
tarball URL.
.IP \fBoversionmangle=\fR\fIrules\fR 4
.IX Item "oversionmangle=rules"
Generate the version string \fI<oversion>\fR of the source tarball \fI<spkg>_<oversion>.orig.tar.gz\fR from \fI<uversion>\fR.  This should be used
to add a suffix such as \fB+dfsg\fR to a MUT package.
.PP
Here, the mangling rules apply the \fIrules\fR to the pertinent string.  Multiple
rules can be specified in a mangling rule string by making a concatenated
string of each mangling \fIrule\fR separated by \fB;\fR (semicolon).
.PP
Each mangling \fIrule\fR cannot contain \fB;\fR (semicolon), \fB,\fR (comma), or \fB"\fR
(double quote).
.PP
Each mangling \fIrule\fR behaves as if a Perl command "\fR\f(CI$string\fR\fI\fR \fB=~\fR \fIrule\fR"
is executed.  There are some notable details.
.IP \(bu 4
\&\fIrule\fR may only use the \fBs\fR, \fBtr\fR, and \fBy\fR operations.
.RS 4
.IP \fBs/\fR\fIregex\fR\fB/\fR\fIreplacement\fR\fB/\fR\fIoptions\fR 4
.IX Item "s/regex/replacement/options"
Regex pattern match and replace the target string.  Only the \fBg\fR, \fBi\fR and
\&\fBx\fR flags are available.  Use the \fR\f(CB$1\fR\fB\fR syntax for back references (No
\&\fB\e1\fR syntax).  Code execution is not allowed (i.e. no \fB(?{})\fR or \fB(??{})\fR
constructs).
.IP "\fBy/\fR\fIsource\fR\fB/\fR\fIdest\fR\fB/\fR or \fBtr/\fR\fIsource\fR\fB/\fR\fIdest\fR\fB/\fR" 4
.IX Item "y/source/dest/ or tr/source/dest/"
Transliterate the characters in the target string.
.RE
.RS 4
.RE
.SH "EXAMPLE OF EXECUTION"
.IX Header "EXAMPLE OF EXECUTION"
\&\fBuscan\fR reads the first entry in \fIdebian/changelog\fR to determine the source
package name and the last upstream version.
.PP
For example, if the first entry of \fIdebian/changelog\fR is:
.IP \(bu 4
\&\fIbar\fR (\fB3:2.03+dfsg\-4\fR) unstable; urgency=low
.PP
then, the source package name is \fIbar\fR and the last Debian package version
is \fB3:2.03+dfsg\-4\fR.
.PP
The last upstream version is normalized to \fB2.03+dfsg\fR by removing the epoch
and the Debian revision.
.PP
If the \fBdversionmangle\fR rule exists, the last upstream version is further
normalized by applying this rule to it.  For example, if the last upstream
version is \fB2.03+dfsg\fR indicating the source tarball is repackaged, the
suffix \fB+dfsg\fR is removed by the string substitution \fBs/\e+dfsg\ed*$//\fR to
make the (dversionmangled) last upstream version \fB2.03\fR and it is compared to
the candidate upstream tarball versions such as \fB2.03\fR, \fB2.04\fR, ... found in
the remote site.  Thus, set this rule as:
.IP \(bu 4
\&\fBopts="dversionmangle=s/\e+dfsg\ed*$//"\fR
.PP
\&\fBuscan\fR downloads a web page from \fBhttp://\fR\fIURL\fR specified in
\&\fIdebian/watch\fR.
.IP \(bu 4
If the directory name part of \fIURL\fR has no parentheses, \fB(\fR and \fB)\fR,
it is taken as verbatim.
.IP \(bu 4
If the directory name part of \fIURL\fR has parentheses, \fB(\fR and \fB)\fR,
then \fBuscan\fR recursively searches all possible directories to find a page for
the newest version.  If the \fBdirversionmangle\fR rule exists, the generated
sorting index is used to find the newest version.  If a specific version is
specified for the download, the matching version string has priority over the
newest version.
.PP
For example, this \fBhttp://\fR\fIURL\fR may be specified as:
.IP \(bu 4
\&\fBhttp://www.example.org/@ANY_VERSION@/\fR
.PP
Please note the trailing \fB/\fR in the above to make \fR\f(CB@ANY_VERSION\fR\fB@\fR as the
directory.
.PP
If the \fBpagemangle\fR rule exists, the whole downloaded web page as a string is
normalized by applying this rule to it.  This is very powerful tool and needs
to be used with caution.  If other mangling rules can be used to address your
objective, do not use this rule.
.PP
The downloaded web page is scanned for hrefs defined in the \fB<a href="\fR
\&\fI...\fR \fB">\fR tag to locate the candidate upstream tarball hrefs.  These
candidate upstream tarball hrefs are matched by the Perl regex pattern
\&\fImatching-pattern\fR such as \fBDL\-(?:[\ed\e.]+?)/foo\-(.+)\e.tar\e.gz\fR to narrow
down the candidates.  This pattern match needs to be anchored at the beginning
and the end.  For example, candidate hrefs may be:
.IP \(bu 4
\&\fBDL\-2.02/foo\-2.02.tar.gz\fR
.IP \(bu 4
\&\fBDL\-2.03/foo\-2.03.tar.gz\fR
.IP \(bu 4
\&\fBDL\-2.04/foo\-2.04.tar.gz\fR
.PP
Here the matching string of \fB(.+)\fR in \fImatching-pattern\fR is considered as the
candidate upstream version.  If there are multiple matching strings of
capturing patterns in \fImatching-pattern\fR, they are all concatenated with \fB.\fR
(period) to form the candidate upstream version.  Make sure to use the
non-capturing regex such as \fB(?:[\ed\e.]+?)\fR instead for the variable text
matching part unrelated to the version.
.PP
Then, the candidate upstream versions are:
.IP \(bu 4
\&\fB2.02\fR
.IP \(bu 4
\&\fB2.03\fR
.IP \(bu 4
\&\fB2.04\fR
.PP
The downloaded tarball filename is basically set to the same as the filename in
the remote URL of the selected href.
.PP
If the \fBuversionmangle\fR rule exists, the candidate upstream versions are
normalized by applying this rule to them. (This rule may be useful if the
upstream version scheme doesn't sort correctly to identify the newest version.)
.PP
The upstream tarball href corresponding to the newest (uversionmangled)
candidate upstream version newer than the (dversionmangled) last upstream
version is selected.
.PP
If multiple upstream tarball hrefs corresponding to a single version with
different extensions exist, the highest compression one is chosen. (Priority:
\&\fBtar.xz > tar.lzma > tar.bz2 > tar.gz\fR.)
.PP
If the selected upstream tarball href is the relative URL, it is converted to
the absolute URL using the base URL of the web page.  If the \fB<base href="\fR \fI ... \fR \fB">\fR tag exists in the web page, the selected upstream tarball
href is converted to the absolute URL using the specified base URL in the base
tag, instead.
.PP
If the \fBdownloadurlmangle\fR rule exists, the selected upstream tarball href is
normalized by applying this rule to it. (This is useful for some sites with the
obfuscated download URL.)
.PP
If the \fBfilenamemangle\fR rule exists, the downloaded tarball filename is
generated by applying this rule to the selected href if \fImatching-pattern\fR can
extract the latest upstream version \fI<uversion>\fR from the selected href
string. Otherwise, generate the upstream tarball filename from its full URL
string and set the missing \fI<uversion>\fR from the generated upstream
tarball filename.
.PP
Without the \fBfilenamemangle\fR rule, the default upstream tarball filename is
generated by taking the last component of the URL and removing everything after
any '?' or '#'.
.PP
\&\fBuscan\fR downloads the selected upstream tarball to the parent \fB../\fR
directory.  For example, the downloaded file may be:
.IP \(bu 4
\&\fI../foo\-2.04.tar.gz\fR
.PP
Let's call this downloaded version \fB2.04\fR in the above example generically as
\&\fI<uversion>\fR in the following.
.PP
If the \fBpgpsigurlmangle\fR rule exists, the upstream signature file URL is
generated by applying this rule to the (downloadurlmangled) selected upstream
tarball href and the signature file is tried to be downloaded from it.
.PP
If the \fBpgpsigurlmangle\fR rule doesn't exist, \fBuscan\fR warns user if the
matching upstream signature file is available from the same URL with their
filename being suffixed by the 5 common suffix \fBasc\fR, \fBsig\fR, \fBsign\fR,
\&\fBpgp\fR and \fBgpg\fR. (You can avoid this warning by setting \fBpgpmode=none\fR.)
.PP
If the signature file is downloaded, the downloaded upstream tarball is checked
for its authenticity against the downloaded signature file using the armored keyring
\&\fIdebian/upstream/signing\-key.asc\fR  (see "KEYRING FILE EXAMPLES" in \fBuscan\fR\|(1)).  If its
signature is not valid, or not made by one of the listed keys, \fBuscan\fR will
report an error.
.PP
If the \fBoversionmangle\fR rule exists, the source tarball version \fIoversion\fR is
generated from the downloaded upstream version \fIuversion\fR by applying this
rule. This rule is useful to add suffix such as \fB+dfsg\fR to the version of all
the source packages of the MUT package for which the repacksuffix mechanism
doesn't work.
.PP
\&\fBuscan\fR invokes \fBmk-origtargz\fR to create the source tarball properly named
for the source package with \fB.orig.\fR (or \fB.orig\-<component>.\fR for the
secondary tarballs) in its filename.
.IP "case A: packaging of the upstream tarball as is" 4
.IX Item "case A: packaging of the upstream tarball as is"
\&\fBmk-origtargz\fR creates a symlink \fI../bar_<oversion>.orig.tar.gz\fR
linked to the downloaded local upstream tarball. Here, \fIbar\fR is the source
package name found in \fIdebian/changelog\fR. The generated symlink may be:
.RS 4
.IP \(bu 4
\&\fI../bar_2.04.orig.tar.gz\fR \-> \fIfoo\-2.04.tar.gz\fR (as is)
.RE
.RS 4
.Sp
Usually, there is no need to set up \fBopts="dversionmangle=\fR \fI...\fR \fB"\fR for
this case.
.RE
.IP "case B: packaging of the upstream tarball after removing non-DFSG files" 4
.IX Item "case B: packaging of the upstream tarball after removing non-DFSG files"
\&\fBmk-origtargz\fR checks the filename glob of the \fBFiles-Excluded\fR stanza in the
first section of \fIdebian/copyright\fR, removes matching files to create a
repacked upstream tarball.  Normally, the repacked upstream tarball is renamed
with \fIsuffix\fR to \fI../bar_<oversion><suffix>.orig.tar.gz\fR using
the \fBrepacksuffix\fR option for the single upstream package.    Here \fI<oversion>\fR
is updated to be \fI<oversion><suffix>\fR.
.Sp
The removal of files is required if files are not DFSG-compliant.  For such
case, \fB+dfsg\fR is used as \fIsuffix\fR.
.Sp
So the combined options are set as
\&\fBopts="dversionmangle=s/\e+dfsg\ed*$// ,repacksuffix=+dfsg"\fR, instead.
.Sp
For example, the repacked upstream tarball may be:
.RS 4
.IP \(bu 4
\&\fI../bar_2.04+dfsg.orig.tar.gz\fR (repackaged)
.RE
.RS 4
.RE
.PP
\&\fBuscan\fR normally invokes "\fBuupdate\fR \fB\-\-find \-\-upstream\-version\fR \fIoversion\fR
" for the version=4 watch file.
.PP
Please note that \fB\-\-find\fR option is used here since \fBmk-origtargz\fR has been
invoked to make \fB*.orig.tar.gz\fR file already.  \fBuscan\fR picks \fIbar\fR from
\&\fIdebian/changelog\fR.
.PP
It creates the new upstream source tree under the \fI../bar\-<oversion>\fR
directory and Debianize it leveraging the last package contents.
.SH "WATCH FILE EXAMPLES"
.IX Header "WATCH FILE EXAMPLES"
When writing the watch file, you should rely on the latest upstream source
announcement web page.  You should not try to second guess the upstream archive
structure if possible.  Here are the typical \fIdebian/watch\fR files.
.PP
Please note that executing \fBuscan\fR with \fB\-v\fR or \fB\-vv\fR reveals what exactly
happens internally.
.PP
The existence and non-existence of a space the before tailing \fB\e\fR (back slash)
are significant.
.PP
Some undocumented shorter configuration strings are used in the below EXAMPLES
to help you with typing.  These are intentional ones.  \fBuscan\fR is written to
accept such common sense abbreviations but don't push the limit.
.SS "HTTP site (basic)"
.IX Subsection "HTTP site (basic)"
Here is an example for the basic single upstream tarball.
.PP
.Vb 3
\&  version=4
\&  http://example.com/~user/release/@PACKAGE@.html \e
\&      files/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Or without using the substitution strings (not recommended):
  http://example.com/~user/release/foo.html \e
      files/foo\-([\ed\e.]+)\e.tar\e.gz
.PP
.Vb 1
\&  version=4
.Ve
.PP
For the upstream source package \fBfoo\-2.0.tar.gz\fR, this watch file downloads
and creates the Debian \fBorig.tar\fR file \fBfoo_2.0.orig.tar.gz\fR.
.SS "HTTP site (pgpsigurlmangle)"
.IX Subsection "HTTP site (pgpsigurlmangle)"
Here is an example for the basic single upstream tarball with the matching
signature file in the same file path.
.PP
.Vb 3
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.asc%" http://example.com/release/@PACKAGE@.html \e
\&      files/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
For the upstream source package \fBfoo\-2.0.tar.gz\fR and the upstream signature
file \fBfoo\-2.0.tar.gz.asc\fR, this watch file downloads these files, verifies the
authenticity using the keyring \fIdebian/upstream/signing\-key.asc\fR and creates the
Debian \fBorig.tar\fR file \fBfoo_2.0.orig.tar.gz\fR.
.PP
Here is another example for the basic single upstream tarball with the matching
signature file on decompressed tarball in the same file path.
.PP
.Vb 4
\&  version=4
\&  opts="pgpsigurlmangle=s%@ARCHIVE_EXT@$%.asc%,decompress" \e
\&      http://example.com/release/@PACKAGE@.html \e
\&      files/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
For the upstream source package \fBfoo\-2.0.tar.gz\fR and the upstream signature
file \fBfoo\-2.0.tar.asc\fR, this watch file downloads these files, verifies the
authenticity using the keyring \fIdebian/upstream/signing\-key.asc\fR and creates the
Debian \fBorig.tar\fR file \fBfoo_2.0.orig.tar.gz\fR.
.SS "HTTP site (pgpmode=next/previous)"
.IX Subsection "HTTP site (pgpmode=next/previous)"
Here is an example for the basic single upstream tarball with the matching
signature file in the unrelated file path.
.PP
.Vb 5
\&  version=4
\&  opts="pgpmode=next" http://example.com/release/@PACKAGE@.html \e
\&      files/(?:\ed+)/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@ debian
\&  opts="pgpmode=previous" http://example.com/release/@PACKAGE@.html \e
\&      files/(?:\ed+)/@PACKAGE@@ANY_VERSION@@SIGNATURE_EXT@ previous
.Ve
.PP
\&\fB(?:\ed+)\fR part can be any random value.  The tarball file can have \fB53\fR,
while the signature file can have \fB33\fR.
.PP
\&\fB([\ed\e.]+)\fR part for the signature file has a strict requirement to match that
for the upstream tarball specified in the previous line by having \fBprevious\fR
as \fIversion\fR in the watch line.
.SS "HTTP site (flexible)"
.IX Subsection "HTTP site (flexible)"
Here is an example for the maximum flexibility of upstream tarball and
signature file extensions.
.PP
.Vb 6
\&  version=4
\&  opts="pgpmode=next" http://example.com/DL/ \e
\&      files/(?:\ed+)/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@ debian
\&  opts="pgpmode=previous" http://example.com/DL/ \e
\&      files/(?:\ed+)/@PACKAGE@@ANY_VERSION@@SIGNATURE_EXT@ \e
\&      previous
.Ve
.SS "HTTP site (basic MUT)"
.IX Subsection "HTTP site (basic MUT)"
Here is an example for the basic multiple upstream tarballs.
.PP
.Vb 10
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.sig%" \e
\&      http://example.com/release/foo.html \e
\&      files/foo\-@ANY_VERSION@@ARCHIVE_EXT@ debian
\&  opts="pgpsigurlmangle=s%$%.sig%, component=bar" \e
\&      http://example.com/release/foo.html \e
\&      files/foobar\-@ANY_VERSION@@ARCHIVE_EXT@ same
\&  opts="pgpsigurlmangle=s%$%.sig%, component=baz" \e
\&      http://example.com/release/foo.html \e
\&      files/foobaz\-@ANY_VERSION@@ARCHIVE_EXT@ same
.Ve
.PP
For the main upstream source package \fBfoo\-2.0.tar.gz\fR and the secondary
upstream source packages \fBfoobar\-2.0.tar.gz\fR and \fBfoobaz\-2.0.tar.gz\fR which
install under \fIbar/\fR and \fIbaz/\fR, this watch file downloads and creates the
Debian \fBorig.tar\fR file \fBfoo_2.0.orig.tar.gz\fR, \fBfoo_2.0.orig\-bar.tar.gz\fR and
\&\fBfoo_2.0.orig\-baz.tar.gz\fR.  Also, these upstream tarballs are verified by
their signature files.
.SS "HTTP site (recursive directory scanning)"
.IX Subsection "HTTP site (recursive directory scanning)"
Here is an example with the recursive directory scanning for the upstream tarball
and its signature files released in a directory named
after their version.
.PP
.Vb 4
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.sig%, dirversionmangle=s/\-PRE/~pre/;s/\-RC/~rc/" \e
\&      http://tmrc.mit.edu/mirror/twisted/Twisted/@ANY_VERSION@/ \e
\&      Twisted\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Here, the web site should be accessible at the following URL:
.PP
.Vb 1
\&  http://tmrc.mit.edu/mirror/twisted/Twisted/
.Ve
.PP
Here, \fBdirversionmangle\fR option is used to normalize the sorting order of the
directory names.
.SS "HTTP site (alternative shorthand)"
.IX Subsection "HTTP site (alternative shorthand)"
For the bare HTTP site where you can directly see archive filenames, the normal
watch file:
.PP
.Vb 4
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.sig%" \e
\&      http://www.cpan.org/modules/by\-module/Text/ \e
\&      Text\-CSV_XS\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
can be rewritten in an alternative shorthand form only with a single string
covering URL and filename:
.PP
.Vb 3
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.sig%" \e
\&      http://www.cpan.org/modules/by\-module/Text/Text\-CSV_XS\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
In version=4, initial white spaces are dropped.  Thus, this alternative
shorthand form can also be written as:
.PP
.Vb 4
\&  version=4
\&  opts="pgpsigurlmangle=s%$%.sig%" \e
\&      http://www.cpan.org/modules/by\-module/Text/\e
\&      Text\-CSV_XS\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Please note the subtle difference of a space before the tailing \fB\e\fR
between the first and the last examples.
.SS "HTTP site (funny version)"
.IX Subsection "HTTP site (funny version)"
For a site which has funny version numbers, the parenthesized groups will be
joined with \fB.\fR (period) to make a sanitized version number.
.PP
.Vb 2
\&  version=4
\&  http://www.site.com/pub/foobar/foobar_v(\ed+)_(\ed+)@ARCHIVE_EXT@
.Ve
.SS "HTTP site (DFSG)"
.IX Subsection "HTTP site (DFSG)"
The upstream part of the Debian version number can be mangled to indicate the
source package was repackaged to clean up non-DFSG files:
.PP
.Vb 3
\&  version=4
\&  opts="dversionmangle=s/\e+dfsg\ed*$//,repacksuffix=+dfsg" \e
\&  http://some.site.org/some/path/foobar\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
See "COPYRIGHT FILE EXAMPLES" in \fBuscan\fR\|(1).
.SS "HTTP site (filenamemangle)"
.IX Subsection "HTTP site (filenamemangle)"
The upstream tarball filename is found by taking the last component of the URL
and removing everything after any '?' or '#'.
.PP
If this does not fit to you, use \fBfilenamemangle\fR.  For example, \fI<A
href="http://foo.bar.org/dl/?path=&dl=foo\-0.1.1.tar.gz">\fR could be handled
as:
.PP
.Vb 3
\&  version=4
\&  opts=filenamemangle=s/.*=(.*)/$1/ \e
\&  http://foo.bar.org/dl/\e?path=&dl=foo\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
\&\fI<A href="http://foo.bar.org/dl/?path=&dl_version=0.1.1">\fR
could be handled as:
.PP
.Vb 3
\&  version=4
\&  opts=filenamemangle=s/.*=(.*)/foo\-$1\e.tar\e.gz/ \e
\&  http://foo.bar.org/dl/\e?path=&dl_version=@ANY_VERSION@
.Ve
.PP
If the href string has no version using <I>matching\-pattern>, the version can
be obtained from the full URL using \fBfilenamemangle\fR.
.PP
.Vb 3
\&  version=4
\&  opts=filenamemangle=s&.*/dl/(.*)/foo\e.tar\e.gz&foo\-$1\e.tar\e.gz& \e
\&  http://foo.bar.org/dl/@ANY_VERSION@/ foo.tar.gz
.Ve
.SS "HTTP site (downloadurlmangle)"
.IX Subsection "HTTP site (downloadurlmangle)"
The option \fBdownloadurlmangle\fR can be used to mangle the URL of the file
to download.  This can only be used with \fBhttp://\fR URLs.  This may be
necessary if the link given on the web page needs to be transformed in
some way into one which will work automatically, for example:
.PP
.Vb 4
\&  version=4
\&  opts=downloadurlmangle=s/prdownload/download/ \e
\&  http://developer.berlios.de/project/showfiles.php?group_id=2051 \e
\&  http://prdownload.berlios.de/softdevice/vdr\-softdevice\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.SS "HTTP site (oversionmangle, MUT)"
.IX Subsection "HTTP site (oversionmangle, MUT)"
The option \fBoversionmangle\fR can be used to mangle the version of the source
tarball (\fB.orig.tar.gz\fR and \fB.orig\-bar.tar.gz\fR).  For example, \fB+dfsg\fR can
be added to the upstream version as:
.PP
.Vb 7
\&  version=4
\&  opts=oversionmangle=s/(.*)/$1+dfsg/ \e
\&  http://example.com/~user/release/foo.html \e
\&  files/foo\-@ANY_VERSION@@ARCHIVE_EXT@ debian
\&  opts="component=bar" \e
\&  http://example.com/~user/release/foo.html \e
\&  files/bar\-@ANY_VERSION@@ARCHIVE_EXT@ same
.Ve
.PP
See "COPYRIGHT FILE EXAMPLES" in \fBuscan\fR\|(1).
.SS "HTTP site (pagemangle)"
.IX Subsection "HTTP site (pagemangle)"
The option \fBpagemangle\fR can be used to mangle the downloaded web page before
applying other rules.  The non-standard web page without proper \fB<a href="\fR << ... >> \fB">\fR entries can be converted.  For example, if \fIfoo.html\fR
uses \fB<a bogus="\fR \fI...\fR \fB">\fR, this can be converted to the
standard page format with:
.PP
.Vb 4
\&  version=4
\&  opts=pagemangle="s/<a\es+bogus=/<a href=/g" \e
\&  http://example.com/release/foo.html \e
\&  files/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Please note the use of \fBg\fR here to replace all occurrences.
.PP
If \fIfoo.html\fR uses \fB<Key>\fR \fI...\fR \fB</Key>\fR, this can be
converted to the standard page format with:
.PP
.Vb 4
\&  version=4
\&  opts="pagemangle=s%<Key>([^<]*)</Key>%<Key><a href="$1">$1</a></Key>%g" \e
\&  http://example.com/release/foo.html \e
\&  (?:.*)/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.SS "FTP site (basic):"
.IX Subsection "FTP site (basic):"
.Vb 2
\&  version=4
\&  ftp://ftp.tex.ac.uk/tex\-archive/web/c_cpp/cweb/cweb\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.SS "FTP site (regex special characters):"
.IX Subsection "FTP site (regex special characters):"
.Vb 3
\&  version=4
\&  ftp://ftp.worldforge.org/pub/worldforge/libs/\e
\&  Atlas\-C++/transitional/Atlas\-C\e+\e+\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Please note that this URL is connected to be \fI ... \fR\fBlibs/Atlas\-C++/\fR\fI ... \fR
\&. For \fB++\fR, the first one in the directory path is verbatim while the one in
the filename is escaped by \fB\e\fR.
.SS "FTP site (funny version)"
.IX Subsection "FTP site (funny version)"
This is another way of handling site with funny version numbers,
this time using mangling.  (Note that multiple groups will be
concatenated before mangling is performed, and that mangling will
only be performed on the basename version number, not any path
version numbers.)
.PP
.Vb 4
\&  version=4
\&  opts="uversionmangle=s/^/0.0./" \e
\&  ftp://ftp.ibiblio.org/pub/Linux/ALPHA/wine/\e
\&  development/Wine\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.SS sf.net
.IX Subsection "sf.net"
For SourceForge based projects, qa.debian.org runs a redirector which allows a
simpler form of URL. The format below will automatically be rewritten to use
the redirector with the watch file:
.PP
.Vb 2
\&  version=4
\&  https://sf.net/<project>/ <tar\-name>\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
For \fBaudacity\fR, set the watch file as:
.PP
.Vb 2
\&  version=4
\&  https://sf.net/audacity/ audacity\-minsrc\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Please note, you can still use normal functionalities of \fBuscan\fR to set up a
watch file for this site without using the redirector.
.PP
.Vb 6
\&  version=4
\&  opts="uversionmangle=s/\-pre/~pre/, \e
\&    filenamemangle=s%(?:.*)audacity\-minsrc\-(.+)\e.tar\e.xz/download%\e
\&                         audacity\-$1.tar.xz%" \e
\&    http://sourceforge.net/projects/audacity/files/audacity/@ANY_VERSION@/ \e
\&    (?:.*)audacity\-minsrc\-@ANY_VERSION@@ARCHIVE_EXT@/download
.Ve
.PP
Here, \fB%\fR is used as the separator instead of the standard \fB/\fR.
.SS github.com
.IX Subsection "github.com"
For GitHub based projects, you can use the releases or tags API page.  If
upstream releases properly named tarballs on their releases page, you can
search for the browser download URL (API key \fIbrowser_download_url\fR):
.PP
.Vb 7
\&  version=4
\&  opts=\e
\&  filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@\-$1.tar.gz%,\e
\&  downloadurlmangle=s%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g,\e
\&  searchmode=plain \e
\&   https://api.github.com/repos/<user>/<project>/git/matching\-refs/tags/ \e
\&   https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/@ANY_VERSION@
.Ve
.PP
It is also possible to filter tags by prefix. For example to get only tags
starting by \f(CW\*(C`v1\*(C'\fR:
.PP
.Vb 7
\&  version=4
\&  opts=\e
\&  filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@\-$1.tar.gz%,\e
\&  downloadurlmangle=s%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g,\e
\&  searchmode=plain \e
\&   https://api.github.com/repos/<user>/<project>/git/matching\-refs/tags/v1 \e
\&   https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/@ANY_VERSION@
.Ve
.PP
Alternatives with releases only (if upstream does not delete tag after release):
.PP
.Vb 7
\&  version=4
\&  opts=\e
\&  filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@\-$1.tar.gz%,\e
\&  downloadurlmangle=s%api.github.com/repos/([^/]+/[^/]+)/git/refs/tags/@ANY_VERSION@%github.com/$1/archive/refs/tags/$2.tar.gz%g,\e
\&  searchmode=plain \e
\&   https://api.github.com/repos/<user>/<project>/git/matching\-refs/tags/ \e
\&   https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/@ANY_VERSION@
.Ve
.PP
In case of release that does not use tags or deleted tags:
.PP
.Vb 4
\&  version=4
\&  opts="filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@\-$1.tar.gz%,searchmode=plain" \e
\&      https://api.github.com/repos/<user>/<project>/releases?per_page=100 \e
\&      https://api.github.com/repos/<user>/<project>/tarball/@ANY_VERSION@
.Ve
.PP
If upstream releases alpha/beta tarballs, you will need to make use of the
\&\fBuversionmangle\fR option: \fIuversionmangle=s/(a|alpha|b|beta|c|dev|pre|rc)/~$1/\fR
.PP
If upstream forget to tag a release for instance here the \f(CW1.2.3\fR version corresponding
to commit \f(CW\*(C`0123456789abcdf01234567890abcef012345678\*(C'\fR, you could download it,
using the following combination of \fBoversionmangle\fR, \fBfilenamemangle\fR,
\&\fBdownloadurlmangle\fR options:
.PP
.Vb 8
\&  version=4
\&  opts=\e
\&  downloadurlmangle=s%(api.github.com/repos/[^/]+/[^/]+)/git/refs/.*%$1/tarball/0123456789abcdf01234567890abcef012345678%g,\e
\&  oversionmangle=s/.*/1.2.3~git/g,\e
\&  filenamemangle=s%.*%1.2.3~git.tar.gz%,\e
\&  searchmode=plain \e
\&   https://api.github.com/repos/ImageMagick/ImageMagick/git/matching\-refs/tags/ \e
\&   https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/@ANY_VERSION@
.Ve
.PP
Remember, in this case, after \fBgbp\fR \fBimport-orig\fR \fB\-\-uscan\fR to revert
the \fIdebian/watch\fR file.
.SS "Forgejo (Codeberg)"
.IX Subsection "Forgejo (Codeberg)"
Releases with manually-attached tarballs (\fIassets[...].browser_download_url\fR):
.PP
.Vb 4
\&  version=4
\&  opts=searchmode=plain \e
\&    https://codeberg.org/api/v1/repos/<user>/<project>/releases \e
\&    https://codeberg.org/<user>/<project>/releases/download/[^/\-_v]*@ANY_VERSION@/[^"]*@ARCHIVE_EXT@
.Ve
.PP
Releases with automatically-generated tarballs (\fItarball_url\fR):
.PP
.Vb 4
\&  version=4
\&  opts="filenamemangle=s%.*/[^"\-_v]*@ANY_VERSION@%@PACKAGE@\-$1%,searchmode=plain" \e
\&      https://codeberg.org/api/v1/repos/<user>/<project>/releases \e
\&      https://codeberg.org/<user>/<project>/archive/[^"\-_v]*@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Tags with automatically-generated tarballs (\fItarball_url\fR):
.PP
.Vb 4
\&  version=4
\&  opts="filenamemangle=s%.*/[^"\-_v]*@ANY_VERSION@%@PACKAGE@\-$1%,searchmode=plain" \e
\&      https://codeberg.org/api/v1/repos/<user>/<project>/tags \e
\&      https://codeberg.org/<user>/<project>/archive/[^"\-_v]*@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Replace \fIcodeberg.org\fR with the Forgejo instance in question.
.SS PyPI
.IX Subsection "PyPI"
For PyPI based projects, pypi.debian.net runs a redirector which allows a
simpler form of URL. The format below will automatically be rewritten to use
the redirector with the watch file:
.PP
.Vb 3
\&  version=4
\&  https://pypi.python.org/packages/source/<initial>/<project>/ \e
\&      <tar\-name>\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
For \fBcfn-sphere\fR, set the watch file as:
.PP
.Vb 3
\&  version=4
\&  https://pypi.python.org/packages/source/c/cfn\-sphere/ \e
\&      cfn\-sphere\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.PP
Please note, you can still use normal functionalities of \fBuscan\fR to set up a
watch file for this site without using the redirector.
.PP
.Vb 5
\&  version=4
\&  opts="pgpmode=none" \e
\&      https://pypi.python.org/pypi/cfn\-sphere/ \e
\&      https://pypi.python.org/packages/.*/.*/.*/\e
\&      cfn\-sphere\-@ANY_VERSION@@ARCHIVE_EXT@#.*
.Ve
.SS code.google.com
.IX Subsection "code.google.com"
Sites which used to be hosted on the Google Code service should have migrated
to elsewhere (github?).  Please look for the newer upstream site if available.
.SS "npmjs.org (node modules)"
.IX Subsection "npmjs.org (node modules)"
npmjs.org modules are published in JSON files. Here is a way to read them:
.PP
.Vb 4
\&  version=4
\&  opts="searchmode=plain" \e
\&   https://registry.npmjs.org/aes\-js \e
\&   https://registry.npmjs.org/aes\-js/\-/aes\-js\-@ANY_VERSION@@ARCHIVE_EXT@
.Ve
.SS "grouped package"
.IX Subsection "grouped package"
Some node modules are split into multiple little upstream package. Here is
a way to group them:
.PP
.Vb 10
\&  version=4
\&  opts="searchmode=plain,pgpmode=none" \e
\&    https://registry.npmjs.org/mongodb \e
\&    https://registry.npmjs.org/mongodb/\-/mongodb\-@ANY_VERSION@@ARCHIVE_EXT@ group
\&  opts="searchmode=plain,pgpmode=none,component=bson" \e
\&    https://registry.npmjs.org/bson \e
\&    https://registry.npmjs.org/bson/\-/bson\-@ANY_VERSION@@ARCHIVE_EXT@ group
\&  opts="searchmode=plain,pgpmode=none,component=mongodb\-core" \e
\&    https://registry.npmjs.org/mongodb\-core \e
\&    https://registry.npmjs.org/mongodb\-core/\-/mongodb\-core\-@ANY_VERSION@@ARCHIVE_EXT@ group
\&  opts="searchmode=plain,pgpmode=none,component=requireoptional" \e
\&    https://registry.npmjs.org/require_optional \e
\&    https://registry.npmjs.org/require_optional/\-/require_optional\-@ANY_VERSION@@ARCHIVE_EXT@ group
.Ve
.PP
Package version is then the concatenation of upstream versions separated by
"+~".
.PP
To avoid having a too long version, the "checksum" method can be used.
In this case, the main source has to be declared as "group":
.PP
.Vb 10
\&  version=4
\&  opts="searchmode=plain,pgpmode=none" \e
\&    https://registry.npmjs.org/mongodb \e
\&    https://registry.npmjs.org/mongodb/\-/mongodb\-@ANY_VERSION@@ARCHIVE_EXT@ group
\&  opts="searchmode=plain,pgpmode=none,component=bson" \e
\&    https://registry.npmjs.org/bson \e
\&    https://registry.npmjs.org/bson/\-/bson\-@ANY_VERSION@@ARCHIVE_EXT@ checksum
\&  opts="searchmode=plain,pgpmode=none,component=mongodb\-core" \e
\&    https://registry.npmjs.org/mongodb\-core \e
\&    https://registry.npmjs.org/mongodb\-core/\-/mongodb\-core\-@ANY_VERSION@@ARCHIVE_EXT@ checksum
\&  opts="searchmode=plain,pgpmode=none,component=requireoptional" \e
\&    https://registry.npmjs.org/require_optional \e
\&    https://registry.npmjs.org/require_optional/\-/require_optional\-@ANY_VERSION@@ARCHIVE_EXT@ checksum
.Ve
.PP
The "checksum" is made up of the separate sum of each number composing the
component versions and prefixed with ~cs (short for checksum).  Following is an
example with 3 components whose versions
are "1.2.4", "2.0.1" and "10.0", with the main tarball having version "2.0.6":
.PP
.Vb 9
\&  Main: 2.0.6
\&  Comp1:         1 .     2 .     4
\&  Comp2:         2 .     0 .     1
\&  Comp3:        10 .     0
\&  ================================
\&  Result  : 1+2+10 . 2+0+0 .   4+1
\&  Checksum:     13 .     2 .     5
\&  ================================
\&  Final Version:   2.0.6+~cs13.2.5
.Ve
.PP
uscan will also display the original version string before being encoded into
the checksum, which can for example be used in a debian/changelog entry to
easily follow the changes:
.PP
.Vb 1
\&  2.0.6+~1.2.4+~2.0.1+~10.0
.Ve
.PP
\&\fBNote\fR: This feature currently accepts only versions composed of digits and
full stops (`.`).
.SS "direct access to the git repository (tags)"
.IX Subsection "direct access to the git repository (tags)"
If the upstream only publishes its code via the git repository and its code has
no web interface to obtain the release tarball, you can use \fBuscan\fR with the
tags of the git repository to track and package the new upstream release.
.PP
.Vb 4
\&  version=4
\&  opts="mode=git, gitmode=full, pgpmode=none" \e
\&  http://git.ao2.it/tweeper.git \e
\&  refs/tags/@ANY_VERSION@
.Ve
.PP
Please note "\fBgit ls-remote\fR" is used to obtain references for tags.
.PP
If a tag \fBv20.5\fR is the newest tag, the above example downloads
\&\fIspkg\fR\fB\-20.5.tar.xz\fR after making a full clone of the git repository which is
needed for dumb git server.
.PP
If tags are signed, set \fBpgpmode=gittag\fR to verify them.
.SS "direct access to the git repository (HEAD)"
.IX Subsection "direct access to the git repository (HEAD)"
If the upstream only publishes its code via the git repository and its code has
no web interface nor the tags to obtain the released tarball, you can use
\&\fBuscan\fR with the HEAD of the git repository to track and package the new
upstream release with an automatically generated version string.
.PP
.Vb 4
\&  version=4
\&  opts="mode=git, pgpmode=none" \e
\&  https://github.com/Debian/dh\-make\-golang \e
\&  HEAD
.Ve
.PP
Please note that a local shallow copy of the git repository is made with "\fBgit
clone \-\-bare \-\-depth=1\fR ..." normally in the target directory.  \fBuscan\fR
generates the new upstream version with "\fBgit log \-\-date=format:%Y%m%d
\&\-\-pretty=0.0~git%cd.%h\fR" on this local copy of repository as its default
behavior.
.PP
The generation of the upstream version string may the adjusted to your taste by
adding \fBpretty\fR and \fBdate\fR options to the \fBopts\fR arguments.
.SS "direct access to the git repository (with submodules)"
.IX Subsection "direct access to the git repository (with submodules)"
If the upstream only publishes its code via a git repository and the repository
includes submodules, you can use \fBuscan\fR with the tags or HEAD of the git
repository to track and package the new upstream release.
.PP
Use \fBgitmodules\fR to clone all submodules:
.PP
.Vb 3
\&  version=4
\&  opts="mode=git, gitmode=shallow, gitmodules" \e
\&  https://github.com/namespace/project [refs/tags/@ANY_VERSION@|HEAD]
.Ve
.PP
To clone selected submodules (and exclude others), use \fBgitmodules\fR with
a semicolon-separated list:
.PP
.Vb 3
\&  version=4
\&  opts="mode=git, gitmode=shallow, gitmodules=m4;doc/common" \e
\&  https://github.com/namespace/project [refs/tags/@ANY_VERSION@|HEAD]
.Ve
.SS "direct access to the Subversion repository (tags)"
.IX Subsection "direct access to the Subversion repository (tags)"
If the upstream only publishes its code via the Subversion repository and its
code has no web interface to obtain the release tarball, you can use \fBuscan\fR
with the tags of the Subversion repository to track and package the new upstream
release.
.PP
.Vb 4
\&  version=4
\&  opts="mode=svn, pgpmode=none" \e
\&  svn://svn.code.sf.net/p/jmol/code/tags/ \e
\&  @ANY_VERSION@\e/
.Ve
.SS "direct access to the Subversion repository (HEAD)"
.IX Subsection "direct access to the Subversion repository (HEAD)"
If the upstream only publishes its code via the Subversion repository and its
code has no web interface to obtain the release tarball, you can use \fBuscan\fR
to get the most recent source of a subtree in the repository with an
automatically generated version string.
.PP
.Vb 4
\&  version=4
\&  opts="mode=svn, pgpmode=none" \e
\&  svn://svn.code.sf.net/p/jmol/code/trunk/ \e
\&  HEAD
.Ve
.PP
By default, \fBuscan\fR generates the new upstream version by appending the
revision number to "0.0~svn". This can later be changed using
\&\fBfilenamemangle\fR.
.SS Fossil
.IX Subsection "Fossil"
For Fossil based projects, the tarball URL can be deduced from the taglist page.
.PP
.Vb 7
\&  version=4
\&  opts=" \e
\&    searchmode=plain, \e
\&    filenamemangle=s/timeline\e?t=(@ANY_VERSION@)/@PACKAGE@\-$1.tar.gz/, \e
\&    downloadurlmangle=s#/timeline\e?t=(@ANY_VERSION@)#/tarball/Grammalecte.tar.gz?r=$1#" \e
\&    http://grammalecte.net:8080/taglist \e
\&    /timeline\e?t=@ANY_VERSION@
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBuscan\fR\|(1), \fBmk\-origtargz\fR\|(1), \fBperlre\fR\|(1), \fBuupdate\fR\|(1), \fBdevscripts.conf\fR\|(5)
.SH AUTHOR
.IX Header "AUTHOR"
The original version of uscan was written by Christoph Lameter
<clameter@debian.org>. Significant improvements, changes and bugfixes were
made by Julian Gilbey <jdg@debian.org>. HTTP support was added by Piotr
Roszatycki <dexter@debian.org>. The program was rewritten in Perl by Julian
Gilbey. Xavier Guimard converted it in object-oriented Perl using Moo.
