uscan: add "compat" target to download components with a compatible version
Closes: #973814:
uscan offers some target for components: ignore, same,...
same
is strict and matches only the exact same version, while ignore
doesn't check anything.
It could be interesting to have a compat
target that accept to download the last component whose version is compatible (using Semver algorithm).
Example: nodejs needs to embed a compatible @types/node
nodejs module. Nodejs unstable version is 12 and @types/node
does not follow any minor version of nodejs, so:
-
same
will often fail -
ignore
will download@types/node
version ≥ 14, corresponding to last published version. This generates build errors (see #964637 for example)
The compat
target (with compat_group
and compat_checksum
) will avoid to modify debian/watch
regexp and is more precise:
- if nodejs version is 12.2.3 and @types/nodejs has 12.2.3, 12.2.5, 12.5.6,
compat
will choose 12.2.5 (last where major and minor match) - if nodejs version is 12.2.3 and @types/nodejs has 12.1.3, 12.3.3, 12.5.6,
compat
will choose 12.5.6 (last where major match) - if nodejs version is 12.2.3 and @types/nodejs has no 12.x version,
compat
won't return any compatible version
Another example:
- a module has no types embedded in its version 1.x,
@types/foo
is available and compat downloads it - upstream decide to publish 2.X with embedded types definitions.
@types/foo
won't publish any 2.x version. Then uscan fails and DD discovers that embedding@types/foo
is no more needed (many examples in nodejs packages)
Edited by Yadd