OPNsense Forum

English Forums => Development and Code Review => Topic started by: interfaSys on March 11, 2016, 11:02:17 am

Title: [SOLVED] Use local ports tree instead or packages from mirror when building core
Post by: interfaSys on March 11, 2016, 11:02:17 am
The current process to build and install core, as I understand it is as follows:


make core does this:


For people using `opnsense/ports` to compile all their ports, there are a few problems:


If the only reason packages are downloaded and unpacked to build core is to update contrib, then only those packages should be used.
Those packages don't even need to be compiled, they're already installed and the needed files can be fetched from the filesystem. pkg info can tell the script if the version is what is expected.

Am I correct and the whole process can be simplified for people using the ports tree?
Title: Re: Use local ports tree instead or packages from mirror when building core
Post by: franco on March 11, 2016, 11:28:05 am
Quote
Am I correct and the whole process can be simplified for people using the ports tree?

I am not sure I understand this question. Can you elaborate?

tools.git is for building from scratch, not for providing incremental updates of core for a running system. It does things the way it does in order to verify the full integrity of the build, so core e.g. depends on installing all the currently needed ports from the set and doing it in a totally clean jail to avoid taint.

I think what you are looking for is an in-place build of core.git which yields a package when run on OPNsense itself. Is this correct?

If so, there are quite a few possibilities for simplification... On your box, you can run this:

# pkg install git gettext-tools
# cd /usr/core
# make DESTDIR=/tmp/core-pkg FLAVOUR=OpenSSL install
# make DESTDIR=/tmp/core-pkg scripts
# make DESTDIR=/tmp/core-pkg manifest > /tmp/core-pkg/+MANIFEST
# make DESTDIR=/tmp/core-pkg plist > /tmp/core-pkg/plist
# pkg create -m /tmp/core-pkg -r /tmp/core-pkg -p /tmp/core-pkg/plist
# rm -r /tmp/core-pkg
# ls *.txz
# pkg add -f ...

:)
Title: Re: Use local ports tree instead or packages from mirror when building core
Post by: franco on March 11, 2016, 11:53:17 am
I've added it as a simple target... FLAVOUR needs to be set if not OpenSSL and packages "git" and "gettext-tools" must be installed in order to create the package.

# make package

Also see: https://github.com/opnsense/core/commit/445504da33c16ca4253023e6a1fdebd517a3bb61
Title: Re: Use local ports tree instead or packages from mirror when building core
Post by: interfaSys on March 11, 2016, 11:53:53 am
That worked perfectly, thanks.

So for each release, someone who wants to compile ports using the the opnsense ports tree would simply need to


Easier than using make-core in /usr/tools :)



Title: Re: Use local ports tree instead or packages from mirror when building core
Post by: interfaSys on March 11, 2016, 11:55:39 am
And thanks for the new target, even easier for users than having to add a script.
Title: Re: [SOLVED] Use local ports tree instead or packages from mirror when building core
Post by: franco on March 11, 2016, 11:58:45 am
Ok, now I see. Yes, your environment is now the native build environment for the core package and you don't have to jump through any other hoops. That makes perfect sense. Thanks for the explanations and prodding. :)
Title: Re: [SOLVED] Use local ports tree instead or packages from mirror when building core
Post by: franco on March 12, 2016, 10:25:19 am
There will also be an upgrade target, that should be as far as we could possibly go ;)

# make upgrade
Title: Re: [SOLVED] Use local ports tree instead or packages from mirror when building core
Post by: interfaSys on March 12, 2016, 10:44:24 am
Awesome, thanks :)