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" rm -rf "$work"; mkdir -p "$work"/{src,pkg} && cd "$work"
# Skip the retrieval of sources if the user only asked for '-utd' # 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 errDL=0; [ "$PKGMK_MTIME_ONLY" = "yes" ] || {
here="${_local_[$u]}"; url="${source[$u]}" 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 # at least one of the following commands should put a file of the
# appropriate name in the current directory # appropriate name in the current directory
[ -e "$here" ] || [ "$src_dir" = "" ] || [ ! -e "$src_dir/$here" ] || ln -sf "$src_dir/$here" . [ -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" ] || [ ! -e "$PKGMK_ROOT/$here" ] || ln -sf "$PKGMK_ROOT/$here" . ;
[ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || { [ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || {
"$PKGMK_DOWNLOAD_PROG" -O "$here" "$url"; if "$PKGMK_DOWNLOAD_PROG" -O "$here" "$url"; then
[ "$src_dir" = "" ] || { mv "$here" "$src_dir"/ && ln -sf "$src_dir/$here" . ; }; [ "$src_dir" = "" ] || { mv "$here" "$src_dir"/ && ln -sf "$src_dir/$here" . ; };
} fi; };
[ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || \ [ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || \
( "$PKGMK_GIT_COMMAND" clone "$url" "$here" ) || continue ( "$PKGMK_GIT_COMMAND" clone "$url" "$here" ) || continue ;
# but if not, exit with an informative error message # but if not, exit with an informative error message
if [ ! -e "$here" ]; then if [ ! -e "$here" ]; then
error "failed to download $here. Check connection and try again." error "failed to download $here. Check connection and try again."
errDL+=1 errDL+=1
fi fi ;
done; } 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. # 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_MTIME_ONLY" = "no" ] || exit $pkg_ood
[ "$PKGMK_DOWNLOAD_ONLY" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] \ [ "$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_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 # Some further tests before proceeding with the build
[ "$pkg_ood" = 1 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] \ [ "$pkg_ood" = 1 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] || [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "no" ] || exit 0
|| [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_UPDATE_MD5" = "yes" ] \
|| [ "$PKGMK_EXTRACT_ONLY" = "yes" ] || exit 0
# Silence the progress report if the user never intended to proceed with unpacking # Silence the progress report if the user never intended to proceed with unpacking
[ "$PKGMK_CHECK_SIG" = "yes" ] || echo "Checking signatures before 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 esac
done 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 \ find pkg -xtype l -path '*/man/man*/*' -print0 \
| xargs -x -r -n1 sh -c "ln -sf \"\$(readlink -n '{}')\" '{}'" | 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 check_pkg_mtime() { # can be called even if some sources are missing
local status=1; local li=0; local pkg_ood="yes"; local msg local li=0; local pkg_ood=1; local msg="$package is not up to date."
msg="$package is not up to date."
if [ -f "$pkg_dir/$package" ]; then if [ -f "$pkg_dir$package" ]; then
pkg_ood="no" pkg_ood=0
while [ $li -lt ${#_local_[@]} ] && [ "$pkg_ood" = "no" ]; do while [ $li -lt ${#_local_[@]} ] && [ "$pkg_ood" = 0 ]; do
[ ! -e "${_local_[$li]}" ] || \ [ ! -e "${_local_[$li]}" ] || \
[ $(realpath "${_local_[$li]}") -nt "$package" ] || pkg_ood="yes" [ $(realpath "${_local_[$li]}") -nt "$pkg_dir$package" ] || pkg_ood=1
li=$(( li+1 )) li=$(( li+1 ))
done done
[ ! -e Pkgfile ] || [ Pkgfile -nt "$package" ] || pkg_ood="yes" [ ! -e Pkgfile ] || [ Pkgfile -nt "$pkg_dir$package" ] || pkg_ood=1
fi 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" [ "$PKGMK_MTIME_ONLY" = "no" ] || info "$msg"
return $status
} }
cat_manifest() { cat_manifest() {