2015-09-11 21:00:59 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-02-08 08:30:46 +01:00
|
|
|
# Copyright (c) 2015-2023 Franco Fichtner <franco@opnsense.org>
|
2015-09-11 21:00:59 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2016-05-05 17:11:45 +02:00
|
|
|
SELF=distfiles
|
|
|
|
|
2017-04-27 19:14:36 +02:00
|
|
|
. ./common.sh
|
2015-09-11 21:00:59 +02:00
|
|
|
|
2022-10-18 14:37:57 +02:00
|
|
|
PORTSLIST=$(list_packages "${PORTSLIST}" ${CONFIGDIR}/aux.conf ${CONFIGDIR}/ports.conf)
|
2015-09-11 22:18:34 +02:00
|
|
|
|
2017-01-11 07:31:06 +01:00
|
|
|
git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH
|
|
|
|
git_branch ${PORTSDIR} ${PORTSBRANCH} PORTSBRANCH
|
2021-09-09 13:09:54 +02:00
|
|
|
git_version ${PORTSDIR}
|
2016-12-23 16:27:48 +01:00
|
|
|
|
2015-11-17 20:50:49 +01:00
|
|
|
setup_stage ${STAGEDIR}
|
|
|
|
setup_base ${STAGEDIR}
|
|
|
|
setup_clone ${STAGEDIR} ${PORTSDIR}
|
|
|
|
setup_clone ${STAGEDIR} ${SRCDIR}
|
|
|
|
setup_chroot ${STAGEDIR}
|
2016-02-26 08:09:44 +01:00
|
|
|
setup_distfiles ${STAGEDIR}
|
2015-11-17 20:50:49 +01:00
|
|
|
|
2021-09-08 13:56:50 +02:00
|
|
|
extract_packages ${STAGEDIR} || true
|
|
|
|
|
2021-01-26 20:13:41 +01:00
|
|
|
sh ./make.conf.sh > ${STAGEDIR}/etc/make.conf
|
2016-02-26 08:09:44 +01:00
|
|
|
|
2021-01-26 20:13:41 +01:00
|
|
|
echo ">>> Fetching distfiles..."
|
|
|
|
|
2016-02-26 08:09:44 +01:00
|
|
|
# block SIGINT to allow for collecting port progress (use with care)
|
|
|
|
trap : 2
|
|
|
|
|
2021-06-24 09:04:48 +02:00
|
|
|
if ! ${ENV_FILTER} chroot ${STAGEDIR} /bin/sh -es << EOF; then PORTSLIST=; fi
|
2023-02-08 08:30:46 +01:00
|
|
|
MAKE_ARGS="
|
2021-09-08 13:56:50 +02:00
|
|
|
PACKAGES=${PACKAGESDIR}
|
2021-01-26 15:54:12 +01:00
|
|
|
PRODUCT_ABI=${PRODUCT_ABI}
|
2021-08-17 12:53:20 +02:00
|
|
|
TRYBROKEN=yes
|
2018-04-01 10:04:43 +02:00
|
|
|
UNAME_r=\$(freebsd-version)
|
2021-09-08 13:56:50 +02:00
|
|
|
USE_PACKAGE_DEPENDS=yes
|
2018-04-01 10:04:43 +02:00
|
|
|
"
|
2023-02-08 08:30:46 +01:00
|
|
|
echo "${PORTSLIST}" | while read PORT_ORIGIN; do
|
2015-11-17 20:50:49 +01:00
|
|
|
echo ">>> Fetching \${PORT_ORIGIN}..."
|
2023-02-08 08:30:46 +01:00
|
|
|
FLAVOR=\${PORT_ORIGIN##*@}
|
|
|
|
FLAVOR_ARG=
|
|
|
|
if [ "\${FLAVOR}" != "\${PORT_ORIGIN}" ]; then
|
|
|
|
FLAVOR_ARG="FLAVOR=\${FLAVOR}"
|
|
|
|
fi
|
2017-12-03 10:33:44 +01:00
|
|
|
PORT=\${PORT_ORIGIN%%@*}
|
2023-02-08 08:30:46 +01:00
|
|
|
make -C ${PORTSDIR}/\${PORT} fetch \${MAKE_ARGS} \${FLAVOR_ARG}
|
2017-12-03 10:33:44 +01:00
|
|
|
PORT_DEPENDS=\$(make -C ${PORTSDIR}/\${PORT} all-depends-list \
|
2018-04-01 10:04:43 +02:00
|
|
|
\${MAKE_ARGS})
|
2017-12-03 10:33:44 +01:00
|
|
|
for PORT_DEPEND in \${PORT_DEPENDS}; do
|
2023-02-08 08:30:46 +01:00
|
|
|
FLAVOR=\${PORT_DEPEND##*@}
|
|
|
|
FLAVOR_ARG=
|
|
|
|
if [ "\${FLAVOR}" != "\${PORT_DEPEND}" ]; then
|
|
|
|
FLAVOR_ARG="FLAVOR=\${FLAVOR}"
|
|
|
|
fi
|
|
|
|
PORT=\${PORT_DEPEND%%@*}
|
|
|
|
make -C \${PORT} fetch \${MAKE_ARGS} \${FLAVOR_ARG}
|
2017-12-03 10:33:44 +01:00
|
|
|
done
|
2015-09-11 21:00:59 +02:00
|
|
|
done
|
2015-11-17 20:50:49 +01:00
|
|
|
EOF
|
|
|
|
|
2016-02-26 08:09:44 +01:00
|
|
|
# unblock SIGINT
|
|
|
|
trap - 2
|
|
|
|
|
2016-05-21 12:03:11 +02:00
|
|
|
sh ./clean.sh ${SELF}
|
2015-09-11 22:18:34 +02:00
|
|
|
|
|
|
|
echo -n ">>> Creating distfiles set... "
|
2015-11-17 20:50:49 +01:00
|
|
|
tar -C ${STAGEDIR}${PORTSDIR} -cf \
|
2021-09-06 12:10:47 +02:00
|
|
|
${SETSDIR}/distfiles-${PRODUCT_VERSION}.tar distfiles
|
2015-09-11 22:18:34 +02:00
|
|
|
echo "done"
|
2016-02-26 08:09:44 +01:00
|
|
|
|
2021-06-24 09:04:48 +02:00
|
|
|
if [ -z "${PORTSLIST}" ]; then
|
2016-02-26 08:09:44 +01:00
|
|
|
echo ">>> The distfiles fetch did not finish properly :("
|
|
|
|
exit 1
|
|
|
|
fi
|