Re: using git to get a particular version of src

From: Warner Losh <imp_at_bsdimp.com>
Date: Mon, 25 Jan 2021 11:55:22 -0700
On Mon, Jan 25, 2021 at 11:11 AM Yasuhiro Kimura <yasu_at_utahime.org> wrote:

> From: Chris <bsd-lists_at_bsdforge.com>
> Subject: Re: using git to get a particular version of src
> Date: Mon, 25 Jan 2021 09:21:44 -0800
>
> >> Hi,
> >> I have this version installed:
> >> 13.0-CURRENT #0 2ed50808d2b-c254384(main): Thu Nov 12 10:03:35 UTC
> >> 2020
> >> I'd like to get the sources for this (want to make a no-debug kernel)
> >> as I know
> >> this version works on this hardware.
> >> But -current has gone to 14 and what was -current is now
> >> 13-stable. What git
> >> incantation is required to get 2ed50808d2b-c254384 sources, given an
> >> empty
> >> /usr/src and git method of ssh://anongit_at_git.freebsd.org ?
> > I am by *no* means a GIT expert
> > but will
> > cd /usr/src
> > git up 2ed50808d2b
> > accomplish your intended task?
>
> Unfortunately it doesn't work as is expected in this case because hashes
> of src repostory changed on Dec 6 when it was still beta.
>
> HEADS UP: src hashes will respin/change this Sunday
> https://lists.freebsd.org/pipermail/freebsd-git/2020-December/000548.html
>
> In original case it was after this change so hash value can be used to
> checkout it. But this case is befere hash change. So there isn't hash
> 2ed50808d2b in current src repository any more.
>
> I also faced this problem when I tried to checkout source tree that
> corresponds to 20201119 snapshot of 13-CURRENT. Fortunately I still
> kept ISO image of it. So I did following steps to get the source tree.
>
> 1. Mount the ISO image
> 2. Extract src.txz in the ISO image to somewhere (e.g. /tmp/usr/src)
> 3. cd /usr
> 4. git clone https://git.freebsd.org/src.git
> 5. cd src
> 6. Checkout 65c207758a9 that was committed at Thu Nov 19 21:10:36
>    2020 +0000 (the last one committed on Nov 19, 2020)
> 7. diff -ru /tmp/usr/src /usr/src
> 8. If there are any differences, checkout f9fe7b28bc2 that is just
>    previous commit of 65c207758a9
> 9. Repeat step 7 and 8 until there is no difference between
>    /tmp/usr/src and /usr/src.
>

We should see how hard it would be to convert c254384 into a git hash...

So, for me:

% git describe
vendor/tzdata/tzdata2020f-255971-gfa6662b3689e (so my tip of main is 255971
vs 254384 or +1587)
% git log -1 main~1587
commit dda1987fe5dbf418b55195990896b0ef0a5b8e4a
Author: Mateusz Piotrowski <0mp_at_FreeBSD.org>
Date:   Tue Nov 17 12:04:29 2020 +0000

    Add an example for the -s flag

which is a little late. If you checked out the source and built it ASAP,
then I'd suggest:

commit f14436adc61a52b29d035791c0b90c0b221bea9a
Author: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date:   Thu Nov 12 09:26:01 2020 +0000

    Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the
    the HID volume keys support in the USB audio driver.

which is the version just before that. Or if you installed from a snapshot
and rebuilt, The 20201112 snapshot was likely built from

commit 38033780a3f4ed616d638fc0e9ef9a4d309f1fb3
Author: Kyle Evans <kevans_at_FreeBSD.org>
Date:   Wed Nov 11 22:35:23 2020 +0000

    umtx: drop incorrect timespec32 definition

Warner
Received on Mon Jan 25 2021 - 17:55:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:26 UTC