Discussion:
/usr/src revision number
Janos Dohanics
2021-03-21 20:52:25 UTC
Permalink
Hello,

with svn(1) it was easy to compare the revision number of the
updated /usr/src with the installed version of FreeBSD.

For example:

# svn info /usr/src
Path: .
Working Copy Root Path: /usr/src
URL: svn://svn.freebsd.org/base/stable/12
Relative URL: ^/stable/12
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 369499
Node Kind: directory
Schedule: normal
Last Changed Author: git2svn
Last Changed Rev: 369499
Last Changed Date: 2021-03-21 11:54:54 -0400 (Sun, 21 Mar 2021)

# uname -v
FreeBSD 12.2-STABLE r368820 TURTLE2021010401

Now on my laptop I have:

# uname -v
FreeBSD 13.0-RC2 #0 releng/13.0-n244684-13c22f74953

Since I'd like to update to RC3, I did:

'git clone -b stable/13 --depth 1 https://git.freebsd.org/src.git /usr/src'

How can I find what "revision" do I have now in /usr/src and how can I
see if it is an increment compared to the installed kernel/userland?
--
Janos Dohanics
Kevin Oberman
2021-03-21 22:35:54 UTC
Permalink
Post by Janos Dohanics
Hello,
with svn(1) it was easy to compare the revision number of the
updated /usr/src with the installed version of FreeBSD.
# svn info /usr/src
Path: .
Working Copy Root Path: /usr/src
URL: svn://svn.freebsd.org/base/stable/12
Relative URL: ^/stable/12
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 369499
Node Kind: directory
Schedule: normal
Last Changed Author: git2svn
Last Changed Rev: 369499
Last Changed Date: 2021-03-21 11:54:54 -0400 (Sun, 21 Mar 2021)
# uname -v
FreeBSD 12.2-STABLE r368820 TURTLE2021010401
# uname -v
FreeBSD 13.0-RC2 #0 releng/13.0-n244684-13c22f74953
'git clone -b stable/13 --depth 1 https://git.freebsd.org/src.git /usr/src'
How can I find what "revision" do I have now in /usr/src and how can I
see if it is an increment compared to the installed kernel/userland?
--
Janos Dohanics
Take a look at the newd git "Getting started" guide at
https://docs.freebsd.org/en/articles/committers-guide/#git-primer. If you
use a shallow clone, there is no easy way. If you have a full clone, you
will have a hash starting with 'n' followed by 6 digits. This is a sequence
count of commits to the relevant branch. In your case, the sequence is
n244684.
Also, the recommended way to update your clone is "git pull --ff-only",
not a new clone. Much lower overhead.
--
Kevin Oberman, Part time kid herder and retired Network Engineer
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683
Graham Perrin
2021-04-05 19:00:47 UTC
Permalink
Post by Janos Dohanics

Take a look at the newd git "Getting started" guide at
https://docs.freebsd.org/en/articles/committers-guide/#git-primer. If you
use a shallow clone, there is no easy way. If you have a full clone, you
will have a hash starting with 'n' followed by 6 digits. This is a sequence
count of commits to the relevant branch. In your case, the sequence is
n244684.
FreeBSD: git --count result differs from the number in output from
uname -v
<https://pastebin.com/P1avJGwz>
I have seen differences more than once.
Can someone explain? Thanks.
Why is the count so different?

The count today: 257732; and the result of today's build: n245827

% bectl list -c creation
BE                    Active Mountpoint Space Created
r357746-Waterfox      -      -          59.2G 2020-03-10 18:24
n2733-5ac839029d-f    -      -          12.5G 2021-03-04 09:17
n257337-5fe0cd6503d-e -      -          1.55G 2021-03-23 07:56
n257551-66f138563be-a -      -          129M  2021-03-25 09:35
n257551-66f138563be-b -      -          882M  2021-03-26 19:27
n257551-66f138563be-c -      -          95.4M 2021-03-31 16:26
n257732-361e9501800-a NR     /          127G  2021-04-05 18:48
% uname -v
FreeBSD 14.0-CURRENT #91 main-n245827-361e9501800: Mon Apr  5 17:59:57
BST 2021
***@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG
% git -C /usr/src rev-list --count HEAD
257732
%
Herbert J. Skuhra
2021-04-05 19:43:53 UTC
Permalink
Post by Graham Perrin
Why is the count so different?
The count today: 257732; and the result of today's build: n245827
% bectl list -c creation
BE                    Active Mountpoint Space Created
r357746-Waterfox      -      -          59.2G 2020-03-10 18:24
n2733-5ac839029d-f    -      -          12.5G 2021-03-04 09:17
n257337-5fe0cd6503d-e -      -          1.55G 2021-03-23 07:56
n257551-66f138563be-a -      -          129M  2021-03-25 09:35
n257551-66f138563be-b -      -          882M  2021-03-26 19:27
n257551-66f138563be-c -      -          95.4M 2021-03-31 16:26
n257732-361e9501800-a NR     /          127G  2021-04-05 18:48
% uname -v
FreeBSD 14.0-CURRENT #91 main-n245827-361e9501800: Mon Apr  5 17:59:57
BST 2021
% git -C /usr/src rev-list --count HEAD
257732
/usr/src/sys/conf/newvers.sh uses a different command:

git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null)
^^^^^^^^^^^^^^
See:

commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287
Author: Warner Losh
Date: Mon Jan 25 12:53:31 2021 -0700

--
Herbert
Graham Perrin
2021-04-06 03:06:13 UTC
Permalink
Post by Herbert J. Skuhra
Post by Graham Perrin
Why is the count so different?
The count today: 257732; and the result of today's build: n245827
% bectl list -c creation
BE                    Active Mountpoint Space Created
r357746-Waterfox      -      -          59.2G 2020-03-10 18:24
n2733-5ac839029d-f    -      -          12.5G 2021-03-04 09:17
n257337-5fe0cd6503d-e -      -          1.55G 2021-03-23 07:56
n257551-66f138563be-a -      -          129M  2021-03-25 09:35
n257551-66f138563be-b -      -          882M  2021-03-26 19:27
n257551-66f138563be-c -      -          95.4M 2021-03-31 16:26
n257732-361e9501800-a NR     /          127G  2021-04-05 18:48
% uname -v
FreeBSD 14.0-CURRENT #91 main-n245827-361e9501800: Mon Apr  5 17:59:57
BST 2021
% git -C /usr/src rev-list --count HEAD
257732
git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null)
^^^^^^^^^^^^^^
commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287
Author: Warner Losh
Date: Mon Jan 25 12:53:31 2021 -0700
Perfect! Thank you. I'll update my script.

<https://cgit.freebsd.org/src/commit/?id=f19a4e97d3b0905dfda5aaebba49f68a1e07fa3e&h=main>
Loading...