pkgmeek: eliminate useless-use-of-cat

This commit is contained in:
John McQuah 2022-06-03 08:55:25 -04:00
parent c4c7f71c27
commit 62905f5ac6

View File

@ -169,9 +169,7 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then
# The actual build step! # The actual build step!
(SRC=$(pwd)/src; PKG=$(pwd)/pkg; cd src; set -x; build) && (SRC=$(pwd)/src; PKG=$(pwd)/pkg; cd src; set -x; build) &&
info "Build succeeded. Moving on to compression." || info "Build succeeded. Moving on to compression." ||
{ error "Unsuccessful build!"; cleanup_work; { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; }
[ "$PKGMK_KEEP_WORK" = "yes" ] || { cd "$PKGMK_ROOT"; rm -rf "$work"; };
exit "$E_BUILD"; }
[ -f "$PKGMK_ROOT/.nostrip" ] && ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip" [ -f "$PKGMK_ROOT/.nostrip" ] && ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip"
find pkg -type f $ns_filter | while read -r f; do find pkg -type f $ns_filter | while read -r f; do
@ -387,7 +385,6 @@ cat_manifest() {
| sort -k 3 | sort -k 3
;; ;;
md5sum) md5sum)
[ ! -e "$PKGMK_ROOT/.signature" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] || return
md5sum "${_local_[@]}" 2>&1 \ md5sum "${_local_[@]}" 2>&1 \
| grep -v "is a directory" | sed 's, .*/, ,' | sort -k 2 | grep -v "is a directory" | sed 's, .*/, ,' | sort -k 2
;; ;;
@ -403,11 +400,11 @@ check_manifest() {
TRUTH="$PKGMK_ROOT/.$1" TRUTH="$PKGMK_ROOT/.$1"
if [ -f "$TRUTH" ]; then if [ -f "$TRUTH" ]; then
diff -w -t -U 0 <(cat "$TRUTH" | sort $FILTER) <(cat_manifest $1 | sort $FILTER) | \ 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" sed '/^@@/d; /^+++/d; /^---/d; s/^+/NEW /g; s/^-/MISSING /g' > ".$1.diff"
if [ -s "$1.diff" ]; then if [ -s ".$1.diff" ]; then
CN=$(grep -c ^NEW "$1.diff") CN=$(grep -c ^NEW ".$1.diff")
CM=$(grep -c ^MISSING "$1.diff") CM=$(grep -c ^MISSING ".$1.diff")
if [ "$1" = "footprint" ]; then if [ "$1" = "footprint" ]; then
[ "$PKGMK_IGNORE_NEW" = "no" ] && retval+=$CN || severity=warning [ "$PKGMK_IGNORE_NEW" = "no" ] && retval+=$CN || severity=warning
[ "$PKGMK_IGNORE_MISSING" = "no" ] && retval+=$CM [ "$PKGMK_IGNORE_MISSING" = "no" ] && retval+=$CM
@ -416,9 +413,9 @@ check_manifest() {
retval=$E_MANIFEST retval=$E_MANIFEST
fi fi
$severity "$1 mismatch found:" $severity "$1 mismatch found:"
cat "$1.diff" >&2 cat ".$1.diff" >&2
fi fi
rm "$1.diff" rm ".$1.diff"
else else
warning ".$1 not found, creating new."; cat_manifest $1 > "$TRUTH" warning ".$1 not found, creating new."; cat_manifest $1 > "$TRUTH"
fi fi