Files
Franco Fichtner 77f183c3c4 build: add RECIPE/patch support
With this we can make hotfixes much better visible, repeatable
and manageable.

makedist generates the RECIPE distribution file for later
use making sure to use the suffix, repeatable commit hash and
write-tree hash.  The package respositories will build upon
all of those when specifying RECIPE which makes checking the
version against tampering very easy.  Tree hash visibility
is also available in core and plugin components with

    # opnsense-version -T <core_or_plugin_name>

The dist file also has a way of enforcing that the content of the
conf file is valid by registering a hash of its content in dist.
It's true that every whitespace change will change the CONFDIGEST
but I also see no point in touching the recipe if it works.

Let the patch stage know which packages should be run through
the hotfix stage while adhering to RECIPE when building from
the authorative branch even though we may leave it due to the
modifications.  It also passes all the to be rebuilt packages
to the hotfix step at once, which may need more scrutiny later
on but should be fine now that we an also expand implicit ports
through hotfix.

The interesting aspects are that:

1. recipe/patch use is entirely optional even for hotfixes or
   full patch releases.
2. it uses the same infrastructure but makes the build repeatable
   which could also be published especially if commit and tree
   hashes are no longer matching what's in the stable branches.
3. it self-documents the used components even if we don't use
   the patch build and the dist file also records matching hashes
   of src, ports, plugins and core repositories.

While here remove old COREVERSION support because the RECIPE has
the same type of support and it was largely unused because it was
missing the right facility to be used from.

-devel rebuilds are a bit of a hit and miss but that was always
the case before.  In the average case offering the rebuild as
well is fine since without EXTRABRANCH=master we don't see these
packages and they are not rebuild.  If they are expected they use
the latest master branch state at the time of the build which is
also what should be the expected outcome.  In the latter case
one needs to remember to run the update target beforehand.  Most
things hotfixed also apply to the master branch wanting these
shipped as well.
2026-11-23 14:51:19 +01:00

48 lines
1.9 KiB
Bash

#!/bin/sh
# Copyright (c) 2026 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
TARGET=${1}
if [ -z "${RECIPE}" ]; then
echo "Cannot patch without a RECIPE"
exit 1
fi
# Run all known targets from the recipe if nothing else is specified.
# In case of noisy or long-running operations one may still want to
# skip some of the targets. This could end up with an inconsistent
# recipe build, but the user was likely knowing why the exception was
# ok. ;)
if [ -z "${TARGET}" ]; then
TARGET=$(echo ${PORTSPKG} ${PLUGINSPKG} ${COREPKG} | tr ' ' ',')
fi
make RECIPE=${RECIPE} hotfix-"${TARGET}"
make rename-aux,packages VERSION=${RECIPE}