(I've never had occasion to use git.)
After installing git,
1) What should I read to learn how to "check out" (obtain) the source
for some particular piece of software from git.freebsd.org?
2) When the code is part of a larger work, such as one particular X11
driver, will I ultimately have to build all of X11 just to build the
one driver, or can I build just the driver using the
already-installed X11 include files and libraries?
3) Do the source files obtained by git normally go in /usr/ports/, or
does location not matter?
(I've never had occasion to use git.)
That's fine. You don't seem to be a developer, so I don't see why you
would have.
Check out the "Running Git" chapter of the appendices to the FreeBSD Handbook.
So you want to build a particular port locally, and you have other
ports already installed by some other means, such as pkg.
You absolutely do not need to rebuild everything you already have
installed;
3) Do the source files obtained by git normally go in /usr/ports/, or
does location not matter?
If you are checking out the ports tree, they will normally go in
/usr/ports, but you can put them anywhere you want.
If you put it elsewhere you may need to set the PORTSDIR variable
(defined in ${PORTSDIR}/Mk/bsd.port.mk) when working with that tree.
If you already have something in /usr/ports, such as from portsnap,
then consider using the same method to do your upgrades. If not, you
might as well go ahead and put your new ports tree there.
My guess is that you want to compile a driver with options different
than the ones that the standard pkg repositories use.
but bear in
mind that your system may still need to build a lot of other things first
-- things that are not needed to run the driver, but are needed to build
it.
On 2023-12-27, DaveG <nospam@nospam.net> wrote:
If the above is true, I'd recommend using portsnap to make sure the ports
tree is up to date first, then use portinstall (alias of portupgrade) with
From the 14.0 release notes:
The portsnap(8) utility has been removed. Users are encouraged
to fetch the ports tree by using pkg install git and then git
clone https://git.FreeBSD.org/ports.git /usr/ports.
If the above is true, I'd recommend using portsnap to make sure the ports tree is up to date first, then use portinstall (alias of portupgrade) with
In article <slrnuop661.12lk.naddy@lorvorc.mips.inka.de>
Christian Weisgerber <naddy@mips.inka.de> writes:
On 2023-12-27, DaveG <nospam@nospam.net> wrote:
If the above is true, I'd recommend using portsnap to make sure the
ports tree is up to date first, then use portinstall (alias of
portupgrade) with
From the 14.0 release notes:
The portsnap(8) utility has been removed. Users are encouraged to
fetch the ports tree by using pkg install git and then git clone
https://git.FreeBSD.org/ports.git /usr/ports.
Thanks for that. I'd heard there was a change, but wash't sure of the practical details.
So is 'portsnap fetch update' now just 'cd /usr/ports ; git pull'?
(Still waiting for 14.1 to make the switch.)
In article <slrnuop661.12lk.naddy@lorvorc.mips.inka.de>
Christian Weisgerber <naddy@mips.inka.de> writes:
On 2023-12-27, DaveG <nospam@nospam.net> wrote:
If the above is true, I'd recommend using portsnap to make sure the ports >>> tree is up to date first, then use portinstall (alias of portupgrade) with >>From the 14.0 release notes:
The portsnap(8) utility has been removed. Users are encouraged
to fetch the ports tree by using pkg install git and then git
clone https://git.FreeBSD.org/ports.git /usr/ports.
Thanks for that. I'd heard there was a change, but wash't sure of
the practical details.
So is 'portsnap fetch update' now just 'cd /usr/ports ; git pull'?
(Still waiting for 14.1 to make the switch.)
On Dec 27, 2023 at 5:03:35 PM CST, "Drew Lawson" <Drew Lawson> wrote:
In article <slrnuop661.12lk.naddy@lorvorc.mips.inka.de>
Christian Weisgerber <naddy@mips.inka.de> writes:
On 2023-12-27, DaveG <nospam@nospam.net> wrote:
If the above is true, I'd recommend using portsnap to make sure the ports >>>> tree is up to date first, then use portinstall (alias of portupgrade) with >>>From the 14.0 release notes:
The portsnap(8) utility has been removed. Users are encouraged
to fetch the ports tree by using pkg install git and then git
clone https://git.FreeBSD.org/ports.git /usr/ports.
Thanks for that. I'd heard there was a change, but wash't sure of
the practical details.
So is 'portsnap fetch update' now just 'cd /usr/ports ; git pull'?
(Still waiting for 14.1 to make the switch.)
Everything I've read claims the procedure is 'git pull' inside the /usr/src/ directory once you've checked it out, but even though I don't make any changes, I always get this error:
error: Your local changes to the following files would be overwritten by merge
UPDATING
contrib/tzdata/CONTRIBUTING
contrib/tzdata/Makefile
...
Not sure if packages or OS updates touch /usr/src, or if things get touched enough during certain builds, but every time I have tried to do a 'git pull' I
get that error. Not sure it is the 'right' way, but I've been doing 'git pull --autostash' to deal with that.
On 2023-12-27, DaveG <nospam@nospam.net> wrote:
If the above is true, I'd recommend using portsnap to make sure the ports
tree is up to date first, then use portinstall (alias of portupgrade) with
From the 14.0 release notes:
The portsnap(8) utility has been removed. Users are encouraged
to fetch the ports tree by using pkg install git and then git
clone https://git.FreeBSD.org/ports.git /usr/ports.
On Dec 27, 2023 at 5:03:35 PM CST, "Drew Lawson" <Drew Lawson> wrote:
So is 'portsnap fetch update' now just 'cd /usr/ports ; git pull'?
(Still waiting for 14.1 to make the switch.)
Everything I've read claims the procedure is 'git pull' inside the /usr/src/ directory once you've checked it out, but even though I don't make any changes, I always get this error:
error: Your local changes to the following files would be overwritten by merge
UPDATING
contrib/tzdata/CONTRIBUTING
contrib/tzdata/Makefile
...
Not sure if packages or OS updates touch /usr/src, or if things get touched enough during certain builds, but every time I have tried to do a 'git pull' I
get that error. Not sure it is the 'right' way, but I've been doing 'git pull --autostash' to deal with that.
Den 2023-12-28 skrev Jesse Rehmer <jesse.rehmer@blueworldhosting.com>:
On Dec 27, 2023 at 5:03:35 PM CST, "Drew Lawson" <Drew Lawson> wrote:
So is 'portsnap fetch update' now just 'cd /usr/ports ; git pull'?
(Still waiting for 14.1 to make the switch.)
Everything I've read claims the procedure is 'git pull' inside the /usr/src/ >> directory once you've checked it out, but even though I don't make any
changes, I always get this error:
error: Your local changes to the following files would be overwritten by merge
UPDATING
contrib/tzdata/CONTRIBUTING
contrib/tzdata/Makefile
...
Not sure if packages or OS updates touch /usr/src, or if things get touched >> enough during certain builds, but every time I have tried to do a 'git pull' I
get that error. Not sure it is the 'right' way, but I've been doing 'git pull
--autostash' to deal with that.
Something has caused non-commited changes in your repository. If you
run freebsd-update without excluding /usr/ports and /usr/src, that can happen.
There are two ways I usually deal with that type of conflict. First is
to do
git reset --hard
git pull
to discard local uncommited changes and update. If I have local
commits I also want to get rid of, I do
git fetch
git reset --hard origin/$insert_branch_name
and any local commit I have added on my branch is also discarded. If I
have local commited changes that I want to keep, I usually do
git pull --rebase
with --rebase lifting my commits and trying to apply them on top of
the latest upstream commit. This can result in conflicts that need to
be worked out.
3) Do the source files obtained by git normally go in /usr/ports/,
or does location not matter?
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.
You absolutely do not need to rebuild everything you already have
installed;
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.
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 <lgusenet@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.
"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.
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.
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?
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.
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.
* 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.
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.
... 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
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?
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
ISTM that there ought to be a way to get a copy of a subset directly
from the remote repository.
* 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.
As an alternative to git, I tried visiting the FreeBSD repository files
with a browser.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 43:52:30 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,952 |