pkgmeek: fixed faulty paths in check_pkg_mtime()

This commit is contained in:
John McQuah 2022-06-01 15:10:25 -04:00
parent 4cc33498fb
commit 232975d60e

View File

@ -66,39 +66,36 @@ done
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" ] || { errDL=0; for (( u=0; u<${#_local_[@]}; u++ )); do
here="${_local_[$u]}"; url="${source[$u]}"
errDL=0; [ "$PKGMK_MTIME_ONLY" = "yes" ] || {
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
[ -e "$here" ] || [ "$src_dir" = "" ] || [ ! -e "$src_dir/$here" ] || ln -sf "$src_dir/$here" .
[ -e "$here" ] || [ ! -e "$PKGMK_ROOT/$here" ] || ln -sf "$PKGMK_ROOT/$here" .
[ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || {
"$PKGMK_DOWNLOAD_PROG" -O "$here" "$url";
[ "$src_dir" = "" ] || { mv "$here" "$src_dir"/ && ln -sf "$src_dir/$here" . ; };
}
[ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || \
( "$PKGMK_GIT_COMMAND" clone "$url" "$here" ) || continue
[ -e "$here" ] || [ "$src_dir" = "" ] || [ ! -e "$src_dir/$here" ] || ln -sf "$src_dir/$here" ;
[ -e "$here" ] || [ ! -e "$PKGMK_ROOT/$here" ] || ln -sf "$PKGMK_ROOT/$here" . ;
[ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || {
if "$PKGMK_DOWNLOAD_PROG" -O "$here" "$url"; then
[ "$src_dir" = "" ] || { mv "$here" "$src_dir"/ && ln -sf "$src_dir/$here" . ; };
fi; };
[ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || \
( "$PKGMK_GIT_COMMAND" clone "$url" "$here" ) || continue ;
# but if not, exit with an informative error message
if [ ! -e "$here" ]; then
error "failed to download $here. Check connection and try again."
errDL+=1
fi
done; }
if [ ! -e "$here" ]; then
error "failed to download $here. Check connection and try again."
errDL+=1
fi ;
done ; }
[ "$errDL" = 0 ] && info "Successfully obtained all source files."
[ "$errDL" != 0 ] || info "Successfully obtained all needed source files."
# If the user only asked for '-utd', perform the check using the sources that do exist.
check_pkg_mtime; pkg_ood=$?
check_pkg_mtime && pkg_ood=0 || pkg_ood=1
[ "$PKGMK_MTIME_ONLY" = "no" ] || exit $pkg_ood
[ "$PKGMK_DOWNLOAD_ONLY" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] \
|| [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] || [ "$PKGMK_UPDATE_SIG" = "yes" ] \
|| [ "$PKGMK_EXTRACT_ONLY" = "yes" ] || [ "$errDL" = 0 ] || exit $(( E_DOWNLOAD*(errDL > 0) ))
[ "$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) ))
# Some further tests before proceeding with the build
[ "$pkg_ood" = 1 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] \
|| [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] \
|| [ "$PKGMK_EXTRACT_ONLY" = "yes" ] || exit 0
[ "$pkg_ood" = 1 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] || [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "no" ] || exit 0
# Silence the progress report if the user never intended to proceed with unpacking
[ "$PKGMK_CHECK_SIG" = "yes" ] || echo "Checking signatures before unpacking..."
@ -177,7 +174,7 @@ find pkg -type f $ns_filter | while read -r f; do
esac
done
find pkg -type f -path '*/man/man*/*' | grep -v '.gz$' | xargs gzip -9
find pkg -type f -path '*/man/man*/*' | grep -v '.gz$' | xargs -r -I{} gzip -9 '{}'
find pkg -xtype l -path '*/man/man*/*' -print0 \
| xargs -x -r -n1 sh -c "ln -sf \"\$(readlink -n '{}')\" '{}'"
@ -375,22 +372,20 @@ check_reqvars () {
}
check_pkg_mtime() { # can be called even if some sources are missing
local status=1; local li=0; local pkg_ood="yes"; local msg
msg="$package is not up to date."
local li=0; local pkg_ood=1; local msg="$package is not up to date."
if [ -f "$pkg_dir/$package" ]; then
pkg_ood="no"
while [ $li -lt ${#_local_[@]} ] && [ "$pkg_ood" = "no" ]; do
if [ -f "$pkg_dir$package" ]; then
pkg_ood=0
while [ $li -lt ${#_local_[@]} ] && [ "$pkg_ood" = 0 ]; do
[ ! -e "${_local_[$li]}" ] || \
[ $(realpath "${_local_[$li]}") -nt "$package" ] || pkg_ood="yes"
[ $(realpath "${_local_[$li]}") -nt "$pkg_dir$package" ] || pkg_ood=1
li=$(( li+1 ))
done
[ ! -e Pkgfile ] || [ Pkgfile -nt "$package" ] || pkg_ood="yes"
[ ! -e Pkgfile ] || [ Pkgfile -nt "$pkg_dir$package" ] || pkg_ood=1
fi
[ "$pkg_ood" = "yes" ] || { status=0; msg="$package is up to date."; }
[ "$pkg_ood" = 1 ] || msg="$package is up to date."
[ "$PKGMK_MTIME_ONLY" = "no" ] || info "$msg"
return $status
}
cat_manifest() {