build: basic implementation of aux packages; closes #299

It allows us to retain the "aux" packages for subsequent rebuilds.
These packages are inserted in the "ports" step and removed in the
"packages" step.

May be subject to changes and tweaks, but works nicely when e.g.
rebuilding suricata.
This commit is contained in:
Franco Fichtner 2024-02-08 14:46:47 +01:00
parent 55750d5678
commit a2fc40997f
5 changed files with 40 additions and 17 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2021 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2024 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -37,6 +37,10 @@ for ARG in ${@}; do
echo ">>> Removing arm image"
rm -f ${IMAGESDIR}/*-arm-${PRODUCT_ARCH}-${PRODUCT_DEVICE}.img*
;;
aux)
echo ">>> Removing aux set"
rm -f ${SETSDIR}/aux-*-${PRODUCT_ARCH}.*
;;
base)
echo ">>> Removing base set"
rm -f ${SETSDIR}/base-*-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.*
@ -84,8 +88,9 @@ for ARG in ${@}; do
rm -rf ${DIR}
done
;;
packages|ports)
echo ">>> Removing packages set"
packages)
echo ">>> Removing packages including aux set"
rm -f ${SETSDIR}/aux-*-${PRODUCT_ARCH}.*
rm -f ${SETSDIR}/packages-*-${PRODUCT_ARCH}.*
;;
plugins)
@ -97,6 +102,10 @@ for ARG in ${@}; do
bundle_packages ${STAGEDIR} '' plugins
fi
;;
ports)
echo ">>> Removing packages set"
rm -f ${SETSDIR}/packages-*-${PRODUCT_ARCH}.*
;;
release)
echo ">>> Removing release set"
rm -f ${SETSDIR}/release-*-${PRODUCT_ARCH}.tar

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2023 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2024 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2010-2011 Scott Ullrich <sullrich@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
@ -767,11 +767,8 @@ find_set()
kernel)
echo $(find ${SETSDIR} -name "kernel-*-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz")
;;
packages)
echo $(find ${SETSDIR} -name "packages-*-${PRODUCT_ARCH}.tar")
;;
release)
echo $(find ${SETSDIR} -name "release-*-${PRODUCT_ARCH}.tar")
aux|packages|release)
echo $(find ${SETSDIR} -name "${1}-*-${PRODUCT_ARCH}.tar")
;;
xtools)
echo $(find ${SETSDIR} -name "xtools-*-${PRODUCT_ARCH}.txz")
@ -1037,10 +1034,19 @@ bundle_packages()
echo ${SRCABI} > ${BASEDIR}${PACKAGESDIR}-new/.abi_hint
sh ./clean.sh packages
PACKAGEVER="${PRODUCT_VERSION}-${PRODUCT_ARCH}"
PACKAGESET="${SETSDIR}/packages-${PACKAGEVER}.tar"
AUXSET="${SETSDIR}/aux-${PACKAGEVER}.tar"
if [ -d ${BASEDIR}${PACKAGESDIR}-aux ]; then
sh ./clean.sh aux
echo -n ">>> Creating aux package set for ${PACKAGEVER}... "
tar -C ${BASEDIR}${PACKAGESDIR}-aux -cf ${AUXSET} .
echo "done"
fi
sh ./clean.sh ports
echo -n ">>> Creating package mirror set for ${PACKAGEVER}... "
tar -C ${BASEDIR}${PACKAGESDIR}-new -cf ${PACKAGESET} .
echo "done"

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2021-2022 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2021-2024 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -33,7 +33,7 @@ SELF=list
for ARG in ${*}; do
case ${ARG} in
base|distfiles|kernel|packages|release)
aux|base|distfiles|kernel|packages|release|xtools)
SET=$(find_set "${ARG}")
if [ -n "${SET}" ]; then
tar -tf ${SET}

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2019-2023 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2019-2024 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -48,9 +48,12 @@ for AUX in ${AUXLIST}; do
grep ^Origin | awk '{ print $3; }')
if [ "${AUX}" = "${PKGORIGIN}" ]; then
echo ">>> Removing auxiliary package ${AUX}" \
echo ">>> Moving auxiliary package ${AUX}" \
>> ${STAGEDIR}/.pkg-msg
rm -f ${STAGEDIR}/${PKG}
# XXX switch to packages directory layout
mkdir -p ${STAGEDIR}${PACKAGESDIR}-aux
mv ${STAGEDIR}/${PKG} ${STAGEDIR}${PACKAGESDIR}-aux
break;
fi
done

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2023 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2024 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -70,6 +70,11 @@ setup_chroot ${STAGEDIR}
setup_distfiles ${STAGEDIR}
if extract_packages ${STAGEDIR}; then
AUXSET=$(find_set aux)
if [ -f "${AUXSET}" ]; then
tar -C ${STAGEDIR}${PACKAGESDIR}/All -xpf ${AUXSET}
fi
if [ ${DEPEND} = "yes" ]; then
ARGS="${ARGS} ${PRODUCT_CORES} ${PRODUCT_PLUGINS}"
DEPS="plugins core"