kiss: smarter handling of pre-built binaries and resolving dependencies.'

This commit is contained in:
Dylan Araps 2019-09-14 18:10:48 +03:00
parent b475771827
commit 3a55232e27
1 changed files with 16 additions and 15 deletions

31
kiss
View File

@ -396,21 +396,21 @@ pkg_build() {
for pkg; do for pkg; do
# Don't check for a pre-built package if it was passed # Don't check for a pre-built package if it was passed
# to KISS directly. # to KISS directly.
contains "$explicit_build" "$pkg" && continue contains "$explicit_build" "$pkg" || {
# Figure out the version and release.
read -r version release < "$(pkg_find "$pkg")/version"
# Figure out the version and release. # Install any pre-built binaries if they exist.
read -r version release < "$(pkg_find "$pkg")/version" # This calls 'args' to inherit a root check and call
# to 'sudo' to elevate permissions.
[ -f "$bin_dir/$pkg#$version-$release.tar.gz" ] && {
log "[$pkg] Found pre-built binary, installing"
(KISS_FORCE=1 args i "$bin_dir/$pkg#$version-$release.tar.gz")
# Install any pre-built binaries if they exist. # Remove the now installed package from the build
# This calls 'args' to inherit a root check and call # list. No better way than using 'sed' in POSIX 'sh'.
# to 'sudo' to elevate permissions. set -- $(echo " $* " | sed "s/ $pkg / /")
[ -f "$bin_dir/$pkg#$version-$release.tar.gz" ] && { }
log "[$pkg] Found pre-built binary, installing"
args i "$bin_dir/$pkg#$version-$release.tar.gz"
# Remove the now installed package from the build
# list. No better way than using 'sed' in POSIX 'sh'.
set -- $(echo " $* " | sed "s/ $pkg / /")
} }
done done
@ -443,6 +443,7 @@ pkg_build() {
# Finally build and create tarballs for all passed packages and # Finally build and create tarballs for all passed packages and
# dependencies. # dependencies.
for pkg; do for pkg; do
log "[$pkg] Starting build"
repo_dir=$(pkg_find "$pkg") repo_dir=$(pkg_find "$pkg")
# Install built packages to a directory under the package name # Install built packages to a directory under the package name
@ -475,7 +476,7 @@ pkg_build() {
contains "$explicit" "$pkg" && [ -z "$pkg_update" ] && continue contains "$explicit" "$pkg" && [ -z "$pkg_update" ] && continue
log "[$pkg] Needed as a dependency or has an update, installing" log "[$pkg] Needed as a dependency or has an update, installing"
args i "$pkg" (KISS_FORCE=1 args i "$pkg")
done done
# End here as this was a system update and all packages have been installed. # End here as this was a system update and all packages have been installed.
@ -871,7 +872,7 @@ args() {
# Rerun the script with 'sudo' if the user isn't root. # Rerun the script with 'sudo' if the user isn't root.
# Cheeky but 'sudo' can't be used on shell functions themselves. # Cheeky but 'sudo' can't be used on shell functions themselves.
[ "$(id -u)" = 0 ] || { [ "$(id -u)" = 0 ] || {
sudo -E kiss "$action" "$@" sudo -E KISS_FORCE="$KISS_FORCE" kiss "$action" "$@"
return return
} }
;; ;;