Don't assume every package has stable variant.

The chocolate-doom package currently only has a latest variant, so
this assumption is incorrect. Instead only make this assumption if
the package file declares no variants. Add variant list to the 'info'
command output.
This commit is contained in:
Simon Howard 2016-06-15 19:39:35 -04:00
parent dcb99e1b11
commit 7c11c2a33b

View file

@ -129,7 +129,7 @@ configure_for_package() {
PACKAGE_DESCRIPTION="Package $package"
DEPENDENCIES=""
PACKAGE_DIR_NAME=$package
ALL_VARIANTS=(stable)
ALL_VARIANTS=()
local pkg_file="$CHOCPKG_ROOT/pkgdef/$package.sh"
if [ ! -e "$pkg_file" ]; then
@ -137,6 +137,10 @@ configure_for_package() {
fi
. "$pkg_file"
# If the package defines no variants, we assume it only has stable.
if [ "${#ALL_VARIANTS[@]}" -eq 0 ]; then
ALL_VARIANTS=(stable)
fi
if ! valid_variant "$PACKAGE_VARIANT"; then
error_exit "Unknown variant $PACKAGE_VARIANT for package $package."
fi
@ -280,6 +284,14 @@ package_info() {
printf " %s" "$dep"
done
printf "\n"
printf "variants:"
for v in "${ALL_VARIANTS[@]}"; do
printf "%s\n" "$v"
done | sort | uniq | while read v; do
printf " %s" "$v"
done
printf "\n"
}
cmd_info() {