Skip to content

Commit

Permalink
Correctly update the depends file and fix recursive deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cavalier38 committed Aug 5, 2012
1 parent 4a90540 commit f2c2a9b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
10 changes: 1 addition & 9 deletions libs/check.lunar
Expand Up @@ -37,7 +37,7 @@ rework_module() {
if module_exiled $DEP ; then
echo "$MODULE:$DEP:off:optional:$2:$3"
else
if module_installed $DEP || module_held $DEP ; then
if module_installed $DEP ; then
echo "$MODULE:$DEP:on:optional:$2:$3"
else
echo "$MODULE:$DEP:off:optional:$2:$3"
Expand All @@ -49,14 +49,6 @@ rework_module() {
local DEP
debug_msg " depends ($@)"
DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
if ! module_installed $DEP && ! module_held $DEP ; then
if ! is_depends $DEP && module_exiled $DEP ; then
return 1
else
CHANGED_MODULES="$CHANGED_MODULES $DEP"
fi
fi

echo "$MODULE:$DEP:on:required:$2:$3"
}

Expand Down
58 changes: 33 additions & 25 deletions libs/depends.lunar
Expand Up @@ -182,25 +182,24 @@ run_depends() {
local DEP
debug_msg " depends ($@)"
DEP=$(unalias $1)
if grep -q "^$DEP\$" "$TEMP_PREPAREDDEPS" 2>/dev/null ; then
return 0
fi

if module_installed $DEP ; then
add_depends "$MODULE" "$DEP" "on" "required" "$2" "$3"
echo "$DEP" >> $TEMP_PREPAREDDEPS
elif ! is_depends $DEP ! module_installed $DEP && ! module_held $DEP ; then
add_depends "$MODULE" "$DEP" "on" "required" "$2" "$3"

if ! module_installed $DEP ; then
if module_exiled $DEP ; then
message "${MODULE_COLOR}${MODULE}:${PROBLEM_COLOR} ! Error: required dependency ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${PROBLEM_COLOR} is exiled and cannot be installed${DEFAULT_COLOR}"
return 1
else
elif ! in_depends $MODULE $DEP ; then
message "${MODULE_COLOR}${MODULE}:${DEFAULT_COLOR}" \
"${MESSAGE_COLOR}Adding required dependency${DEFAULT_COLOR}" \
"${MODULE_COLOR}$DEP${DEFAULT_COLOR}"
add_depends "$MODULE" "$DEP" "on" "required" "$2" "$3"
lin --deps $DEP
echo "$DEP" >> $TEMP_PREPAREDDEPS
fi
# don't check depends if there are already checked
if grep -q "^$DEP\$" "$TEMP_PREPAREDDEPS" 2>/dev/null ; then
return 0
fi
lin --deps $DEP
echo "$DEP" >> $TEMP_PREPAREDDEPS
fi
}

Expand All @@ -213,33 +212,48 @@ run_depends() {
# $4 = description of why to use this module

DEP=$(unalias $1)
if ! grep -q "^$MODULE:$DEP:" "$DEPENDS_STATUS" ; then
if in_depends $MODULE $DEP ; then
if ! module_installed $DEP ; then
# don't check depends if there are already checked
if grep -q "^$DEP\$" "$TEMP_PREPAREDDEPS" 2>/dev/null ; then
return 0
fi
lin --deps $DEP
echo "$DEP" >> $TEMP_PREPAREDDEPS
fi
elif ! grep -q "^$MODULE:$DEP:" "$DEPENDS_STATUS" ; then

if module_exiled $DEP ; then
verbose_msg "\"$MODULE\" optionally depends on exiled module \"$DEP\""
add_depends "$MODULE" "$DEP" "off" "optional" "$2" "$3"
else
if module_installed $DEP ; then
DEFAULT="y"
else
DEFAULT="n"
fi

if module_installed $DEP ; then
DEPMOD_AVAIL="Use optional (${FILE_COLOR}installed${QUERY_COLOR}) module ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR}"
else
DEFAULT="n"
DEPMOD_AVAIL="Install & use optional (${PROBLEM_COLOR}not installed${QUERY_COLOR}) module ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR}"
fi
fi

# this is shortcut case s1) as discussed in lunar-dev ML
if module_installed $DEP && [ -z "$2" -a -z "$3" ] ; then
verbose_msg "Auto-adding optional dependency \"$DEP\""
add_depends "$MODULE" "$DEP" "on" "optional" "$2" "$3"
lin --deps $DEP
# don't check depends if there are already checked
if grep -q "^$DEP\$" "$TEMP_PREPAREDDEPS" 2>/dev/null ; then
return 0
fi
lin --deps $DEP
echo "$DEP" >> $TEMP_PREPAREDDEPS
elif query "$DEPMOD_AVAIL
${QUERY_COLOR}Purpose: ${DEFAULT_COLOR}${MESSAGE_COLOR}$4 ${QUERY_COLOR}?" $DEFAULT ; then
add_depends "$MODULE" "$DEP" "on" "optional" "$2" "$3"
# don't check depends if there are already checked
if grep -q "^$DEP\$" "$TEMP_PREPAREDDEPS" 2>/dev/null ; then
return 0
fi
lin --deps $DEP
echo "$DEP" >> $TEMP_PREPAREDDEPS
else
add_depends "$MODULE" "$DEP" "off" "optional" "$2" "$3"
fi
Expand Down Expand Up @@ -469,12 +483,6 @@ update_module_depends()
local DEP
debug_msg " depends ($@)"
DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
if ! module_installed $DEP ; then
if ! is_depends $DEP && module_exiled $DEP ; then
return 1
fi
fi

echo "$MODULE:$DEP:on:required:$2:$3"
}

Expand Down

0 comments on commit f2c2a9b

Please sign in to comment.