Re: Change in kernel debian packages between -rc2 and -rc3

Masahiro Yamada
2023-03-26T03:40:31Z

On Sat, Mar 25, 2023 at 11:31 PM Theodore Ts'o <tytso@mit.edu> wrote:
>
> Hi Masahiro,
>
> It appears that there is a backwards-incompatible (and, I believe,
> incorrect) change in the package version used when generated Debian
> packages between 6.2-rc2 and 6.2-rc3.
>
> I have CONFIG_LOCALVERSION set in my .config:
>
> CONFIG_LOCALVERSION="-xfstests"
>
> As a result, the uname -a of a kernel that I build contains -xfstests,
> e.g:
>
> root@kvm-xfstests:~# uname -r
> 6.3.0-rc3-xfstests-00043-g463f2e46bf7c
>
> Previously this would be correctly reflected in the Debian package
> version:
>
> % dpkg -I /build/linux-image-6.3.0-rc2-xfstests_6.3.0-rc2-xfstests-1016_amd64.deb
> ...
> Package: linux-image-6.3.0-rc2-xfstests
> Source: linux-6.3.0-rc2-xfstests
> Version: 6.3.0-rc2-xfstests-1016
> ...
>
> However, after -rc3, the CONFIG_LOCALVERSION is no longer present in the package version:
>
> % dpkg -I /build/linux-image-6.3.0-rc3-xfstests-00043-g463f2e46bf7c_6.3.0-rc3-00043-g463f2e46bf7c-1017_amd64.deb
> ...
> Package: linux-image-6.3.0-rc3-xfstests-00043-g463f2e46bf7c
> Source: linux-6.3.0-rc3-xfstests-00043-g463f2e46bf7c
> Version: 6.3.0-rc3-00043-g463f2e46bf7c-1017
> ...

I am afraid you are completely misunderstanding the two versions,
the ABI version and the package version.

They do not need to match. Actually, they do not match.

See real Debian (or Ubuntu) systems.

On Debian bullseye.

$ uname -r
5.10.0-21-amd64
$ dpkg-deb -I linux-image-5.10.0-21-amd64_5.10.162-1_amd64.deb
[snip]
Package: linux-image-5.10.0-21-amd64
Source: linux-signed-amd64 (5.10.162+1)
Version: 5.10.162-1
Architecture: amd64

`uname -r` returns '5.10.0-21-amd64'.
This is what they call the ABI version, and
this is contained as a part of the package name,
'linux-image-5.10.0-21-amd64'

The package version is '5.10.162-1'

They are different.

This means the Debian kernel team built the kernel package
based on the stable kernel '5.10.162'.
The suffix '-1' indicates the Debian revision.
But, they gave a different uname '5.10.0-21-amd64'.

Get back to your question.

You set CONFIG_LOCALVERSION="-xfstests".
It was reflected in 'uname -r' and in the package name.
This is correct.

It was _not_ reflected in the package version.
This is also correct since the package version
is not meant to reflect such user configuration
as CONFIG_LOCALVERSION.

The upstream version part '6.3.0-rc3-00043-g463f2e46bf7c'
represents the version of the source code.
In other words, it is determined by the git commit hash
(if you are using a git repository) and never affected by
CONFIG options or local files.

You can build multiple debian packages from the same git
commit hash, changing the .config, arch, or whatever.
In this case, the debian revision part, "-1017" is auto-incremented.

If you override the package version, you can use KDEB_PKGVERSION.

> Note the missing "-xfstests" in the above Version. This also shows up
> in the name of the .deb file which is generated, and this is breaking
> my kernel build script[1].
>
> [1] https://github.com/tytso/xfstests-bld/blob/master/kernel-build/kbuild

This is just because your tool is wrong.
It was just working based on the wrong assumption.

Please fix it.

> I assume the problem is caused by one of these two commits:
>
> 36862e14e316 ("kbuild: deb-pkg: use dh_listpackages to know enabled packages")
> b611daae5efc ("kbuild: deb-pkg: split image and debug objects staging out into functions")
>
> As these are the two commits which touch the builddeb script.
>
> Could you please take a look?
>
> Many thanks,
>
> - Ted

--
Best Regards
Masahiro Yamada