Build binary packages without install

Hello,

How can I create a binary package (.pkg) from a port but without installing the port?

This is my scenario:

  • I have ten boxes (servers) running FreeBSD
  • I have one computer where I compile all the ports for the boxes use. I need to create in this computer the binary packages of those ports and then install them on the ten boxes.

A second question: how can I check if a port needs an update (re-compile and re-install) if I don't have that port installed?

Thanks!
 
cahimira said:
How can I create a binary package (.pkg) from a port but without installing the port?
I can't answer that, but what I can do is share how I'm addressing my current scenario which is comparable to yours.

cahimira said:
  • I have 10 boxes (servers) running FreeBSD
  • I have one computer where I compile all the ports for the boxes use. I need to create in this computer the binary packages of those ports and then install them on the 10 boxes.
I'm currently maintaining four FreeBSD servers where my scenario is comparable to yours: they all use the same ports (with the sole exception of my main server which has a few extra ports installed due to personal and/or hobby interests).

I'm currently in the process of building and tuning a custom made solution for this and right now I'm simply building all the updates on a backup server using portmaster which I instruct to not only update (install) the new ports but also to create binary packages out of them (using the -g parameter). When the build process succeeds without problems I usually test the updated environment package against my configuration (if applicable) after which I provide the binary packages to the rest of the network.

On those servers I too use portmaster to update the ports but simply tell it that it should use packages but if that somehow fails also fall back to the regular process of manually building (using the -P parameter).

The main reason for that is that I also came to realize that in some cases the time advantage can be a bit overrated. Meaning: during the build process the services continue to be operational, only during the moment of actually (re)installing the new port will the services become unavailable for a short moment.

And well, the actual risk of a port not building is something I will already have addressed during this stage, simply because all my servers share the same environment (I'm pretty sure that if a port builds on my backup server it will also build on the rest of the network).

cahimira said:
A second question: how can I check if a port needs an update (re-compile and re-install) if I don't have that port installed?
You could run # make package-name from the port directory or check its Makefile, then compare the shown version with the one which is being used.

Even so, I think the better approach is to use a server which environment is identical to the rest of the network. Not merely due to ease of use (no need to manually check for versions or perform cryptical build processes; just let portsnap and portmaster sort it all out) but also because this "provisioning server" could then also be used to test the updates in a semi-real environment before you push them onto the rest of the network.

I'd always test updates before distribution.
 
There's no practical way to build a package without actually installing the port. The reason is that detection of dependencies is based on checking for existence of files and directories in the target file/directory hierarchy. Also it's expected that the target hierarchy contains the "real deal" when linking in shared and static libraries.

However, you can build the packages in a jail(8) using for example ports-mgmt/poudriere so that the all the building of packages is contained in the jail and the host system can be kept as clean as possible. See my HOWTO here:

http://forums.freebsd.org/showthread.php?t=38859
 
Back
Top