Fix package groups.

This commit is contained in:
Simon Howard 2017-01-08 01:35:50 +01:00
parent fa1e1d06ce
commit 3353c13d83
2 changed files with 64 additions and 35 deletions

View File

@ -86,20 +86,7 @@ chocpkg::commands::install_dependencies() {
done
}
chocpkg::commands::installed() {
chocpkg::commands::configure_for_package "$@"
chocpkg::environment::setup_build_environment
do_check
}
chocpkg::commands::fetch() {
chocpkg::commands::configure_for_package "$@"
do_fetch
}
chocpkg::commands::build() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_build() {
chocpkg::commands::install_dependencies
chocpkg fetch $(chocpkg::commands::full_package_name)
@ -118,26 +105,77 @@ chocpkg::commands::build() {
do_build
}
chocpkg::commands::reinstall() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_dependencies() {
local i
for i in "${!DEPENDENCIES[@]}"; do
local dep="${DEPENDENCIES[$i]}"
echo "$dep"
chocpkg dependencies "$dep"
done | sort | uniq
}
chocpkg::commands::hook_fetch() {
do_fetch
}
chocpkg::commands::hook_install() {
# Already installed? Don't install again.
if ! chocpkg installed "$(chocpkg::commands::full_package_name)"; then
chocpkg reinstall "$(chocpkg::commands::full_package_name)"
fi
}
chocpkg::commands::hook_installed() {
chocpkg::environment::setup_build_environment
do_check
}
chocpkg::commands::hook_reinstall() {
chocpkg build $(chocpkg::commands::full_package_name)
cd "$PACKAGE_BUILD_DIR"
do_install
}
chocpkg::commands::shell() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_shell() {
chocpkg::environment::setup_build_environment
exec $SHELL
}
# All package-specific commands are hidden behind hook functions that allows
# packages to redefine them if necessary.
chocpkg::commands::build() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_build
}
chocpkg::commands::dependencies() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_dependencies
}
chocpkg::commands::fetch() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_fetch
}
chocpkg::commands::install() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_install
}
# Already installed? Don't install again.
if ! chocpkg installed "$(chocpkg::commands::full_package_name)"; then
chocpkg reinstall "$(chocpkg::commands::full_package_name)"
fi
chocpkg::commands::installed() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_installed
}
chocpkg::commands::reinstall() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_reinstall
}
chocpkg::commands::shell() {
chocpkg::commands::configure_for_package "$@"
chocpkg::commands::hook_shell
}
chocpkg::commands::packages() {
@ -188,15 +226,6 @@ chocpkg::commands::info() {
fi
}
chocpkg::commands::dependencies() {
local i
for i in "${!DEPENDENCIES[@]}"; do
local dep="${DEPENDENCIES[$i]}"
echo "$dep"
chocpkg dependencies "$dep"
done | sort | uniq
}
chocpkg::commands::usage() {
cat <<END
Usage:

View File

@ -16,7 +16,7 @@ do_build() {
# Installing a package group means installing all its packages; we don't
# trigger the build step like 'install' usually does (we don't have one).
cmd_install() {
chocpkg::commands::hook_install() {
local i
for i in "${!DEPENDENCIES[@]}"; do
chocpkg install "${DEPENDENCIES[$i]}"
@ -24,14 +24,14 @@ cmd_install() {
}
# Reinstalling a package group means reinstalling *all* its packages.
cmd_reinstall() {
chocpkg::commands::hook_reinstall() {
local i
for i in "${!DEPENDENCIES[@]}"; do
chocpkg reinstall "${DEPENDENCIES[$i]}"
done
}
cmd_dependencies() {
chocpkg::commands::hook_dependencies() {
local i
for i in "${!DEPENDENCIES[@]}"; do
local package="${DEPENDENCIES[$i]}"
@ -41,7 +41,7 @@ cmd_dependencies() {
}
# Package group is installed if all its packages are installed.
cmd_installed() {
chocpkg::commands::hook_installed() {
local i
for i in "${!DEPENDENCIES[@]}"; do
chocpkg installed "${DEPENDENCIES[$i]}"