freebsd / poudriere

Port/Package build and test system
https://github.com/freebsd/poudriere/wiki
BSD 2-Clause "Simplified" License
379 stars 161 forks source link

Show the version number — __FreeBSD_version — in information about a jail #1125

Closed grahamperrin closed 2 months ago

grahamperrin commented 4 months ago

Prerequisites

What is your proposal?

Enhance output from poudriere jail -i.

What is the existing behavior, if any?

Relatively non-specific, for example:

Jail version: 15.0-CURRENT

What is the motivation / use case for the change?

Knowing the version number will help to know whether, for example, the jail is suitable for a build of a kernel module.

Did you consider any alternatives?

Yes, experiments such as the one below.

Is this really a ports feature request?

Yes, an enhancement to poudriere (or poudriere-devel).

Example

In this case, I suspect that the version number of the jail is 150014:

root@mowa219-gjp4-zbook-freebsd:~ # poudriere jail -i -j main
Jail name:         main
Jail version:      15.0-CURRENT
Jail arch:         amd64
Jail method:       url=https://download.freebsd.org/snapshots/amd64/15.0-CURRENT/
Jail mount:        /usr/local/poudriere/jails/main
Jail fs:           august/poudriere/jails/main
Jail updated:      2024-02-15 00:29:26
Jail pkgbase:      disabled
root@mowa219-gjp4-zbook-freebsd:~ # chroot /usr/local/poudriere/jails/main
root@mowa219-gjp4-zbook-freebsd:/ # strings boot/kernel/kernel | egrep ^FreeBSD\ 15.0
strings: 'boot/kernel/kernel': No such file or directory
root@mowa219-gjp4-zbook-freebsd:/ # exit
exit
root@mowa219-gjp4-zbook-freebsd:~ # fetch -o /tmp/15.0-revision.txt -q https://download.freebsd.org/snapshots/amd64/15.0-CURRENT/REVISION && cat /tmp/15.0-revision.txt
82bebc793658
root@mowa219-gjp4-zbook-freebsd:~ # su grahamperrin
% time git -C /usr/src pull --ff-only --quiet freebsd main
1.119u 6.364s 1:46.93 6.9%      3394+451k 11691+1056io 3650pf+0w
% git -C /usr/src log -n 2 --follow sys/sys/param.h
commit ed27ae8df4b10f67289a32458d89d143e758f6d4
Author: Dimitry Andric <dim@FreeBSD.org>
Date:   Sun Feb 11 23:45:51 2024 +0100

    Bump __FreeBSD_version after clang/llvm PIE change

    Otherwise, incremental builds might fail with various interesting
    errors. This is a bit of a big hammer, but I don't know of any other way
    to force rebuilds of all these libraries.

    Reported by:    bapt
    Fixes:          470f9f13de10
    MFC after:      1 week

commit d04abb05375d3525132f1e9f78090db3d0d27f14
Author: Brooks Davis <brooks@FreeBSD.org>
Date:   Wed Feb 7 19:45:27 2024 +0000

    Belatedly bump __FreeBSD_version for libsys
% uname -KU
1500013 1500013
% bectl list -c creation | tail -n 10
n267824-0dd5a5603e7a-b -      -          530M  2024-01-31 09:25
n267824-0dd5a5603e7a-c -      -          409M  2024-02-04 19:48
1500012-a              -      -          50.1M 2024-02-06 09:32
1500012-b              -      -          122M  2024-02-06 22:31
1500012-c              -      -          2.27G 2024-02-08 01:07
1500013-a              -      -          2.25G 2024-02-08 23:31
1500013-b              NR     /          243G  2024-02-10 07:44
1500013-c              -      -          1.78G 2024-02-10 14:11
1500013-d              -      -          1.97G 2024-02-11 04:59
1500013-e              -      -          5.22G 2024-02-11 13:29
% exit
exit
root@mowa219-gjp4-zbook-freebsd:~ #

Additional context

From https://discord.com/channels/727023752348434432/1205628135819837471/1205628547667075132 (2024-02-09):

Here, I'm happily stumbling around, but there must be an easier way to tell the version number – in this case, whether it's 1500012 or 1500013

https://github.com/freebsd/poudriere/commit/c469186baaaa633849ec8b5acdf8ac5aad0d4119 in 2013 was:

jail -c: Fix __FreeBSD_version lookup