pkgmeek: remove stale reference in check_footprint()

This commit is contained in:
John McQuah 2022-11-27 07:41:38 -05:00
parent 3d4523d126
commit f03dad35e4
1 changed files with 14 additions and 12 deletions

View File

@ -69,8 +69,9 @@ done
[ -w "$(dirname "$work")" ] || work="$(pwd)"/work
rm -rf "$work"; mkdir -p "$work"/{src,pkg} && cd "$work"
# Skip the retrieval of sources if the user only asked for '-utd'
[ "$PKGMK_MTIME_ONLY" = "yes" ] || { for (( u=0; u<${#_local_[@]}; u++ )); do
# Skip the retrieval of sources if the user asked for '-utd' or '-uf'.
[[ "$PKGMK_MTIME_ONLY $PKGMK_UPDATE_FOOTPRINT" =~ yes ]] && [ -e "$PKGMK_PACKAGE_DIR/$package" ] \
|| { for (( u=0; u<${#_local_[@]}; u++ )); do
here="${_local_[$u]}"; url="${source[$u]}";
# at least one of the following commands should put a file of the
# appropriate name in the current directory
@ -80,7 +81,7 @@ here="${_local_[$u]}"; url="${source[$u]}";
[ -e "$here" ] || { error "failed to download $here. Check connection and try again."; errDL+=1; }
done ; }
[ $errDL = 0 ] && { [ "$PKGMK_MTIME_ONLY" = "yes" ] || \
[ $errDL = 0 ] && { [[ "$PKGMK_MTIME_ONLY $PKGMK_UPDATE_FOOTPRINT" =~ yes ]] || \
info "Successfully obtained all needed source files."; } || exit $E_DOWNLOAD
# Can stop here if the user asked for '-do', but honor any requests for '-um', '-uf',
@ -89,13 +90,13 @@ done ; }
|| [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "yes" ] \
|| [ "$PKGMK_MTIME_ONLY" = "yes" ] || exit 0
# If the user only asked for '-utd', perform the check using the sources that do exist.
# If '-utd' was requested, check the modification times and then exit.
check_pkg_mtime; pkg_utd=$?
[ "$PKGMK_MTIME_ONLY" = "no" ] || [ "$PKGMK_CHECK_SIG" = "yes" ] || \
[ "$PKGMK_FORCE" = "yes" ] || { cleanup_work; exit $pkg_utd; }
# Take into account all the actions that can be done with a previously built package,
# or with a full set of sources
# Take into account all the actions that can be done without extracting
# the downloaded sources
[ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "yes" ] \
|| [[ "$PKGMK_UPDATE_FOOTPRINT $PKGMK_CHECK_SIG $PKGMK_UPDATE_SIG" =~ yes ]] \
|| { info "$package is up to date, use '-f' to force a rebuild."; cleanup_work; exit 0; }
@ -105,9 +106,8 @@ check_pkg_mtime; pkg_utd=$?
[[ "$PKGMK_IGNORE_SIG $PKGMK_UPDATE_FOOTPRINT" =~ yes ]] \
|| echo "Checking signatures before unpacking..."
# The option -uf is meant to be used AFTER a previous invocation of pkgmeek has
# alerted the user to a footprint mismatch. Updating signatures (option -us) likewise
# needs only the sources and the footprint.
# The option -uf is meant to be used *after* a previous invocation of pkgmeek has
# alerted the user to a footprint mismatch.
if [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ]; then
[ -f "$pkg_dir$package" ] || \
{ error "unable to update footprint. File '$package' not found.";
@ -118,6 +118,7 @@ if [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ]; then
cat_footprint > "$PKGMK_ROOT/.footprint" && info "footprint created." \
|| { error "Failed to write the footprint."; exit "$E_DIRPERM"; }
fi
# Updating signatures (option -us) requires only sources and footprint, not a built package.
if [ "$PKGMK_UPDATE_SIG" = "yes" ]; then
cat_signature > "$PKGMK_ROOT/.signature" && info "Signature successfully created." \
|| { info "Could not create signature."; exit "$E_DIRPERM"; }
@ -350,7 +351,7 @@ check_pkg_mtime() { # can be called even if some sources are missing
fi
[ $utd = 0 ] || msg="$package is up to date."
info "$msg"; return $utd
[ "$PKGMK_MTIME_ONLY" = "yes" ] && info "$msg"; return $utd
}
fetch_url() {
@ -364,7 +365,8 @@ fetch_url() {
giturl="${u#__git__}"
# Did the port maintainer specify a branch other than 'master'?
tag="${giturl##*\#}"
[ -z "$tag" ] || { giturl="${giturl%\#*}"; CLONE_ARGS="--branch $tag"; }
[ -z "$tag" ] || { giturl="${giturl%\#*}";
CLONE_ARGS="-c advice.detachedHead=false --branch $tag"; }
#
# Has this project been downloaded before?
if [ -d "$src_dir/$h.partial" ]; then
@ -426,7 +428,7 @@ check_footprint() {
diff -w -t -U 0 <(sort "$TRUTH") <(cat_footprint | sort) | \
sed '/^@@/d; /^+++/d; /^---/d; s/^+/NEW /g; s/^-/MISSING /g' > ".footprint.diff"
if [ -s ".footprint.diff" ]; then
CN=$(grep -c ^NEW ".$1.diff"); CM=$(grep -c ^MISSING ".footprint.diff")
CN=$(grep -c ^NEW ".footprint.diff"); CM=$(grep -c ^MISSING ".footprint.diff")
[ "$PKGMK_IGNORE_MISSING" = "yes" ] || diffs=$CM
[ "$PKGMK_IGNORE_NEW" = "yes" ] || diffs=$(( diffs+CN ))
[ $diffs = 0 ] && severity=warning