From 62905f5ac62ee1f02dcc1d9d961f21932dffc75d Mon Sep 17 00:00:00 2001 From: John McQuah Date: Fri, 3 Jun 2022 08:55:25 -0400 Subject: [PATCH] pkgmeek: eliminate useless-use-of-cat --- scripts/pkgmeek | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/pkgmeek b/scripts/pkgmeek index 445fb41..6109a9b 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -169,9 +169,7 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then # The actual build step! (SRC=$(pwd)/src; PKG=$(pwd)/pkg; cd src; set -x; build) && info "Build succeeded. Moving on to compression." || - { error "Unsuccessful build!"; cleanup_work; - [ "$PKGMK_KEEP_WORK" = "yes" ] || { cd "$PKGMK_ROOT"; rm -rf "$work"; }; - exit "$E_BUILD"; } + { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; } [ -f "$PKGMK_ROOT/.nostrip" ] && ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip" find pkg -type f $ns_filter | while read -r f; do @@ -387,7 +385,6 @@ cat_manifest() { | sort -k 3 ;; md5sum) - [ ! -e "$PKGMK_ROOT/.signature" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] || return md5sum "${_local_[@]}" 2>&1 \ | grep -v "is a directory" | sed 's, .*/, ,' | sort -k 2 ;; @@ -403,11 +400,11 @@ check_manifest() { TRUTH="$PKGMK_ROOT/.$1" if [ -f "$TRUTH" ]; then - diff -w -t -U 0 <(cat "$TRUTH" | sort $FILTER) <(cat_manifest $1 | sort $FILTER) | \ - sed '/^@@/d; /^+++/d; /^---/d; s/^+/NEW /g; s/^-/MISSING /g' > "$1.diff" - if [ -s "$1.diff" ]; then - CN=$(grep -c ^NEW "$1.diff") - CM=$(grep -c ^MISSING "$1.diff") + diff -w -t -U 0 <(sort $FILTER "$TRUTH") <(cat_manifest $1 | sort $FILTER) | \ + sed '/^@@/d; /^+++/d; /^---/d; s/^+/NEW /g; s/^-/MISSING /g' > ".$1.diff" + if [ -s ".$1.diff" ]; then + CN=$(grep -c ^NEW ".$1.diff") + CM=$(grep -c ^MISSING ".$1.diff") if [ "$1" = "footprint" ]; then [ "$PKGMK_IGNORE_NEW" = "no" ] && retval+=$CN || severity=warning [ "$PKGMK_IGNORE_MISSING" = "no" ] && retval+=$CM @@ -416,9 +413,9 @@ check_manifest() { retval=$E_MANIFEST fi $severity "$1 mismatch found:" - cat "$1.diff" >&2 + cat ".$1.diff" >&2 fi - rm "$1.diff" + rm ".$1.diff" else warning ".$1 not found, creating new."; cat_manifest $1 > "$TRUTH" fi