From: genone Date: Fri, 8 Apr 2005 00:36:37 +0000 (-0000) Subject: more cascaded profiles support X-Git-Tag: gentoolkit-0.2.4.3~302 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e4162e3761fc9d23c75642d78341635ea3467a3e;p=gentoolkit.git more cascaded profiles support svn path=/; revision=204 --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 3889277..aed8c25 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,5 +1,6 @@ 2005-04-07 Marius Mauch * euse: fixed bugs 74344, 75525 and 84521 + * euse: add better support for cascaded profiles 2005-03-12 Aron Griffis * Added eviewcvs to -dev, utility for generating viewcvs URLs diff --git a/trunk/src/euse/euse b/trunk/src/euse/euse index d663233..d34c7e4 100755 --- a/trunk/src/euse/euse +++ b/trunk/src/euse/euse @@ -15,7 +15,7 @@ MAKE_GLOBALS_PATH=/etc/make.globals MAKE_PROFILE_PATH=/etc/make.profile MAKE_CONF_BACKUP_PATH=/etc/make.conf.euse_backup -MODE="showhelp" # available operation modes: showhelp, showversion, showdesc, showflags, modify +[ -z "${MODE}" ] && MODE="showhelp" # available operation modes: showhelp, showversion, showdesc, showflags, modify parse_arguments() { if [ -z "${1}" ]; then @@ -87,7 +87,7 @@ showhelp() { echo "Notes: ${PROGRAM_NAME} currently only works for global flags defined" echo " in make.globals, make.defaults or make.conf, it doesn't handle" echo " use.defaults, use.mask or package.use yet (see portage(5) for details on" - echo " these files)." + echo " these files). It also might have issues with cascaded profiles." echo " If multiple options are specified only the last one will be used." } @@ -114,8 +114,10 @@ get_useflags() { source "${MAKE_CONF_PATH}" ACTIVE_FLAGS[1]="${USE}" USE="" - source $(get_make_defaults) - ACTIVE_FLAGS[2]="${USE}" + for x in $(get_all_make_defaults); do + source "${x}" + ACTIVE_FLAGS[2]="${ACTIVE_FLAGS[2]} ${USE}" + done USE="" source "${MAKE_GLOBALS_PATH}" ACTIVE_FLAGS[3]="${USE}" @@ -145,13 +147,28 @@ get_useflaglist() { fi } +# get all make.defaults by traversing the cascaded profile directories +get_all_make_defaults() { + local curdir + local parent + local rvalue + + curdir="$(readlink -f ${MAKE_PROFILE_PATH})" + + while [ -f "${curdir}/parent" ]; do + [ -f "${curdir}/make.defaults" ] && rvalue="${curdir}/make.defaults ${rvalue}" + parent="$(egrep -v '(^#|^ *$)' ${curdir}/parent)" + curdir="$(readlink -f ${curdir}/${parent})" + done + + echo "${rvalue}" +} + # get the path to make.defaults by traversing the cascaded profile directories get_make_defaults() { local curdir - local notfound local parent - notfound=1 curdir="$(readlink -f ${MAKE_PROFILE_PATH})" while [ ! -f "${curdir}/make.defaults" -a -f "${curdir}/parent" ]; do @@ -197,7 +214,9 @@ get_portdir() { if [ -z "${PORTDIR}" ]; then use_backup="${USE}" source "${MAKE_GLOBALS_PATH}" - source "$(get_make_defaults)" + for x in $(get_all_make_defaults); do + source "${x}" + done source "${MAKE_CONF_PATH}" USE="${use_backup}" fi @@ -384,6 +403,7 @@ modify() { ##### main program comes now ##### +# disable globbing as it fucks up with args=* set -f parse_arguments "$@" check_sanity