pkgmeek: fixes for check_pkg_mtime()
This commit is contained in:
parent
aba956949d
commit
f11ecff34b
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
######################## main routine ################################
|
######################## main routine ################################
|
||||||
local o_ignored work _local_ here url u f
|
local o_ignored work _local_ here url u f pkg_utd
|
||||||
local errDL=0; local errUZ=0; local pkg_utd=1
|
local errDL=0; local errUZ=0;
|
||||||
parse_options "$@"
|
parse_options "$@"
|
||||||
[ "$PKGMK_RECURSIVE" = "no" ] || recursive "$@"
|
[ "$PKGMK_RECURSIVE" = "no" ] || recursive "$@"
|
||||||
#
|
#
|
||||||
@ -90,7 +90,7 @@ done ; }
|
|||||||
[ $errDL != 0 ] || info "Successfully obtained all needed 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_utd=0
|
check_pkg_mtime; pkg_utd=$?
|
||||||
[ "$PKGMK_MTIME_ONLY" = "no" ] || [ "$PKGMK_CHECK_SIG" = "yes" ] || exit $pkg_utd
|
[ "$PKGMK_MTIME_ONLY" = "no" ] || [ "$PKGMK_CHECK_SIG" = "yes" ] || exit $pkg_utd
|
||||||
|
|
||||||
# Some further tests before proceeding with the build
|
# Some further tests before proceeding with the build
|
||||||
@ -100,7 +100,7 @@ check_pkg_mtime && pkg_utd=0
|
|||||||
|
|
||||||
# Take into account all the actions that can be done with a previously built package,
|
# Take into account all the actions that can be done with a previously built package,
|
||||||
# or with a full set of sources
|
# or with a full set of sources
|
||||||
[ "$pkg_utd" = 1 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] \
|
[ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] \
|
||||||
|| [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_CHECK_SIG" = "yes" ] \
|
|| [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_CHECK_SIG" = "yes" ] \
|
||||||
|| [ "$PKGMK_UPDATE_MD5" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "yes" ] \
|
|| [ "$PKGMK_UPDATE_MD5" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "yes" ] \
|
||||||
|| { info "$package is up to date, use '-f' to force a rebuild."; exit 0; }
|
|| { info "$package is up to date, use '-f' to force a rebuild."; exit 0; }
|
||||||
@ -140,7 +140,7 @@ fi
|
|||||||
|
|
||||||
# All the sources should be here by now, let's verify that we can trust them.
|
# 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."
|
readonly cs_fail_msg="Use '--ignore-signature' to override, if you have determined integrity by other means."
|
||||||
[ "$pkg_utd" = 1 ] || [ "$PKGMK_IGNORE_SIG" = "yes" ] || \
|
[ "$PKGMK_IGNORE_SIG" = "yes" ] || \
|
||||||
{ check_signature "pre-build" | parse_signify_output;
|
{ check_signature "pre-build" | parse_signify_output;
|
||||||
case $? in
|
case $? in
|
||||||
0) info "Sources successfully authenticated." ;;
|
0) info "Sources successfully authenticated." ;;
|
||||||
@ -199,7 +199,7 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then
|
|||||||
# Clean up, part 1: remove soft links and the {src,pkg} trees
|
# Clean up, part 1: remove soft links and the {src,pkg} trees
|
||||||
find . -maxdepth 1 -mindepth 1 -type l -delete
|
find . -maxdepth 1 -mindepth 1 -type l -delete
|
||||||
[ "$PKGMK_KEEP_WORK" = "yes" ] || rm -rf src pkg
|
[ "$PKGMK_KEEP_WORK" = "yes" ] || rm -rf src pkg
|
||||||
fi # Continue from here if the build was skipped
|
fi # Continue from here if the extract and build were skipped
|
||||||
|
|
||||||
# Install if requested
|
# Install if requested
|
||||||
# First find out how the effective user will invoke pkgadd
|
# First find out how the effective user will invoke pkgadd
|
||||||
@ -342,17 +342,17 @@ print_help() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validate_pkgfile() { # called from within PKGMK_ROOT
|
validate_pkgfile() { # called from within PKGMK_ROOT
|
||||||
local errcode nn nv nr nb checksum absent
|
local errcode kv
|
||||||
check_signature "pre-Pkgfile" | parse_signify_output
|
check_signature "pre-Pkgfile" | parse_signify_output
|
||||||
errcode=$?
|
errcode=$?
|
||||||
[ "$errcode" = 0 ] || info "Use '-is' if you have confirmed its origin some other way."
|
[ "$errcode" = 0 ] || info "Use '-is' if you have independent confirmation of the port's integrity."
|
||||||
[ "$errcode" = 0 ] || [ "$PKGMK_IGNORE_SIG" = "yes" ] || return $E_SIGNATURE
|
[ "$errcode" = 0 ] || [ "$PKGMK_IGNORE_SIG" = "yes" ] || return $E_SIGNATURE
|
||||||
|
|
||||||
# the environment should not be affected by sourcing the Pkgfile both here
|
# the environment should not be affected by sourcing the Pkgfile both here
|
||||||
# and in the later build, but to be safe we use a nested subshell
|
# and in the later build, but to be safe we use a nested subshell
|
||||||
( . Pkgfile; [ -n "$name" ] || nn=1; [ -n "$version" ] || nv=1; \
|
( . Pkgfile; kv=0; [ -n "$name" ] || kv+=1; [ -n "$version" ] || kv+=2; \
|
||||||
[ -n "$release" ] || nr=1; [ "$(type -t build)" = "function" ] || nb=1; \
|
[ -n "$release" ] || kv+=4; [ "$(type -t build)" = "function" ] || kv+=8; \
|
||||||
echo $(( nn+2*nv+4*nr+8*nb )) ) | check_reqvars
|
echo $kv ) | check_reqvars
|
||||||
}
|
}
|
||||||
|
|
||||||
check_reqvars () {
|
check_reqvars () {
|
||||||
@ -367,7 +367,7 @@ 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 li=0; local utd=0; local msg="$package is up to date."
|
local li=0; local utd=0; local msg="$package is not up to date."
|
||||||
|
|
||||||
if [ -f "$pkg_dir$package" ]; then
|
if [ -f "$pkg_dir$package" ]; then
|
||||||
utd=1
|
utd=1
|
||||||
@ -379,7 +379,7 @@ check_pkg_mtime() { # can be called even if some sources are missing
|
|||||||
[ ! -e Pkgfile ] || [ Pkgfile -nt "$pkg_dir$package" ] || utd=0
|
[ ! -e Pkgfile ] || [ Pkgfile -nt "$pkg_dir$package" ] || utd=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $utd != 0 ] && msg="$package is not up to date."
|
[ $utd = 0 ] || msg="$package is up to date."
|
||||||
info "$msg"; return $utd
|
info "$msg"; return $utd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,10 +456,11 @@ check_signature() { # called from $PKGMK_ROOT in the case "when"="pre-Pkgfile",
|
|||||||
# otherwise called from within $work. Pass control to
|
# otherwise called from within $work. Pass control to
|
||||||
# check_manifest() if the signature is missing and "ignore-md5"
|
# check_manifest() if the signature is missing and "ignore-md5"
|
||||||
# has not been requested.
|
# has not been requested.
|
||||||
local reqfiles; local s=0; local when="$1"
|
# Remember to clean up the soft links that get left behind!
|
||||||
|
local reqfiles=(Pkgfile); local s=0; local when="$1"
|
||||||
|
|
||||||
if [ -f "$PKGMK_ROOT/.signature" ]; then
|
if [ -f "$PKGMK_ROOT/.signature" ]; then
|
||||||
[ "$when" = "pre-Pkgfile" ] && reqfiles=(Pkgfile) || reqfiles=(.footprint)
|
[ "$when" = "pre-Pkgfile" ] || reqfiles=(.footprint)
|
||||||
while [ "$when" = "pre-build" ] && [ "$s" -lt ${#_local_[@]} ]; do
|
while [ "$when" = "pre-build" ] && [ "$s" -lt ${#_local_[@]} ]; do
|
||||||
[[ "${source[$s]}" =~ ^(http|https|ssh|git).*/\.git ]] || \
|
[[ "${source[$s]}" =~ ^(http|https|ssh|git).*/\.git ]] || \
|
||||||
reqfiles+=("${_local_[$s]}")
|
reqfiles+=("${_local_[$s]}")
|
||||||
|
Loading…
Reference in New Issue
Block a user