Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 2025 02:43:00 +0100
From:      Steffen Nurpmeso <steffen@sdaoden.eu>
To:        Warner Losh <imp@bsdimp.com>
Cc:        bob prohaska <fbsd@www.zefox.net>, Sulev-Madis Silber <freebsd-current-freebsd-org111@ketas.si.pri.ee>, freebsd-current@freebsd.org
Subject:   Re: /usr/src and /usr/ports not git directories ?
Message-ID:  <20250122014300.izn3kEWi@steffen%sdaoden.eu>
In-Reply-To: <CANCZdfoHUsZusqMg_gWN5mB9P3xByGv_GfELi9Dd63CHto1igw@mail.gmail.com>
References:  <Z4vk3009iSwuzG4K@www.zefox.net> <Z4__B0EQM-ce0qPE@cell.glebi.us> <C509F94C-2AC2-414F-90C0-355C69869D72@ketas.si.pri.ee> <Z5AQ1GcwX_MZw69G@www.zefox.net> <CANCZdfoHUsZusqMg_gWN5mB9P3xByGv_GfELi9Dd63CHto1igw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Warner Losh wrote in
 <CANCZdfoHUsZusqMg_gWN5mB9P3xByGv_GfELi9Dd63CHto1igw@mail.gmail.com>:
 |On Tue, Jan 21, 2025 at 2:26=E2=80=AFPM bob prohaska <fbsd@www.zefox.net>=
 wrote:
 |> On Tue, Jan 21, 2025 at 10:35:18PM +0200, Sulev-Madis Silber wrote:
 |>> not shipping src in installer? what could possibly go wrong!
 |>>
 |>> i was just thinking of this the other day. that installers are
 |> self-contained packages that come with os and it's source...
 |>>
 |> There's no harm (and indeed, some good) in offering source code
 |> as a component of a new installation. What confused me was having
 |> that source code offered as a dead end. After a little poking around
 |> it's clear that including /usr/src/.git would have added close to
 |> to 2 GB to the size of the installer. Perhaps not unacceptable,
 |> but surely undesirable. Maybe that's reason enough for present
 |> practice of installing a dead /usr/src..
 |>
 |> As a matter of naive curiosity, could one efficiently update /usr/src
 |> using something like sftp -ar ? It wouldn't preserve the revision detail
 |> git does, but seemingly it would download modified files while saving
 |> for re-use those that haven't changed. For users who don't make local
 |> mods it might be sufficient.
 |>
 |>> On January 21, 2025 10:09:43 PM GMT+02:00, Gleb Smirnoff <
 |> glebius@freebsd.org> wrote:
 |>> ...
 |>>>I think that /usr/src and /usr/ports as part of FreeBSD release
 |>>>distribution should just go away.  But we should provide a one liner
 |>>>command to get them in a proper way (shallow git checkout).
 |>>>
 |>
 |> Do you mean have the "install src" checkbox invoke git clone?
 |> That seems like a better idea, at least to me.
 |
 |I think we should replace the populate /usr/src from a tarball with....
 |populate it
 |with a tarball that represents a 1-deep checkout tree at the rev we built
 |the release
 |from. This lets users have the source, has minimal overhead and also lets
 |users update
 |or turn the shallow checkout into a deep one, etc. A shallow checkout is
 |quite a bit
 |less than a full tree, though still more than just the raw files. I've not
 |done poking to
 |see size comparisons.

What i do is having a "null" branch, which contains only one file
"NULL" which contains only the name of the master/xy branch.
Ie i can do (equivalent of) "git checkout $(cat NULL)" to get the
files populated, but can checkout that "null" branch to get rid of
myriads of files, and the majority of space consumption.
(Before someone complains again: i know about "bare" repositories,
but this is not what i want to have here.)

  #?0|kent:tmp$ cd /x/os/linux.git
  #?0|kent:linux.git$ du -sh .
  2.5G    .
  #?0|kent:linux.git$ find . -type f | wc -l
  52
  #?0|kent:linux.git$ ll
  total 4K
  -rw-r----- 1 steffen code   7 Mar 30  2020 NULL
  drwxr-s--T 1 steffen code  16 Mar 30  2020 ./
  drwsrws--T 1 root    code 746 Dec 28 19:10 ../
  drwxr-s--- 1 steffen code 178 Dec 28 19:13 .git/
  #?0|kent:linux.git$ cat NULL
  master

  #?0|kent:linux.git$ cd /usr/src/linux-6.1/
  #?0|kent:linux-6.1$ du -sh .
  1.4G    .
  #?0|kent:linux-6.1$ find . -type f | wc -l
  78710

(Often i then however do "alias.ar archive --format=3Dtar" aka
"git ar --prefix=3Dxy/ SOMECOMMIT| (cd TMPFS && tar -xf -)" instead
as most projects i track i only track out of interest, and if
i really need the files, then only temporary.  (Problem here is
that glibc build needs kernel checkout, and initially, without
overcommitting tmpfs /tmp with size=3D170% -- NVME swap! -- space
would have been insufficient for linux kernel compilation, too.))

Anyway, with such a thing all the many files are only a "git
checkout" away, while initially there is only the git object pack.
(And that can be --aggressive'ly packed to some large extend;
i have not done that for OSs for a year, but the exim MTA i newly
cloned from github a few weeks ago, for example, shrunk locally
from 80 megabytes to only twenty: the git objects, that is.)

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|
|In Fall and Winter, feel "The Dropbear Bard"s pint(er).
|
|The banded bear
|without a care,
|Banged on himself for e'er and e'er
|
|Farewell, dear collar bear



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20250122014300.izn3kEWi>