build: refactor PORTSLIST generation into shared list_ports() call

With five consumers this makes sense nowadays.  While here make the
distfiles fetch ignore PORT_IGNORE to download otherwise missing files
not found in the default flavour.
This commit is contained in:
Franco Fichtner 2021-10-15 14:58:53 +02:00
parent 1c7b8b26a0
commit 73ce4f6f23
6 changed files with 43 additions and 104 deletions

View File

@ -31,23 +31,7 @@ SELF=audit
. ./common.sh
if [ -z "${PORTSLIST}" ]; then
PORTSLIST=$(
cat ${CONFIGDIR}/ports.conf | while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
echo ${PORT_ORIGIN}
done
)
else
PORTSLIST=$(
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
)
fi
PORTSLIST=$(list_ports any ${CONFIGDIR}/aux.conf ${CONFIGDIR}/ports.conf)
setup_stage ${STAGEDIR}
setup_base ${STAGEDIR}

View File

@ -1204,3 +1204,39 @@ ${PLUGINSDIR}
mdconfig -d -u ${NODE} || true
done
}
list_ports()
{
local PORT_ANY=
if [ "${1}" = "any" ]; then
PORT_ANY=1
shift
fi
local PORT_CONFIGS=${@}
if [ -n "${PORTSLIST}" ]; then
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
return
fi
cat ${PORT_CONFIGS} | while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
if [ -n "${PORT_IGNORE}" -a -z "${PORT_ANY}" ]; then
for PORT_QUIRK in $(echo ${PORT_IGNORE} | tr ',' ' '); do
if [ ${PORT_QUIRK} = ${PRODUCT_TARGET} -o \
${PORT_QUIRK} = ${PRODUCT_ARCH} -o \
${PORT_QUIRK} = ${PRODUCT_FLAVOUR} ]; then
continue 2
fi
done
fi
echo ${PORT_ORIGIN}
done
}

View File

@ -31,32 +31,8 @@ SELF=distfiles
. ./common.sh
if [ -z "${PORTSLIST}" ]; then
PORTSLIST=$(
cat ${CONFIGDIR}/skim.conf ${CONFIGDIR}/aux.conf ${CONFIGDIR}/ports.conf | \
while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
if [ -n "${PORT_IGNORE}" ]; then
for PORT_QUIRK in $(echo ${PORT_IGNORE} | tr ',' ' '); do
if [ ${PORT_QUIRK} = ${PRODUCT_TARGET} -o \
${PORT_QUIRK} = ${PRODUCT_ARCH} ]; then
continue 2
fi
done
fi
echo ${PORT_ORIGIN}
done
)
else
PORTSLIST=$(
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
)
fi
PORTSLIST=$(list_ports any ${CONFIGDIR}/skim.conf ${CONFIGDIR}/aux.conf \
${CONFIGDIR}/ports.conf)
git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH
git_branch ${PORTSDIR} ${PORTSBRANCH} PORTSBRANCH

View File

@ -31,23 +31,7 @@ SELF=options
. ./common.sh
if [ -z "${PORTSLIST}" ]; then
PORTSLIST=$(
cat ${CONFIGDIR}/ports.conf | while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
echo ${PORT_ORIGIN}
done
)
else
PORTSLIST=$(
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
)
fi
PORTSLIST=$(list_ports ${CONFIGDIR}/aux.conf ${CONFIGDIR}/ports.conf)
git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH
git_branch ${PORTSDIR} ${PORTSBRANCH} PORTSBRANCH

View File

@ -63,32 +63,7 @@ if ! check_packages packages; then
PORTCONFIGS="${CONFIGDIR}/aux.conf ${PORTCONFIGS}"
fi
if [ -z "${PORTSLIST}" ]; then
PORTSLIST=$(
cat ${PORTCONFIGS} | while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
if [ -n "${PORT_IGNORE}" ]; then
for PORT_QUIRK in $(echo ${PORT_IGNORE} | tr ',' ' '); do
if [ ${PORT_QUIRK} = ${PRODUCT_TARGET} -o \
${PORT_QUIRK} = ${PRODUCT_ARCH} -o \
${PORT_QUIRK} = ${PRODUCT_FLAVOUR} ]; then
continue 2
fi
done
fi
echo ${PORT_ORIGIN}
done
)
else
PORTSLIST=$(
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
)
fi
PORTSLIST=$(list_ports ${PORTCONFIGS})
git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH
git_branch ${PORTSDIR} ${PORTSBRANCH} PORTSBRANCH

View File

@ -34,24 +34,8 @@ FROM=FreeBSD
setup_stage ${STAGEDIR}
if [ -z "${PORTSLIST}" ]; then
PORTSLIST=$(
cat ${CONFIGDIR}/skim.conf ${CONFIGDIR}/aux.conf ${CONFIGDIR}/ports.conf | \
while read PORT_ORIGIN PORT_IGNORE; do
eval PORT_ORIGIN=${PORT_ORIGIN}
if [ "$(echo ${PORT_ORIGIN} | colrm 2)" = "#" ]; then
continue
fi
echo ${PORT_ORIGIN}
done
)
else
PORTSLIST=$(
for PORT_ORIGIN in ${PORTSLIST}; do
echo ${PORT_ORIGIN}
done
)
fi
PORTSLIST=$(list_ports any ${CONFIGDIR}/skim.conf ${CONFIGDIR}/aux.conf \
${CONFIGDIR}/ports.conf)
DIFF="$(which colordiff 2> /dev/null || echo cat)"
LESS="less -R"