X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=grml-live;h=b14320b8b8f6fa032a7a9613aa6c76e63c067a19;hp=3c1549789baf2da0881e34d6ba12b1b097532c0e;hb=a31a8fd15c71a46658aff10f16e68ac7f7593acb;hpb=be73298f82e780a3e523756a96f67651f499c310 diff --git a/grml-live b/grml-live index 3c15497..b14320b 100755 --- a/grml-live +++ b/grml-live @@ -360,6 +360,7 @@ shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter [ -n "$CHROOT_ARCHIVE" ] || CHROOT_ARCHIVE="$OUTPUT/$(basename $CHROOT_OUTPUT).tgz" [ -n "$ISO_OUTPUT" ] || ISO_OUTPUT="$OUTPUT/grml_isos" [ -n "$LOG_OUTPUT" ] || LOG_OUTPUT="$OUTPUT/grml_logs" +[ -n "$REPORTS" ] || REPORTS="${LOG_OUTPUT}/reports/" # }}} # some misc checks before executing FAI {{{ @@ -696,20 +697,78 @@ fi # BUILD_DIRTY? # package validator {{{ CHECKLOG=/var/log/fai/$HOSTNAME/last -# package validator -if [ -r "$CHECKLOG/package_errors.log" ] && grep -q '[a-z]' "$CHECKLOG/package_errors.log" ; then +if [ -r "$CHECKLOG/dpkg.selections" ] ; then + package_count=$(wc -l "$CHECKLOG/dpkg.selections" | awk '{print $1}') +else + package_count="unknown" +fi - if [ -n "$EXIT_ON_MISSING_PACKAGES" -a -z "$BUILD_DIRTY" ] ; then - eerror "The following packages were requested for installation but could not be processed:" - cat $CHECKLOG/package_errors.log - eerror "... exiting as requested via \$EXIT_ON_MISSING_PACKAGES." - eend 1 - bailout 13 - else - ewarn "The following packages were requested for installation but could not be processed:" - cat $CHECKLOG/package_errors.log - eend 0 - fi +mkdir -p "$REPORTS" +REPORT_MISSING_PACKAGES="${REPORTS}/TEST-MissingPackages.xml" + +# check for missing packages +if ! [ -s "$CHECKLOG/package_errors.log" ] ; then + einfo "No missing packages found, generating empty junit report." + + cat > "${REPORT_MISSING_PACKAGES}" << EOF + + + + + + + + + +EOF + eend 0 +else + einfo "Missing packages found, generating junit report." + + if [ -r "$CHECKLOG/package_errors.log" ] ; then + package_errors=$(wc -l "$CHECKLOG/package_errors.log" | awk '{print $1}') + else + package_errors="unknown" + fi + + mkdir -p "$REPORTS" + REPORT_MISSING_PACKAGES="${REPORTS}/TEST-MissingPackages.xml" + + cat > "${REPORT_MISSING_PACKAGES}" << EOF + + +EOF + + for package in $(awk '{print $5}' "${CHECKLOG}/package_errors.log" | sed 's/\.$//') ; do + cat >> "${REPORT_MISSING_PACKAGES}" << EOF + + +Package $package is missing in chroot + + +EOF + done + + cat >> "${REPORT_MISSING_PACKAGES}" << EOF + + + + + +EOF + eend 0 + + if [ -n "$EXIT_ON_MISSING_PACKAGES" -a -z "$BUILD_DIRTY" ] ; then + eerror "The following packages were requested for installation but could not be processed:" + cat "$CHECKLOG/package_errors.log" + eerror "... exiting as requested via \$EXIT_ON_MISSING_PACKAGES." + eend 1 + bailout 13 + else + ewarn "The following packages were requested for installation but could not be processed:" + cat "$CHECKLOG/package_errors.log" + eend 0 + fi fi # }}}