pkgmeek: customize the status message based on the user's settings for IGNORE_NEW and IGNORE_MISSING
This commit is contained in:
parent
be1a0eca6e
commit
0b7e71ec1e
@ -56,9 +56,9 @@ for (( s=0; s<${#source[@]}; s++ )); do
|
||||
[ -z "${renames[$s]}" ] || [ "${renames[$s]}" = "SKIP" ] || \
|
||||
_local_[$s]="${renames[$s]}"
|
||||
done
|
||||
# Example: _local_ = ( upstream-ball-v12.tgz
|
||||
# random.patch
|
||||
# some-git-repo/ )
|
||||
# Example: _local_ = ( some-git-repo/
|
||||
# upstream-ball-v12.tgz
|
||||
# random.patch )
|
||||
|
||||
# The effective user should at least have write permissions on $PWD
|
||||
[ -w "$(dirname "$work")" ] || work="$(pwd)"/work
|
||||
@ -96,7 +96,7 @@ check_pkg_mtime; pkg_utd=$?
|
||||
# Some further tests before proceeding with the build
|
||||
[ "$PKGMK_DOWNLOAD_ONLY" = "no" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] || \
|
||||
[ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] || [ "$PKGMK_UPDATE_SIG" = "yes" ] || \
|
||||
[ "$PKGMK_EXTRACT_ONLY" = "yes" ] || [ "$errDL" = 0 ] || exit $(( E_DOWNLOAD*(errDL != 0) ))
|
||||
[ "$PKGMK_EXTRACT_ONLY" = "yes" ] || [ $errDL != 0 ] || exit $(( E_DOWNLOAD*(errDL != 0) ))
|
||||
|
||||
# Take into account all the actions that can be done with a previously built package,
|
||||
# or with a full set of sources
|
||||
@ -140,8 +140,7 @@ fi
|
||||
|
||||
# All the sources should be here by now, let's verify that we can trust them.
|
||||
readonly cs_fail_msg="Use '--ignore-signature' to override, if you have determined integrity by other means."
|
||||
[ "$PKGMK_IGNORE_SIG" = "yes" ] || \
|
||||
{ check_signature "pre-build" | parse_signify_output;
|
||||
[ "$PKGMK_IGNORE_SIG" = "yes" ] || { check_signature "pre-build" | parse_signify_output;
|
||||
case $? in
|
||||
0) info "Sources successfully authenticated." ;;
|
||||
1) error "Signature file missing or corrupted." ; echo "$cs_fail_msg" ;;
|
||||
@ -164,7 +163,7 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then
|
||||
esac
|
||||
done
|
||||
|
||||
[ $errUZ != 0 ] || info "Sources successfully unpacked." || \
|
||||
[ $errUZ = 0 ] && info "Sources successfully unpacked." || \
|
||||
{ error "Failed to unpack all sources."; exit "$E_UNPACK"; }
|
||||
[ "$PKGMK_EXTRACT_ONLY" = "no" ] || exit 0
|
||||
|
||||
@ -356,14 +355,14 @@ validate_pkgfile() { # called from within PKGMK_ROOT
|
||||
}
|
||||
|
||||
check_reqvars () {
|
||||
local checksum
|
||||
local checksum nullvars;
|
||||
read -r checksum
|
||||
[ $((checksum & 1)) = 1 ] && absent=" 'name'"
|
||||
[ $((checksum & 2)) = 2 ] && absent+=" 'version'"
|
||||
[ $((checksum & 4)) = 4 ] && absent+=" 'release'"
|
||||
[ $((checksum & 8)) = 8 ] && absent+=" 'build()'"
|
||||
[ $((checksum & 1)) = 1 ] && nullvars=" 'name'"
|
||||
[ $((checksum & 2)) = 2 ] && nullvars+=" 'version'"
|
||||
[ $((checksum & 4)) = 4 ] && nullvars+=" 'release'"
|
||||
[ $((checksum & 8)) = 8 ] && nullvars+=" 'build()'"
|
||||
[ "$checksum" = 0 ] || { error "Pkgfile does not specify these required variables:"; \
|
||||
info "$absent"; exit "$E_PKGFILE"; }
|
||||
info "$nullvars"; exit "$E_PKGFILE"; }
|
||||
}
|
||||
|
||||
check_pkg_mtime() { # can be called even if some sources are missing
|
||||
@ -400,7 +399,7 @@ cat_manifest() {
|
||||
|
||||
check_manifest() {
|
||||
local FILTER TRUTH CN CM
|
||||
local FILE="$1.tmp"; local retval=0
|
||||
local FILE="$1.tmp"; local retval=0; local severity=error;
|
||||
[ -f "$package" ] || [ "$1" = "md5sum" ] || { error "$package not found. Cannot check $1.";
|
||||
return "$E_MANIFEST"; }
|
||||
[ "$1" = "md5sum" ] && FILTER="| sort -k 3" || FILTER=""
|
||||
@ -413,17 +412,17 @@ check_manifest() {
|
||||
sed '/^@@/d; /^+++/d; /^---/d; s/^+/NEW /g; s/^-/MISSING /g' \
|
||||
> "${FILE%tmp}diff"
|
||||
if [ -s "${FILE%tmp}diff" ]; then
|
||||
error "$1 mismatch found:"
|
||||
cat "${FILE%tmp}diff" >&2
|
||||
CN=$(grep -c ^NEW "${FILE%tmp}diff")
|
||||
CM=$(grep -c ^MISSING "${FILE%tmp}diff")
|
||||
if [ "$1" = "footprint" ]; then
|
||||
[ "$PKGMK_IGNORE_NEW" = "yes" ] || retval+=$CN
|
||||
[ "$PKGMK_IGNORE_MISSING" = "yes" ] || retval+=$CM
|
||||
[ "$PKGMK_IGNORE_NEW" = "no" ] && retval+=$CN || severity=warning
|
||||
[ "$PKGMK_IGNORE_MISSING" = "no" ] && retval+=$CM
|
||||
retval=$(( E_MANIFEST*( retval>0 ) ))
|
||||
else
|
||||
retval=$E_MANIFEST
|
||||
fi
|
||||
$severity "$1 mismatch found:"
|
||||
cat "${FILE%tmp}diff" >&2
|
||||
fi
|
||||
else
|
||||
warning ".$1 not found, creating new."; mv "$FILE" "$TRUTH"
|
||||
|
Loading…
Reference in New Issue
Block a user