echo "No $target/${PACKAGE_LIST} found, will not run package validation check."
else
printf "Validating package list: "
- if $ROOTCMD dpkg --list $(grep -v '^#' $target/${PACKAGE_LIST} | grep -v -- '-$') >/dev/null 2>$LOGDIR/package_errors.log ; then
- printf "done - no errors found\n"
- else
+ TMPFILE=$(mktemp)
+
+ $ROOTCMD dpkg --list $(grep -v '^#' $target/${PACKAGE_LIST} | grep -v -- '-$') 2>&1 | \
+ grep -e '^un' -e 'No packages' > "$TMPFILE" || true
+
+ awk '/^un/ {print $2 " not_installable"}' "$TMPFILE" > "$LOGDIR/package_errors.log"
+ awk '/^No packages found matching/ {print $5 " not_available"}' "$TMPFILE" | \
+ sed 's/\. / /' >> "$LOGDIR/package_errors.log"
+
+ if [ -s "$TMPFILE" ] ; then
printf "failed (there have been errors, find them at $LOGDIR/package_errors.log)\n"
+ else
+ printf "done - no errors found\n"
fi
+
+ rm -f "$TMPFILE"
fi
## END OF FILE #################################################################
<testsuite name="grml-live-missing-packages" tests="${package_count}" time="1" failures="${package_errors}" errors="${package_errors}" skipped="0" assertions="0">
EOF
- for package in $(awk '{print $5}' "${CHECKLOG}/package_errors.log" | sed 's/\.$//') ; do
+ for package in $(awk '{print $1}' "${CHECKLOG}/package_errors.log") ; do
+ failure_reason="$(awk "/$package/ {print \$2}" "${CHECKLOG}/package_errors.log")"
cat >> "${REPORT_MISSING_PACKAGES}" << EOF
<testcase name="test_missing_packages_${package}" time="0" assertions="0">
- <failure type="RuntimeError" message="Package ${package} is missing">
-Package $package is missing in chroot
+ <failure type="${failure_reason}" message="Package ${package} is missing">
+Package $package is missing in chroot (${failure_reason})
</failure>
</testcase>
EOF