Winston <w...@UBEBLOCK.psr.com.invalid> writes:
> Re: observed result regarding git and /usr/ports
>
> I asked:
>>>> 3) Do the source files obtained by git normally go in /usr/ports/,
>>>> or does location not matter?
>
> to which Lowell Gilbert <
lgus...@be-well.ilk.org> kindly replied (in part):
>>> If you already have something in /usr/ports, such as from portsnap,
>
>> Exactly, [... What I currently have in /usr/ports is] portsnap content
>> from years ago.
That's completely useless to you at this point. Might as well wipe it out.
> "git clone ..." complains when /usr/ports isn't empty, so any portsnap
> content already there is apparently incompatible with "git clone"'s
> results being put in /usr/ports. OK.
I'd recommend clearing that out and putting it there, which will
slightly simplify the procedure.
> Re: using git to obtain and build specific pieces
>
>>> You absolutely do not need to rebuild everything you already have
>>> installed;
>
> to which I replied:
>> Yay! IIRC (from several years ago), portsnap seemed to want to pull in
>> every other dependency and rebuild it, too, which I sometimes was
>> willing to let it do, but I prefer not to mix pkg and ports things on a
>> system.
Ports from git won't normally do that, but neither would portsnap. They
are different ways to download the tree, but how the tree works once you
have it will be the same as far as I can recall.
> Here's where I'd like advice from those of you who know more about git.
>
> * Do I have to have a local clone of the remote repository to be able to
> obtain the individual parts?
No, but it will be a lot less work. For one thing I can think of
offhand, you will have to go back to fill in missing dependencies one at
a time.
> I'd prefer not have to clone gigabytes worth of the /usr/ports and
> /usr/src repositories just to obtain and build one program or piece.
>
> Doing:
> git clone --sparse --depth 1 --single-branch \
>
https://git.freebsd.org/ports.git /usr/ports
>
> is fine and fairly small. I did that (mistakenly) thinking that
> git-sparse-checkout could then be used to expand the tree down to the
> piece I wanted, but after actually reading the man page for
> git-sparse-checkout, it appears that's not what it does.
Hmm. It looks to me like it can do that, but it isn't
straightforward. You might try
git sparse-checkout set <desired subtree>
Perhaps more importantly to you, a sparse checkout downloads almost
exactly the same amount of data that it would without using --sparse;
the difference is what it puts into the working tree. For the ports
tree, that is slightly under one gigabyte, and it sounds to me as though
you have already done that.
> ISTM that there ought to be a way to get a copy of a subset directly
> from the remote repository. The man page for the most likely command,
> "git checkout", however, talks about saving and restoring a work area
> to/from multiple branches (which maybe doesn't apply if
> --single-branch?) etc., which would seem (on casual reading) to require
> a local repository.
git is a distributed RCS. You are probably accustomed to client/server
version control, where most operations go back to the remote server.
> * Is there some not-too-painful way to do what I'm trying to do: obtain
> enough of just the parts I'm interested in to be able to make local
> changes and build the result against the existing, installed header
> files and libraries? I don't need to be able to upload the changes or
> make commits to the remote repositories (which I'm not authorized to
> do anyway), so part of what git does regarding branches and merging
> isn't relevant. If git just reports which version it obtained (for
> reference), I should be fine.
Depends on your personal tolerance for different kinds of pain, I
suppose. Downloading the database of the whole default branch of the
ports tree with git takes about a minute at 100 megabits per second, and
checking the objects out once they're downloaded will take much longer
than that. In typical usage, It's all one operation from the command
line, of course.
For version numbers, remember (again) that the model is
distributed. There is no monotonically increasing version value you can
apply, because there's no single master location to assign it.
> As an alternative to git, I tried visiting the FreeBSD repository files
> with a browser. Clicking down to the pieces I want is easy, but that
> doesn't give me C code for file foo.c: it comes with HTML wrapping that
> formats and numbers every line of the code. Removing all that wrapping
> to get something compilable would be a pain.
AS best I recall, there is more than one web interface to the ports
collection, but most likely you're looking at cgit, which has a link on
each leaf page labelled "(plain)"; see it next to the blob hash at, for
example:
https://cgit.freebsd.org/ports/tree/x11-drivers/xf86-video-voodoo/Makefile