unpack: prevent circular unpacking between two packages

In case two packages has dependency on each other unpacking fails because unpack script goes to loop and eats all the computer resources. With this change unpack fails on third pass.
Probably this functionality could be done better but atm I don't have better idea.

unpack recursive limit hit [package1, package2]
*********** FAILED COMMAND ***********
${SCRIPTS}/unpack "${p}" "${PARENT_PKG}"
**************************************
*********** FAILED COMMAND ***********
${SCRIPTS}/unpack "${p}" "${PARENT_PKG}"
**************************************
*********** FAILED COMMAND ***********
${SCRIPTS}/unpack "${PKG_NAME}" "${PARENT_PKG}"
**************************************
This commit is contained in:
Peter 2020-07-11 19:24:31 +02:00
parent 1d594750c5
commit 31a7bc75d6

View File

@ -20,9 +20,16 @@ pkg_lock "${PKG_NAME}" "unpack" "${PARENT_PKG}"
${SCRIPTS}/get "${PKG_NAME}"
if [ -n "${PKG_DEPENDS_UNPACK}" ]; then
export _unpack_recursive_cnt=$((_unpack_recursive_cnt+1))
if [ ${_unpack_recursive_cnt} -gt 2 ]; then
die "unpack recursive limit hit: ${PKG_DEPENDS_UNPACK}, ${PARENT_PKG}"
fi
for p in ${PKG_DEPENDS_UNPACK}; do
${SCRIPTS}/unpack "${p}" "${PARENT_PKG}"
done
unset _unpack_recursive_cnt
fi
STAMP="${PKG_BUILD}/.libreelec-unpack"