[Lunar-commits] <lunar> Correctly update the depends file and fix recursive deps
Peter de Ridder
peter at lunar-linux.org
Sun Sep 2 20:59:14 CEST 2012
commit f2c2a9b3d4236016820f1e594ca9e112f76efb93
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Sun, 05 Aug 2012 08:18:08 -0700
URL: https://github.com/lunar-linux/lunar/commit/f2c2a9b3d4236016820f1e594ca9e112f76efb93
Correctly update the depends file and fix recursive deps
---
libs/check.lunar +1/-9
libs/depends.lunar +33/-25
2 files changed, 34 insertions (+), 34 deletions (-)
--- a/libs/check.lunar
+++ b/libs/check.lunar
@@ -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"
@@ -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"
}
--- a/libs/depends.lunar
+++ b/libs/depends.lunar
@@ -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
}
@@ -213,7 +212,16 @@ 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\""
@@ -221,25 +229,31 @@ run_depends() {
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
@@ -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"
}
More information about the Lunar-commits
mailing list