Best way to create NanoBSD packages

I've been successfully installing ports when using NanoBSD (and prior using just pkg_add). It all works, but the problem is that it takes over two hours to compile all the ports (Xorg, Window Maker, chromium...) and I am continually rebuilding and testing.

My thoughts...
From a (semi provisional) development and consistency point of view, would it make sense to "freeze" the collection of currently used/working ports? Otherwise if I rebuild the image in a week, month, year it could complicate matters by using new, different ports that could break or disappear.

I guess I would like to know someone's opinion with a lot more experience of the most sensible way to approach this, is there a standard FreeBSD procedure? Perhaps even automated :)

Some concerns:
  1. Creating packages only builds that one port? Won't I have to build a package for every single port? Dependency hell?
  2. make.conf? I believe it will use the make.conf for the build machine and not the machine that I will run NanoBSD on. I assume I could build each package with an alternative make.conf?
  3. How would I collect information on ALL packages that will need to be installed at any one time. (I was thinking of making lots lists of all run/build dependences, removing duplicates and then building each one by hand? Seems like a headache).
  4. Building packages seems to be concerned with whats installed on the build machine. So isnt there a clash between what is/isn't installed on the build machine and the ports you wish to make packages of? Ending up with ports installed on the build machine I didn't want. Not being able to build packages of ports already installed?

Sorry for the long post. Any help would be greatly appreciated!
 
I wrote a script a while ago to help me do what you describe, but it sadly unearthed one annoying bug in the current package system that required too much hackery to work around for me to feel comfy publishing it. I'm hoping pkgng will change things.

It's a script that creates a chroot build environment, keeps a ports tree updated with portsnap, separates build dependencies from run dependencies, reads a config file for passing build options and custom configuration callbacks per port, caches package builds with versioning, and downloads package builds from FreeBSD upstream when ports are selected with no build options.

When it doesn't break, it saves a lot of time with my nanobsd upgrades/rebuilds. :p
 
There's also ports-mgmt/tinderbox but personally I'm not too fond of it. Setting it up is a royal PITA and I don't seem to be able to set the correct options for some ports.

In the end I ditched it and went back to what I've been doing the past decade or so, building packages in a jail by hand.
 
SirDice - I tried the suggestion regarding the jails, it works really well and seems to have solved all my problems!
  1. The jail allows you to mess with ports and change make.conf settings whilst not interfering with your happily working server (once you have got the jail going).
  2. You can add, remove or wipe ports as much as you want without messing with your build machines ports.
  3. You don't need a completely separate machine just for testing or compiling ports, the overhead of having a separate computer going (even a laptop) is huge compared to just running another terminal window. Plus wiping/installing an OS on a seperate machine is a lot more hassle than building a jail!
  4. Installing the packages now takes less than a minute, where before it was taking 2hrs+ :)
Portmaster -g seems to produce packages for only the ports I wanted plus their dependencies and not the build dependencies; Perfect! That saves me a lot of time locating and removing build dependencies.

Aragon - Have you tried using a jail and portmaster? I think it might also do what you needed if you didn't want to use the script you made.
 
ashleyd said:
Aragon - Have you tried using a jail and portmaster? I think it might also do what you needed if you didn't want to use the script you made.
I'm aware of portmaster. It doesn't do everything I need it to do.
 
Back
Top