Hi!
On Wed, 2020-12-02 at 07:16:52 +0300, Anatoli Babenia wrote:
> Package: dpkg-dev
> Version: 1.19.7
> Severity: normal
> File: /usr/bin/dpkg-source
> It would help greatly if `dpkg-source` reported native or non-native
> package type.
>
> -dpkg-source: info: using source format '1.0'
> +dpkg-source: info: using non-native source format '1.0'
While I think something like this would be nice, unfortunately I'm afraid
this cannot be done right now, because there are still package at least
in Debian that have a mismatched version format compared to their source
format. See:
<
https://lintian.debian.org/tags/malformed-debian-changelog-version>
For most of which I've filed bug reports, see:
<
https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=dpkg-mismatch-source-vs-version-format;users=debia...@lists.debian.org>
Unfortunately there are a couple of maintainers that refuse to fix these
problems, so we cannot currently have coherent semantics. :(
The dpkg-source man page contains documentation about the various
formats:
<
https://manpages.debian.org/dpkg-source>
> `dpkg-source` code does explain the logic either. Detection of source format
> relies on checking command line flags, and it does not make sense to me.
>
> my $v = Dpkg::Version->new($self->{fields}->{'Version'});
> if ($sourcestyle =~ m/[kpursKPUR]/) {
> error(g_('non-native package version does not contain a revision'))
> if $v->is_native();
> } else {
> # FIXME: This will become fatal in the near future.
> warning(g_('native package version may not have a revision'))
> unless $v->is_native();
> }
>
>
https://salsa.debian.org/dpkg-team/dpkg/-/blob/09c9e02046f18f02bf3c3c2533bc557abfdc828c/scripts/Dpkg/Source/Package/V1.pm#L355
>
> It would be nice to see a reference algorithm that detects different package
> types. It would help people like me to troubleshoot issues with Debian
> packaging faster.
It would be nice, and I've been trying to get there, but see above.
Thanks,
Guillem