[Lunar-commits] r17029 - in lunar/trunk: sbin var/lib/lunar/functions
Auke Kok
sofar at lunar-linux.org
Thu Oct 20 21:47:08 UTC 2005
Author: sofar
Date: 2005-10-20 21:47:01 +0000 (Thu, 20 Oct 2005)
New Revision: 17029
Modified:
lunar/trunk/sbin/lin
lunar/trunk/var/lib/lunar/functions/download.lunar
lunar/trunk/var/lib/lunar/functions/modules.lunar
Log:
Prototype LICENSE code: use lunar set {ACCEPTED,REJECTED}_LICENSES to adjust it. These variables can contain more license names. We still need to decide on license names.
Modified: lunar/trunk/sbin/lin
===================================================================
--- lunar/trunk/sbin/lin 2005-10-20 18:49:17 UTC (rev 17028)
+++ lunar/trunk/sbin/lin 2005-10-20 21:47:01 UTC (rev 17029)
@@ -125,7 +125,7 @@
# no strange stuff should happen here anymore
for MODULE in $MODULES ; do
if ! module_installed $MODULE || [ ! -n "$PROBE" ] || ( [ -n "$PROBE" ] && [ "$PROBE_EXPIRED" == "on" ] && module_is_expired $MODULE ) ; then
- if ! module_held $MODULE && ! module_exiled $MODULE ; then
+ if ! module_held $MODULE && ! module_exiled $MODULE && module_license_accepted $MODULE ; then
linING="/var/lock/installing.$MODULE"
verbose_msg "starting lin \"$MODULE\""
if ! ( SINGLE_MODULE=1 main $MODULE ) ; then
@@ -139,7 +139,17 @@
fi
fi
else
- verbose_msg "Skipping compile and install for held/exiled module \"$MODULE\""
+ # split up error messages
+ if module_held $MODULE; then
+ verbose_msg "Skipping compile and install for held module \"$MODULE\""
+ elif module_exiled $MODULE; then
+ verbose_msg "Skipping compile and install for exiled module \"$MODULE\""
+ else
+ message "${MESSAGE_COLOR}The license of this module is incompatible with the list of"
+ message "allowed and/or rejected licenses. Please adjust the ACCEPTED_LICENSES or"
+ message "REJECTED_LICENSES variables to include or not include the specific"
+ message "license of this module.${DEFAULT_COLOR}"
+ fi
fi
fi
done
Modified: lunar/trunk/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/download.lunar 2005-10-20 18:49:17 UTC (rev 17028)
+++ lunar/trunk/var/lib/lunar/functions/download.lunar 2005-10-20 21:47:01 UTC (rev 17029)
@@ -53,9 +53,17 @@
local MAX_SOURCES SRC ALL_URLS URLS URL MLIST ALT REST HIT
debug_msg "download_module ($@)"
if ! run_details $1 ; then
- exit 1
+ return 1
fi
+ if ! module_license_accepted $1 ; then
+ message "${MESSAGE_COLOR}The license of this module is incompatible with the list of"
+ message "allowed and/or rejected licenses. Please adjust the ACCEPTED_LICENSES or"
+ message "REJECTED_LICENSES variables to include or not include the specific"
+ message "license of this module.${DEFAULT_COLOR}"
+ return 1
+ fi
+
MAX_SOURCES=${MAX_SOURCES:=100}
# loop over all sources
Modified: lunar/trunk/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/modules.lunar 2005-10-20 18:49:17 UTC (rev 17028)
+++ lunar/trunk/var/lib/lunar/functions/modules.lunar 2005-10-20 21:47:01 UTC (rev 17029)
@@ -284,6 +284,39 @@
}
+module_license_accepted() {
+ debug_msg "module_license_accepted ($@)"
+ local L LICENSE
+ LICENSE=$(run_details $1 > /dev/null ; echo $LICENSE)
+ # check if $MODULE's $LICENSE is accepted or not, works as follows:
+ # if ACCEPTED_LICENSES is set, LICENSE *must* be listed, else if
+ # REJECTED_LICESES is set, must _NOT_ be listed
+ if [ -n "$(echo $ACCEPTED_LICENSES)" ]; then
+ for L in $ACCEPTED_LICENSES; do
+ if [ "$LICENSE" == "$L" ]; then
+ # explicitly accepted license!
+ debug_msg "module_license_accepted: \"$LICENSE\" is explicitly accepted"
+ return 0
+ fi
+ done
+ # it was not explicitly accepted
+ error_message "${MODULE_COLOR}$1${DEFAULT_COLOR}: ${PROBLEM_COLOR}License \"$LICENSE\" is not explicitly accepted${DEFAULT_COLOR}"
+ return 1
+ elif [ -n $REJECTED_LICENSES ]; then
+ for L in $REJECTED_LICENSES; do
+ if [ "$LICENSE" == "$L" ]; then
+ # explicitly rejected license!
+ error_message "${MODULE_COLOR}$1${DEFAULT_COLOR}: ${PROBLEM_COLOR}License \"$LICENSE\" is explicitly rejected${DEFAULT_COLOR}"
+ return 1
+ fi
+ done
+ # implicitly not rejected
+ debug_msg "module_license_accepted: \"$LICENSE\" is not rejected"
+ return 0
+ fi
+}
+
+
# function : module_exiled
# usage : module_exiled $MODULE
# purpose : check if $MODULE is exiled
More information about the Lunar-commits
mailing list