Subject: [SM-Commit] BZR Change 29 to stage-root sorcery by David Brown <dmlb2000@dmlb2004>
Date: Thu, 11 May 2006 13:40:04 -0500
------------------------------------------------------------
revno: 29
committer: David Brown <dmlb2000@dmlb2004>
branch nick: stage-root
timestamp: Thu 2006-05-11 11:35:02 -0700
message:
merged from devel
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060511155153-d7229a5809196534
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack5
timestamp: Thu 2006-05-11 08:51:53 -0700
message:
fix typo
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060510044819-edce224db15a17cf
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:48:19 -0700
message:
add -g parameter to cast
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060510043308-c5450a0ec2db0cd1
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:33:08 -0700
message:
remove cast --fix and --nofix
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060510042430-82130c6d041a37a1
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:24:30 -0700
message:
fix spelling nit
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060510035735-3e25971a21f63021
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 20:57:35 -0700
message:
teach gaze dependencies about new functions
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060510035320-c47fa850092c512a
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 20:53:20 -0700
message:
add runtime/suggested dependencies bugs 10110 and 10790
=== modified file 'ChangeLog'
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,24 @@
+2006-05-11 Andrew Stitt <astitt AT sourcemage.org>
+ * libdepends: fix typo
+
+2006-05-09 Andrew Stitt <astitt AT sourcemage.org>
+ * cast: add -g parameter to allow custom grimoire selection and
ordering
+ * cast: remove --fix and --nofix (been deprecated for several
releases)
+
+2006-05-09 Andrew Stitt <astitt AT sourcemage.org>
+ * libapi: add runtime and suggest_depends, bugs 10110 and 10790.
+ Remove altruistic_sub_depends stub.
+ * dispel: add improved messages to handle new dependency states
+ * libdepends: Add new frontend routines for runtime/suggest
+ dependencies. Factor most common message calls into a
+ subroutine. Add controls for compute_install_depends functions
+ to work on either true dependencies as well as the full set.
+ Generalized the way UP_DEPENDS works because runtime/suggest depends
+ need it as well.
+ * libstate: Add new dependency states to sanity check
+ * cast: update to use generalized bonus spell mechanism
+ * gaze: add function stubs for runtime/suggest dependencies
+
2006-05-03 Andrew Stitt <astitt AT sourcemage.org>
* gaze: fix bug 10465, gaze allows grimoire selection
* libresurrect: fix bug 10528, install_config_files marks files
--f | --fix Discover and fix broken spells
--n | --nofix Discover, but do not fix broken spells
- (Both deprecated, use cleanse instead)
-
-d | --download Force download of sources (overwrite existing
files)
@@ -43,6 +39,14 @@
-c | --compile Recompile the spells (dont install from
cache).
-r | --reconfigure Select new dependencies for spells (implies
-c)
+
+-g | --grimoire [...] Use only the specified grimoires for this
cast
+ NOTE: If there are any cross-grimoire
+ dependencies on unspecified grimoires they
+ will not work. The target spell will
+ not be found. To avoid this, specify all
+ relevant grimoires to the -g parameter
+ in the order you wish them to be searched.
# special case of no spell making it through dependency resolution
# or if DEPS_ONLY is set, there arent any dependent spells to cast
@@ -779,7 +780,7 @@
#---------------------------------------------------------------------
## @Arguments arguments of cast
-## @Globals FIX CAST_PASS
+## @Globals CAST_PASS
## @return 0 always
## Starts prameter processing and casts the given spells.
## The list of given spells is being searched for invalid spells
@@ -791,6 +792,10 @@
local T_SPELLS
process_parameters "$@"
SPELLS=`strip_parameters "$@"`
+
+ if [[ $OVERRIDE_GRIMOIRES ]] ; then
+ codex_set_grimoires $OVERRIDE_GRIMOIRES
+ fi
for spell in $SPELLS ; do
codex_does_spell_exist $spell
#---------------------------------------------------------------------
+## Display what dependencies were removed
+#---------------------------------------------------------------------
+function dispel_parents_list_borkers() {
+ local parent=$1
+ local optional_borkers=$2
+ local runtime_borkers=$3
+ local suggested_borkers=$4
+ if [[ "$optional_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following optional dependencies
removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $optional_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+ if [[ "$runtime_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following runtime dependencies removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $runtime_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+ if [[ "$suggested_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following suggested dependencies
removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $suggested_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+}
+
+#---------------------------------------------------------------------
## @param spell to dispel
##
## Frontend to do common things for dispelling (keep a note of what
@@ -494,27 +525,33 @@
# for all borked spells either recast, dispel, or ignore
for parent in $(hash_get_table_fields BORKED_PARENTS) ; do
message "$parent is borked because of $(hash_get BORKED_PARENTS
$parent)"
- recastable=yes
+ local recastable=yes
borkers=$(hash_get BORKED_PARENTS $parent)
- local non_optional_borkers
+ local non_optional_borkers suggested_borkers runtime_borkers type
# if any of the removed children are required depends of the current
# spell, the spell is not recastable
# note: this doesnt take into account the spell changing out from
# under us. Oh well.
for child in $borkers; do
- if [[ $(grep "$parent:$child\(([^:]*)\)\?:on:required"
$DEPENDS_STATUS) ]] ; then
+ type=$(grep -m 1 "$parent:$child\(([^:]*)\)\?:on"
$DEPENDS_STATUS|cut -f4 -d:)
+ if [[ "$type" == required ]]; then
recastable=no
list_add non_optional_borkers $child
+ elif [[ "$type" == "runtime" ]] ; then
+ [[ "$recastable" != no ]] && recastable=NA
+ list_add runtime_borkers $child
+ elif [[ "$type" == "suggest" ]] ; then
+ [[ "$recastable" != no ]] && recastable=NA
+ list_add suggested_borkers $child
+ else
+ list_add optional_borkers $child
fi
done
if [[ $recastable == yes ]] ; then
- message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
- "had the following optional depends removed:${DEFAULT_COLOR}"
- message "${SPELL_COLOR}"
- echo $borkers | col
- message "${DEFAULT_COLOR}"
- if dispel_parent_query \
- "Re-cast $parent without these optional depends?" \
+ dispel_parents_list_borkers $parent "$optional_borkers" \
+ "$runtime_borkers" "$suggested_borkers"
+ if [[ $optional_borkers ]] && dispel_parent_query \
+ "Re-cast $parent without these non-optional depends?"
\
"$RECAST_PARENT_DEFAULT" ; then
# fix up the abandoned depends data for impending recompile
# this is a bit of a hack but should work:
@@ -541,7 +578,7 @@
done
=== modified file 'usr/sbin/scribe'
--- usr/sbin/scribe
+++ usr/sbin/scribe
@@ -80,7 +80,7 @@
if ! [ -d $grimoire ]; then
#uh oh! bad unzip.
message "ERROR: Grimoire tarball for $grim_name not" \
- "formated correctly!."
+ "formatted correctly!."
return 1
fi
return 0
=== modified file 'usr/share/man/man8/cast.8'
--- usr/share/man/man8/cast.8
+++ usr/share/man/man8/cast.8
@@ -46,6 +46,9 @@
and configuration options, even those you answered before.
Implies
.IR "-c" .
+.SS "-g, --grimoire [grimoire names ...]"
+Use only the specified grimoires for this cast.
+NOTE: If there are any cross-grimoire dependencies on unspecified grimoires
they will not work. The target spell will not be found. To avoid this,
specify all relevant grimoires to the -g parameter in the order you wish them
to be searched.
.SS "--from directory"
Specify an alternate directory to search for cached sources.
An alternate to /var/spool/sorcery.
#---------------------------------------------------------------------
-## @Type API
-## @params Name of a sub-depends that the current spell is providing.
-## @See <@function
var.lib.sorcery.modules.libdepends.html,real_altruistic_sub_depends> for more
details.
-##
-## Altruistically provide a sub-depends.
-##
-#---------------------------------------------------------------------
-function altruistic_sub_depends() {
- debug "libapi" "$FUNCNAME - $*"
- real_altruistic_sub_depends "$@"
-}
-
-#---------------------------------------------------------------------
## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query>
for more details.
## @param config file variable
## @param question
@@ -1004,6 +992,20 @@
#---------------------------------------------------------------------
## @Type API
+## @param spell/service
+## @param enabled options (optional)
+## @param description (optional)
+## @param grimoires (optional)
+## @See <@function var.lib.sorcery.modules.libdepends.html,real_depends> for
more details.
+## Denotes that a spell requires another spell to work.
+#---------------------------------------------------------------------
+function runtime_depends () {
+ debug "libapi" "runtime_depends - $*"
+ real_runtime_depends "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param sed command
## @param file
## @See <@function var.lib.sorcery.modules.libmisc.html,real_sedit> for more
details.
@@ -1083,6 +1085,21 @@
#---------------------------------------------------------------------
## @Type API
+## @param spell/service
+## @param enabled options (optional)
+## @param disabled options (optional)
+## @param description (optional)
+## @param grimoires (optional)
+## @See <@function
var.lib.sorcery.modules.libdepends.html,real_suggest_depends> for more
details.
+## Denotes that a spell can use another spell for additional functionality.
+#---------------------------------------------------------------------
+function suggest_depends () {
+ debug "libapi" "suggest_depends - $*"
+ real_suggest_depends "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param file to uncompress
## @See <@function var.lib.sorcery.modules.libunpack.html,real_uncompress>
for more details.
##
# these are here so you can source section/grimoire level scripts in
# PREPARE, which by definition runs before the spell is loaded
@@ -139,8 +138,7 @@
local PROTECT_SORCERY=yes
persistent_load &&
if [ -x $SCRIPT_DIRECTORY/CONFIGURE ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}running configuration...${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "running configuration..."
. $SCRIPT_DIRECTORY/CONFIGURE
else
default_configure
@@ -166,8 +164,7 @@
local PROTECT_SORCERY=yes
persistent_load &&
if [ -x $SCRIPT_DIRECTORY/DEPENDS ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}checking dependencies...${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "checking dependencies..."
. $SCRIPT_DIRECTORY/DEPENDS
else
default_depends
@@ -191,8 +188,7 @@
local PROTECT_SORCERY=yes
if [ -x $SCRIPT_DIRECTORY/UP_TRIGGERS ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}checking for reverse triggers...${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "checking for reverse triggers..."
# we need &&'s to preserve the proper return code (persistant_save
# will probably succeed even if PREPARE fails)
persistent_load &&
@@ -251,6 +247,7 @@
run_details
local NEW_SUB_DEPENDEES=""
local NEW_DEPENDS=()
+ local NEW_RUNTIME_DEPENDS=()
process_sub_depends "$this_spell" "$sub_dependee" "$sub_depends" ||
return 1
@@ -314,12 +311,19 @@
local hash=$1
touch $DEPENDS_STATUS $SPELL_STATUS &>/dev/null
+ local pattern
+ if [[ $2 ]] ; then
+ pattern="required|optional|runtime|suggest"
+ else
+ pattern="required|optional"
+ fi
+
# From here forward $1 and $2 are only used to refer to awk variables
# sub(/(.*)/, "", $2) removes a provider name
- eval $(awk -F : 'BEGIN {
+ eval $(awk -v pattern="$pattern" -F : 'BEGIN {
while (getline < ARGV[1] ) {
- if( $3=="on") {
+ if( $3=="on" && ( $4 ~ pattern ) ) {
sub(/\(.*\)/, "", $2);
depmap[$1]=depmap[$1]" "$2" "
}
@@ -343,13 +347,19 @@
#$1==hash table to fill
local hash=$1
touch $DEPENDS_STATUS $SPELL_STATUS &>/dev/null
+ local pattern
+ if [[ $2 ]] ; then
+ pattern="required|optional|runtime|suggest"
+ else
+ pattern="required|optional"
+ fi
# From here forward $1 and $2 are only used to refer to awk variables
# we need this so processes on the other side of make know whats going on
hash_export uncommitted_hash
+
+ BONUS_SPELLS=( ${BONUS_SPELLS[*]} ${UP_DEPENDS[*]} )
}
#---------------------------------------------------------------------
@@ -438,6 +451,8 @@
# special accumulators for the current spell
local NEW_DEPENDS=""
local NEW_SUB_DEPENDEES=""
+ local NEW_RUNTIME_DEPENDS=""
+ local NEW_UP_DEPENDS=""
local triggerees=""
local spell_depends
local spell_sub_depends
@@ -460,8 +475,7 @@
# have a chance at being fixed, ideally we should check in
# depends/optional_depends and fail there
if spell_exiled $1; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}is exiled and will not be
cast.${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "is exiled and will not be cast."
return 1
fi
get_uncommitted_depends_file $SPELL spell_depends
@@ -491,13 +505,17 @@
# no point in keeping the file around if its empty...
test -s $spell_depends || rm -f $spell_depends $spell_sub_depends
+ if echo "${RUNTIME_DEPENDS[*]}"| tr " " "\n" | grep -x -q "$SPELL" ; then
+ local k=${#BONUS_SPELLS[@]}
+ BONUS_SPELLS[$k]=$SPELL
+ fi
+
# this processes any sub-depends we requested and the sub-dependee
# has already been processed, so we must process them on their behalf
# this must be done after everything else!
run_other_sub_depends "$SPELL" || return 1
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}No work to do.${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "No work to do."
hash_put "depends_looked_at" "$SPELL" "ignore"
fi
@@ -506,10 +524,9 @@
}
#---------------------------------------------------------------------
-## Decides if a spell should be case. Check if the spell is installed
-## if it matters, etc...
-## Perhaps this function is overly splayed out in elif's but its
-## easier to add to later than what we had before...
+## Decides if a spell should be cast, or if we can leave it alone.
+## Check if the spell is installed, or if theres some other reason to
+## rebuild it.
## @param Spell
#---------------------------------------------------------------------
function private_should_cast()
@@ -558,10 +575,10 @@
# and/or move the weird pattern into library functions...
# (afrayedknot 2005-10-02)
tmp=$(grep "^.*:$1\(([^:]*)\)\?" $DEPENDS_STATUS|cut -f1 -d:|tr "\n" " ")
- local j each
- let j=${#UP_DEPENDS[*]}
+ local j k each
+ let j=${#NEW_UP_DEPENDS[*]}
for each in $tmp; do
- UP_DEPENDS[$j]=$each
+ NEW_UP_DEPENDS[$j]=$each
let j++
done
spells=( ${spells[*]} ${tmp} )
@@ -575,14 +592,12 @@
function private_recast_optionals() {
if [[ $RECAST_OPTIONALS ]] && [[ $RECAST_OPTIONALS != ignore ]] ; then
local spell j enabled
- let j=${#UP_DEPENDS[*]}
+ let j=${#NEW_UP_DEPENDS[*]}
for spell in $(search_depends_status_exact $DEPENDS_STATUS \
'.*' "$1\(([^:]*)\)\?" off optional '.*' '.*'|cut -f1 -d:);
do
enabled=""
- message "${SPELL_COLOR}$spell${DEFAULT_COLOR}${CHECK_COLOR}" \
- "has a disabled optional depends on${DEFAULT_COLOR}" \
- "${SPELL_COLOR}$1${DEFAULT_COLOR}"
+ message "$spell" "has a disabled optional dependency on" "$1"
if [[ $RECAST_OPTIONALS == always ]] ; then
enabled=yes
else
@@ -593,7 +608,7 @@
fi
fi
if [[ $enabled ]] ; then
- UP_DEPENDS[$j]=$each
+ NEW_UP_DEPENDS[$j]=$each
let j++
remove_depends_status $DEPENDS_STATUS $each "${1}\(([^:]*)\)\?"
fi
@@ -611,16 +626,24 @@
## @param grimoires to look in
## Delegates provider and spell cases to different worker functions.
## and gets grimoires if necessary for cross grimoire depends
-#---------------------------------------------------------------------
-function real_depends()
+##
+## Called by real_depends and real_runtime_depends
+#---------------------------------------------------------------------
+function real_generic_required_depends()
{
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ "$1" == "-sub" ]] ; then
local requested_sub_depends=$2
shift 2
fi
# see if theres another grimoire
- if [[ "$4" ]] ; then
+ if [[ "$4" ]] && ! [[ "$OVERRIDE_GRIMOIRES" ]] ; then
local grimoire here nothere current
for grimoire in $4; do
@@ -684,24 +707,46 @@
fi
if [[ ! $here ]] && [[ ! $current ]] ; then
message "${PROBLEM_COLOR}no grimoire for $1 was
retrieved${DEFAULT_COLOR}"
- return 1
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ return 1
+ fi
fi
fi
local target_spell
if ! codex_does_spell_exist $1 &> /dev/null; then
- work_depends_provider "$@" &&
+ work_depends_provider "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
if [[ "$requested_sub_depends" ]]; then
target_spell=$(get_spell_provider "$SPELL" "$1")
fi
else
- work_depends_spell "$@" &&
+ work_depends_spell "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
target_spell=$1
fi &&
for sub_depend in $requested_sub_depends; do
sub_depends "$target_spell" "$sub_depend" || return 1
done
}
+
+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from runtime depends
+#---------------------------------------------------------------------
+function real_depends() {
+ real_generic_required_depends "no" "a" "dependency" "required" "$@"
+}
+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from required depends
+#---------------------------------------------------------------------
+function real_runtime_depends() {
+ real_generic_required_depends "yes" "a" "runtime dependency" "runtime" "$@"
+}
+
#---------------------------------------------------------------------
## @param spell or provider name
@@ -710,16 +755,24 @@
## @param description
## @param grimoires to look in
## Delegates provider and spell cases to different worker functions.
-#---------------------------------------------------------------------
-function real_optional_depends()
+##
+## Called by real_depends and real_runtime_depends
+#---------------------------------------------------------------------
+function real_generic_optional_depends()
{
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ "$1" == "-sub" ]] ; then
local requested_sub_depends=$2
shift 2
fi
# see if theres another grimoire
- if [[ "$5" ]] ; then
+ if [[ "$5" ]] && ! [[ "$OVERRIDE_GRIMOIRES" ]] ; then
local grimoire here nothere current
for grimoire in $5; do
if [[ "$grimoire" == "current" ]] ; then
@@ -781,18 +834,20 @@
if [[ ! $here ]] && [[ ! $current ]] ; then
message "${PROBLEM_COLOR}no grimoire for $1 was
retrieved${DEFAULT_COLOR}"
message "Assuming dependency is off because it could not be met"
- private_common_depends "$1" "off" "optional" "$2" "$3"
+ private_common_depends "$1" "off" "$database_term" "$2" "$3"
fi
fi
local target_spell
if ! codex_does_spell_exist $1 &> /dev/null; then
- work_optional_depends_provider "$@" &&
+ work_optional_depends_provider "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
if [[ "$requested_sub_depends" ]]; then
target_spell=$(get_spell_provider "$SPELL" "$1")
fi
else
- work_optional_depends_spell "$@" &&
+ work_optional_depends_spell "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
target_spell=$1
fi &&
if [[ "$requested_sub_depends" ]] &&
@@ -806,6 +861,23 @@
}
#---------------------------------------------------------------------
+## Passthrough to real_generic_optional_depends, specifies the
+## parts that differ from suggest depends
+#---------------------------------------------------------------------
+function real_optional_depends() {
+ real_generic_optional_depends "no" "an" "optional dependency" "optional"
"$@"
+}
+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from optional depends
+#---------------------------------------------------------------------
+function real_suggest_depends() {
+ real_generic_optional_depends "yes" "a" "suggested dependency" "suggest"
"$@"
+}
+
+
+#---------------------------------------------------------------------
## Asks the user what provider for a depends is desired if a choice
## has not ben made before.
## @param Service
@@ -819,14 +891,16 @@
local default tmp installed=no
local status=()
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ $3 ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR} ($3)."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}"
"($3)."
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}."
+ depends_message "$SPELL" "has $article $query_term on some" "${1}."
fi
local CANDIDATES=$( find_providers $1)
@@ -834,7 +908,9 @@
message "${PROBLEM_COLOR}No providers of${DEFAULT_COLOR}" \
"${SPELL_COLOR}$1${DEFAULT_COLOR}" \
"${PROBLEM_COLOR} can be found!${DEFAULT_COLOR}"
- return 1
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ return 1
+ fi
fi
# if not reconfiguring check if theres already an answer in DEPENDS_STATUS
@@ -847,7 +923,7 @@
tmp=${status[1]%(*} # Name of spell which provides $1
if spell_ok $tmp &&
query "Continue to use ${SPELL_COLOR}$tmp${DEFAULT_COLOR}?" y; then
- private_common_depends "$tmp($1)" "on" "required" "$2" "$3"
+ private_common_depends "$tmp($1)" "on" "$database_term" "$2" "$3"
return 0
fi
fi
@@ -881,7 +957,7 @@
#---------------------------------------------------------------------
@@ -889,23 +965,27 @@
## on to the common dependency function, <@function private_common_depends>
## @param Spell
## @param enabled options
-## @param disabled options (useless, but included for some reason)
-## @param grimoire the spell is in, if its different than the current one
#---------------------------------------------------------------------
function work_depends_spell()
{
debug "libdepends" "$FUNCNAME - $@"
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
+ depends_message "${SPELL}" "has $article $query_term on" "$1"
if spell_exiled $1 ; then
- hash_put $CANNOT_CAST_HASH "$1" "Exiled"
- message "${SPELL_COLOR}${1}${DEFAULT_COLOR} has been exiled!"
- return 1
- fi
- private_common_depends "$1" "on" "required" "$2" ""
+ depends_message "${1}" "has been exiled!"
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ hash_put $CANNOT_CAST_HASH "$1" "Exiled"
+ return 1
+ fi
+ fi
+ private_common_depends "$1" "on" "$database_term" "$2" ""
}
@@ -923,14 +1003,16 @@
local default tmp installed=no
local status=()
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ $4 ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR} ($4)."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}"
"($4)."
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}."
fi
local CANDIDATES=$( find_providers $1)
@@ -940,7 +1022,7 @@
local tmp=${status[1]%(*} # Name of spell which provides $1
if spell_ok $tmp &&
query "Continue to use ${SPELL_COLOR}$tmp${DEFAULT_COLOR}?" y; then
- private_common_depends "$tmp($1)" "on" "required" "$2" "$3"
+ private_common_depends "$tmp($1)" "on" "$database_term" "$2" "$3"
return 0
fi
fi
@@ -990,9 +1072,9 @@
select_provider "provider" "$default" 1 $CANDIDATES
debug "libdepends" "$FUNCNAME - $@"
local default
+
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
# if $1 optionally depends on something exiled we always say no
if spell_exiled $1 ; then
- message "${SPELL_COLOR}${1}${DEFAULT_COLOR} has been exiled! not using
as a depends"
+ depends_message "${1}" "has been exiled! not using as $article
$query_term"
hash_put $CANNOT_CAST_HASH "$1" "Exiled"
- private_common_depends "$1" "off" "optional" "$2" "$3"
+ private_common_depends "$1" "off" "$database_term" "$2" "$3"
return 0
fi
@@ -1028,18 +1116,25 @@
if [[ ${status[2]} ]] ; then
# ah there are! use them
if [[ ${status[2]} == "on" ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "has an enabled $query_term on" "${1}"
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}has a disabled optional depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "has a disabled $query_term on" "${1}"
fi
- private_common_depends "$1" "${status[2]}" "optional" "$2" "$3"
+ private_common_depends "$1" "${status[2]}" "$database_term" "$2" "$3"
return 0
fi
fi
+ # colors differ from depends_message
+ if [[ $4 ]]; then
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
+ "has $article $query_term on" \
+ "${SPELL_COLOR}$1${DEFAULT_COLOR} ($4)"
+ else
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
+ "has $article $query_term on" \
+ "${SPELL_COLOR}$1${DEFAULT_COLOR}"
+ fi
+
# check for abandoned answers
if [ -e $ABANDONED_DEPENDS/$SPELL ] ; then
@@ -1086,10 +1181,6 @@
local stuff
[[ $default == off ]] && stuff=n || stuff=y
-
- message "${SPELL_COLOR}${1}${DEFAULT_COLOR}" \
- "is an optional dependency for" \
- "${SPELL_COLOR}$SPELL${DEFAULT_COLOR} ($4)"
if spell_ok $1 ; then
query "Do you want to use ${SPELL_COLOR}$1${DEFAULT_COLOR}?" "$stuff"
&&
@@ -1099,7 +1190,7 @@
install="on"
fi