pkgmeek: cleaned up the check_manifest() function

This commit is contained in:
John McQuah 2022-06-12 07:25:41 -04:00
parent 136106b169
commit 9c05e856a6

View File

@ -232,7 +232,6 @@ PKGMK_EXTRACT_ONLY="no"
PKGMK_MTIME_ONLY="no"
PKGMK_UPDATE_FOOTPRINT="no"
PKGMK_IGNORE_FOOTPRINT="no"
PKGMK_IGNORE_MISSING="no"
PKGMK_IGNORE_NEW="no"
PKGMK_FORCE="no"
PKGMK_KEEP_WORK="no"
@ -369,11 +368,19 @@ check_pkg_mtime() { # can be called even if some sources are missing
fetch_source() {
local u="$1"; local h="$2"; local finished=0; local REPO SAVE_AS OCONTINUE OOUT
# Determine whether git can be used to obtain sources
# Determine whether the source should be obtained by git
local PKGMK_GIT_COMMAND="/usr/bin/git"
[ -x "$PKGMK_GIT_COMMAND" ] || PKGMK_GIT_COMMAND="/bin/false"
[[ $u =~ ^(https|http|ssh|git)://.*/(.+)\.git$ ]] && \
{ "$PKGMK_GIT_COMMAND clone $u $h"; return $?; }
if [[ $u =~ ^(https|http|ssh|git)://.*/(.+)\.git$ ]]; then
[ -d "$src_dir/$h.partial" ] && { ln -s "$src_dir/$h.partial" "$h"; cd "$h";
"$PKGMK_GIT_COMMAND" pull; finished=$?; cd ..; }
[ -d "$src_dir/$h.partial" ] || \
{ "$PKGMK_GIT_COMMAND" clone "$u" "$h.partial"; finished=$?;
[ "$src_dir" = "" ] || { mv "$h.partial" "$src_dir";
ln -s "$src_dir/$h.partial" "$h"; };
[ "$src_dir" = "" ] && ln -s "$h.partial" "$h"; }
return $finished;
fi
[[ "$PKGMK_DOWNLOAD_PROG" =~ wget$ ]] && { OCONTINUE="-c"; OOUT="$PKGMK_WGET_OPTIONS -O"; }
[[ "$PKGMK_DOWNLOAD_PROG" =~ curl$ ]] && { OCONTINUE="-C -"; OOUT="$PKGMK_CURL_OPTIONS -o"; }
@ -430,8 +437,9 @@ check_manifest() {
if [ -s ".$1.diff" ]; then
CN=$(grep -c ^NEW ".$1.diff"); CM=$(grep -c ^MISSING ".$1.diff")
if [ "$1" = "footprint" ]; then
[ "$PKGMK_IGNORE_MISSING" = "no" ] && retval=$CM
[ "$PKGMK_IGNORE_NEW" = "no" ] && retval+=$CN || severity=warning
[ "$PKGMK_IGNORE_MISSING" = "yes" ] || retval=$CM
[ "$PKGMK_IGNORE_NEW" = "yes" ] || retval+=$CN
[ $retval -gt 0 ] || severity=warning
retval=$(( E_MANIFEST*( retval>0 ) ))
else
retval=$E_MANIFEST