From ca86de6922e89b6fbc7ec40d14fc04b7a5adac64 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 30 Jan 2025 17:50:52 +0100 Subject: [PATCH] Drop support for package_errors.log + EXIT_ON_MISSING_PACKAGES This was unreliable already within FAI, esp. when aborting and rerunning a build. Now with the switch from FAI to our minifai, we no longer support EXIT_ON_MISSING_PACKAGES. Minifai operates per class and aborts on any package installation that fails. There's no point in generating package_errors.log and TEST-MissingPackages.xml (meant for inclusion in e.g. Jenkins jobs), so drop config/scripts/GRMLBASE/01-packages overall, and related code from grml-live and setting in etc/grml/grml-live.conf. While at it, drop unused $VERBOSE, as complained by shellcheck. Closes: grml/grml-live#295 --- config/scripts/GRMLBASE/01-packages | 55 -------------------- etc/grml/grml-live.conf | 5 -- grml-live | 80 ----------------------------- 3 files changed, 140 deletions(-) delete mode 100755 config/scripts/GRMLBASE/01-packages diff --git a/config/scripts/GRMLBASE/01-packages b/config/scripts/GRMLBASE/01-packages deleted file mode 100755 index 5ce7a7b3..00000000 --- a/config/scripts/GRMLBASE/01-packages +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/01-packages -# Purpose: check for packages that have been requested but could not be installed -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -# FAI sets $target, but shellcheck does not know that. -target=${target:?} - -echo -n > "${LOGDIR}"/package_errors.log # ensure we start with an empty file - -PACKAGE_LIST=/grml-live/log/install_packages.list -# shellcheck disable=SC2154 -if ! [ -r "${target}/${PACKAGE_LIST}" ] ; then - echo "No ${target}/${PACKAGE_LIST} found, will not run package validation check." -else - echo "Validating package list against dpkg state..." - - TMPSTDOUT=$(mktemp) - TMPSTDERR=$(mktemp) - - # 1) catch packages that aren't in state 'ii' (marked for installation - # and successfully instead) on stdout - # 2) catch error messages like 'dpkg-query: no packages found matching $package" - # for packages unknown to dpkg on stderr - # NOTE: 'grep -v -- '-$' ignores packages in FAI's package list that are - # marked for removal - # shellcheck disable=SC2046 - ${ROOTCMD} dpkg --list $(grep -v '^#' "${target}/${PACKAGE_LIST}" | grep -v -- '-$') 2>"${TMPSTDERR}" | \ - grep -e '^[urph][ncufhWt]' > "${TMPSTDOUT}" || true - - # extract packages from stdout - awk '/^un/ {print $2 " not_installable"}' "${TMPSTDOUT}" >> "${LOGDIR}/package_errors.log" - - # extract packages from stderr - grep 'packages found matching' "${TMPSTDERR}" | \ - sed 's/dpkg-query: [Nn]o packages found matching \(.*\)/\1 not_installable/' >> "${LOGDIR}/package_errors.log" - - rm -f "${TMPSTDOUT}" "${TMPSTDERR}" -fi - -if [ -s "${LOGDIR}/package_errors.log" ] ; then - echo "Warning: failed (there have been errors, find them at ${LOGDIR}/package_errors.log)." - cat "${LOGDIR}/package_errors.log" -else - echo "Done - no errors found." -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index 1afd757a..5369b848 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -148,11 +148,6 @@ # the mksquashfs option -ef: # SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/grml/squashfs-excludes" -# Do you want to exit grml-live if some packages were requested for installation -# on fresh installs but are missing on the generated ISO finally? -# By default the package list is sent to stdout but grml-live doesn't interrupt. -# EXIT_ON_MISSING_PACKAGES=1 - # Do you want to use a special string for identifying the ISO? # By default the grml-name and version string are used as a base for generating # /conf/bootid.txt on the ISO. If you want to use a different value feel free to diff --git a/grml-live b/grml-live index bb07564b..98986798 100755 --- a/grml-live +++ b/grml-live @@ -112,7 +112,6 @@ fi # lsb-functions and configuration stuff {{{ # make sure they are not set by default -VERBOSE='1' FORCE='' UPDATE='' BUILD_ONLY='' @@ -755,85 +754,6 @@ else fi # BUILD_DIRTY? # }}} -# package validator {{{ -CHECKLOG="$LOG_OUTPUT"/fai/ -if [ -r "$CHECKLOG/dpkg.selections" ] ; then - package_count=$(wc -l "$CHECKLOG/dpkg.selections" | awk '{print $1}') -else - package_count="unknown" -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 - - # shellcheck disable=SC2013 # We expect each line to be a single word. - for package in $(awk '{print $1}' "${CHECKLOG}/package_errors.log" | sed 's;/;\\/;') ; do - failure_reason="$(awk "/$package/ {print \$2}" "${CHECKLOG}/package_errors.log")" - cat >> "${REPORT_MISSING_PACKAGES}" << EOF - - -Package $package is missing in chroot (${failure_reason}) - - -EOF - done - - cat >> "${REPORT_MISSING_PACKAGES}" << EOF - - - - - -EOF - eend 0 - - if [ -n "$EXIT_ON_MISSING_PACKAGES" ] && [ -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 -# }}} - # grub boot {{{ grub_setup() { EFI_IMG="/boot/efi.img"