How to get Ports in FreeBSD 14.1

Hi All,

What is the command when installing fresh base install of 14.1 do you use to get the Ports tree?

Or do you have to install a package first before getting the Ports tree on to a new install?

Kind of missed the boat a bit on recent discussions, and there seems to be a few third party packages that have been mentioned, but am looking for something in base userland...

Kr,
James
 
Its not in the handbook, but for a while gitup was suggested, but I'm not sure if it is in favour any more? It's working well for me instead of portsnap.

It is a lot lighter than full-blown git, so if you want to try it, pkg install gitup and then gitup ports (You may need to use the -C create flag the first time you use it.)
 
What way to go/tool to use may vary with what you want to do.

If you want to simply update ports tree and just patiently wait someone to fix once some problem happens, gitup or the way astyle noted on comment #8 should be your best friend.
This is so-called "shallow clone" without revision logs and so on.

If the above is insufficient, for example, when some problem happens, you want to bisect the problematic commit and try to fix/workaround, so-called "deep clone" is needed. This case, any flavor of git or got would be needed.
Regarding the amounts of documents on Internet, maybe git would be preferrable (some pages would assume full git to be used).
 
Many thanks to Astyle for the fetch from the FreeBSD cgit repository approach, was my thoughts too.

I just seems odd to me that a BSD licensed OS needs to have a third party app to install its own ports tree or source tree; Maybe I have been using FreeBSD for too many decades comming from SVN/portsnap historically.
 
Many thanks to Astyle for the fetch from the FreeBSD cgit repository approach, was my thoughts too.

I just seems odd to me that a BSD licensed OS needs to have a third party app to install its own ports tree or source tree; Maybe I have been using FreeBSD for too many decades comming from SVN/portsnap historically.
What still works:
Code:
ftp anonymous@ftp.freebsd.org
password <enter>
cd pub/freebsd/ports/ports
get ports.tar.gz
bye
The file appears to be from '22 but the UPDATING file inside is last modified at 12/11/2024 or later.
 
Assume one does an offline install of the ports tree from the DVD iso.

Is git smart enough to update the existing /usr/ports/ or will it blow it out start over?
As far as I experienced, no. I needed to clear out /usr/ports before starting.
This would be usually true for any kind of version control systems. The version control systems FreeBSD used prior to git (Subversion [svn] and CVS) had the same limitation, if I recall correctly.

If you already have something in /usr/ports/distdiles and/or /usr/ports/packages, you should better moving /usr/ports/distdiles and /usr/ports/packages to somewhere outside /usr/ports as a whole before clearling out, and move back after you git clone'ed ports repo These 2 directories are not managed by git (and other VCS'es prior to git).

And just for your info, I have the 2 directories mentioned above as separate datasets in ZFS pool. So I can simply unmount and remount when I cleared my local ports tree for switching from svn to git.
 
14.3

root@fs03:~ # fetch https://cgit.freebsd.org/ports/snapshot/ports-main.tar.gz
fetch: https://cgit.freebsd.org/ports/snapshot/ports-main.tar.gz: Bad Request
i think they had to disable the feature in their cgit or something.
we're not doing our best with regards to clarity ;-)

i remember i used to always fetch ports.tar.gz via ftp, maybe it's time to go back.

Is git smart enough to update the existing /usr/ports/ or will it blow it out start over?
I think it should work with a shallow clone --depth 1 or --single-branch or so. i need to try if i manage to even download a compressed set before I stop caring.
 
let's try


cd /usr ; wget -O- ftp2.de.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz | tar -xf -


ok you got working /usr/ports

to bring it under git control - discarding changes


git clone --depth 1 --no-checkout [URL]https://git.freebsd.org/ports.git[/URL] ports/ports.tmp &&
mv ports/ports.tmp/.git ports/ &&
rmdir ports/ports.tmp/ &&
cd ports && git reset --mixed HEAD


i'm no expert on dev workflows, but if you need to keep your changes you could try to git stash them prior to the reset, then branch and merge them back in. I suppose in that scenario you know better anyway.

I suppose it's only in some edge cases where this is much easier than to just rm -r the ports tree, i didn't try to check the download volume. but if you're on some faraway location, it can make sense to only copy the .git folder config and proceed like that.
 
let's try


cd /usr ; wget -O- ftp2.de.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz | tar -xf -


ok you got working /usr/ports

to bring it under git control - discarding changes


git clone --depth 1 --no-checkout [URL]https://git.freebsd.org/ports.git[/URL] ports/ports.tmp &&
mv ports/ports.tmp/.git ports/ &&
rmdir ports/ports.tmp/ &&
cd ports && git reset --mixed HEAD


i'm no expert on dev workflows, but if you need to keep your changes you could try to git stash them prior to the reset, then branch and merge them back in. I suppose in that scenario you know better anyway.

I suppose it's only in some edge cases where this is much easier than to just rm -r the ports tree, i didn't try to check the download volume. but if you're on some faraway location, it can make sense to only copy the .git folder config and proceed like that.
Ah... Since March of this year, .tar.gz tarballs are no longer available from the cgit mirror. I have to fetch a .zip from Github:
fetch https://github.com/freebsd/freebsd-ports/archive/refs/heads/main.zip

fetch and unzip are in FreeBSD base. As long as the .zip file is available at a valid URL, this should work.
 
Back
Top