add ability to log qa checks

This commit is contained in:
Lukas Rusak 2022-06-28 12:44:17 -07:00
parent 81e0024688
commit 3fa587eb52
No known key found for this signature in database
GPG Key ID: 8C310C807E7393A3
4 changed files with 43 additions and 0 deletions

View File

@ -150,6 +150,33 @@ build_msg() {
fi
}
print_qa_checks() {
if [ -n "${PKG_NAME}" ]; then
if [ -d "${PKG_QA_CHECKS}" ]; then
for qa_check in ${PKG_QA_CHECKS}/*; do
print_color CLR_WARNING "[QA CHECK] [${PKG_NAME}] [$(basename ${qa_check})]:\n$(cat ${qa_check})\n\n"
done
fi
fi
}
log_qa_check() {
local qa_check_title="${1}"
local qa_check_message="${2}"
if [ -n "${qa_check_title}" -a -n "${qa_check_message}" ]; then
if [ -n "${PKG_NAME}" ]; then
print_color CLR_WARNING "[QA CHECK] [${PKG_NAME}] [${qa_check_title}]:\n${qa_check_message}\n"
mkdir -p "${PKG_QA_CHECKS}"
echo -e "${qa_check_message}" >> ${PKG_QA_CHECKS}/${qa_check_title}
else
print_color CLR_WARNING "[QA CHECK] [general] [${qa_check_title}]:\n${qa_check_message}\n"
mkdir -p "${BUILD}/qa_checks/general"
echo -e "${qa_check_message}" >> ${BUILD}/qa_checks/general/${qa_check_title}
fi
fi
}
# prints a warning if the file slated for removal doesn't exist
# this allows us to continue instead of bailing out with just "rm"
safe_remove() {
@ -1256,6 +1283,8 @@ source_package() {
elif [[ "${1}" =~ :init$ ]]; then
PKG_INSTALL="$BUILD/install_init/${PKG_NAME}-${PKG_VERSION}"
fi
PKG_QA_CHECKS="${BUILD}/qa_checks/${PKG_NAME}-${PKG_VERSION}"
fi
build_with_debug && BUILD_WITH_DEBUG="yes" || BUILD_WITH_DEBUG="no"

View File

@ -33,6 +33,12 @@ clean_package() {
fi
fi
done
for i in "${BUILD}/qa_checks/${1}-"*; do
build_msg "CLR_WARNING" "*" "$(print_color "CLR_WARNING_DIM" "Removing ${i} ...")"
rm -rf "${i}"
done
rm -f "${STAMPS}/${1}/build_"*
}

View File

@ -123,6 +123,7 @@ chmod +x ${FAKEROOT_SCRIPT} # make ${FAKEROOT_SCRIPT} executable
echo "chown -R 0:0 ${INSTALL}" >> ${FAKEROOT_SCRIPT}
# Clean old install dirs
rm -rf ${BUILD}/qa_checks/general
rm -rf ${INSTALL}
rm -rf ${STAMPS_INSTALL}
mkdir -p ${INSTALL}
@ -475,3 +476,8 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then
rm -rf ${RELEASE_DIR}
fi
fi
if [ -d "${BUILD}/qa_checks" -a -n "$(ls -1 ${BUILD}/qa_checks/)" ]; then
log_qa_check "qa_issues" "QA issues present, please fix!\n$(find ${BUILD}/qa_checks/* -type f ! -name qa_issues)\n"
fi

View File

@ -64,6 +64,8 @@ pkg_lock_status "ACTIVE" "${PKG_NAME}:${TARGET}" "install"
build_msg "CLR_INSTALL" "INSTALL" "${PKG_NAME} $(print_color CLR_TARGET "(${TARGET})")" "indent"
print_qa_checks
acquire_update_lock image
mkdir -p ${INSTALL}