Beeblebrox said:
3. When a client ends up building a port because it was missing on the intranet server, how then can the client send the downloaded distfile and built pkg to their respective directories? (http or ftp will require read/write access).
4. Here is the tougher problem: How should the directory structure be set up / managed on the server, considering that there will be 2 different architectures for the distfiles (386 + x64) and considering that the resulting pkg / binaries would also be in the same predicament? It seems the management of the pool should be left to a version tracker or something like it (lightweight solutions preferred).
For distfile caching, that's fairly easy - squid. If that's not good enough, you need to setup a distfile FTP mirror and configure it in your
/etc/make.conf. The latter is much more bandwidth hungry if you don't have enough machines that benefit from it. (same as APT mirrors)
As for caching package builds, I've been toying with this recently, but there are two hurdles I haven't crossed yet:
1. The ports system has some hackery in it to overcome a design shortfall of pkg_add's "-r" feature in that it does not follow dependencies recursively/hierarchically. Instead it relies on the port creating a complete, correctly ordered, single level deep dependency list for each port, and for some reason unknown if packages are built using "make package" this list isn't always created correctly, breaking pkg_add -r. Hard to explain without seeing it happen.
2. Handling i386/amd64 package differentiation is easy. That's already handled by pkg_add's "-r" feature. What's slightly complicated when you start building various custom systems is that when ports are built on a single system, they link to base libraries that are present on that build system, but which may or may not exist on your other systems. Classic example: Kerberos. If you build your systems with kerb disabled you probably would have noticed that some packages from official mirrors don't work. I don't think there is a reasonable fix for this though.
I have a really neat build tool that I use for i386 and amd64 package builds which fetches and updates packages from official mirrors if no custom build options are defined, builds locally otherwise, and caches the resulting pkgs locally for future runs (updates). I mostly use it for keeping my NanoBSD systems up to date at the moment. Not much point taking it further until (1) is resolved though. :/
If you've got some coding skills, there are some really cool things that can be done to improve FreeBSD's binary packaging system. Take a look at pkg_add source sometime...