build/clone: add new helper

This commit is contained in:
Franco Fichtner 2021-01-18 11:50:37 +01:00
parent 08851a5531
commit c3f66077b4
4 changed files with 97 additions and 19 deletions

View File

@ -23,10 +23,11 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
STEPS= arm base boot chroot clean compress confirm core distfiles \
download dvd fingerprint info kernel nano packages plugins \
ports prefetch print rebase release rename rewind serial sign \
skim test update upload verify vga vm xtools
STEPS= arm base boot chroot clean clone compress confirm core \
distfiles download dvd fingerprint info kernel nano \
packages plugins ports prefetch print rebase release \
rename rewind serial sign skim test update upload verify \
vga vm xtools
SCRIPTS= batch hotfix nightly
.PHONY: ${STEPS} ${SCRIPTS} make.conf

View File

@ -225,19 +225,25 @@ works:
Please note that reissuing ports builds will clear plugins and
core progress.
Acquiring precompiled sets from the mirrors
-------------------------------------------
Acquiring precompiled sets from the mirrors or another local direcory
---------------------------------------------------------------------
Compiled sets can be prefetched from a mirror if they exist,
while removing any previously available set:
# make prefetch-<option>[,...] [VERSION=version.to.prefetch]
# make prefetch-<option>[,...] [VERSION=<full_version>]
Available prefetch options are:
If another build configuration is used locally that is compatible,
the sets can be cloned from there as well:
* base: prefetch the base set
* kernel: prefetch the kernel set
* packages: prefetch the packages set
# make clone-<option>[,...] TO=<major_version>
Available prefetch or clone options are:
* base: select matching base set
* distfiles: select matching distfiles set (clone only)
* kernel: select matching kernel set
* packages: select matching packages set
Using signatures to verify integrity
------------------------------------

78
build/clone.sh Normal file
View File

@ -0,0 +1,78 @@
#!/bin/sh
# Copyright (c) 2021 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
SELF=clone
. ./common.sh
if [ -z "${TO}" ]; then
echo ">>> Missing target, please set TO=xx.x"
exit 1
fi
if [ ${TO} = ${PRODUCT_ABI} ]; then
echo ">>> Wrong target, please correct TO=xx.x"
exit 1
fi
for ARG in ${@}; do
case ${ARG} in
base|kernel)
SRC=$(find ${SETSDIR} -name "${ARG}-*.txz")
if [ -f "${SRC}" ]; then
DST=$(echo ${SRC} | sed "s:/${PRODUCT_ABI}/:/${TO}/:")
echo -n ">>> Cloning ${DST}... "
rm -f $(dirname ${DST})/${ARG}-*.txz*
cp ${SRC} ${DST}
echo "done"
fi
;;
distfiles)
SRC=$(find ${SETSDIR} -name "${ARG}-*.tar")
DST=$(echo ${SRC} | sed "s:/${PRODUCT_ABI}/:/${TO}/:")
if [ -f "${SRC}" ]; then
echo -n ">>> Cloning ${DST}... "
rm -f $(dirname ${DST})/${ARG}-*.tar*
cp ${SRC} ${DST}
echo "done"
fi
;;
packages)
SRC=$(find ${SETSDIR} -name "${ARG}-*-${PRODUCT_FLAVOUR}-*.tar")
DST=$(echo ${SRC} | sed "s:/${PRODUCT_ABI}/:/${TO}/:")
if [ -f "${SRC}" ]; then
echo -n ">>> Cloning ${DST}... "
rm -f $(dirname ${DST})/${ARG}-*-${PRODUCT_FLVOUR}-*.tar*
cp ${SRC} ${DST}
echo "done"
fi
;;
esac
done

View File

@ -41,20 +41,13 @@ fi
for ARG in ${@}; do
case ${ARG} in
base)
base|kernel)
sh ./clean.sh ${ARG}
URL="${MIRRORSETDIR}/${ARG}-${VERSION}-${PRODUCT_ARCH}"
for SUFFIX in txz.sig txz; do
fetch -o ${SETSDIR} ${URL}.${SUFFIX} || true
done
;;
kernel)
sh ./clean.sh kernel
URL="${MIRRORSETDIR}/${ARG}-${VERSION}-${PRODUCT_ARCH}"
for SUFFIX in txz.sig txz; do
fetch -o ${SETSDIR} ${URL}.${SUFFIX} || true
done
;;
packages)
sh ./clean.sh ${ARG}
URL="${MIRRORSETDIR}/${ARG}-${VERSION}-${PRODUCT_FLAVOUR}-${PRODUCT_ARCH}"