add support for multi-parent profiles, account for missing newline in make.conf
authorgenone <genone@gentoo.org>
Mon, 16 Jun 2008 00:50:17 +0000 (00:50 -0000)
committergenone <genone@gentoo.org>
Mon, 16 Jun 2008 00:50:17 +0000 (00:50 -0000)
svn path=/; revision=490

trunk/ChangeLog
trunk/src/euse/euse

index 9bad1fec8d5c03a7008819636523160dd1ea59ce..41844d958de5ccf9d11b516ae4c724afd94b0d64 100644 (file)
@@ -1,3 +1,7 @@
+2008-06-16: Marius Mauch <genone@gentoo.org>
+       * euse: Add support for multi-parent profiles, account for missing 
+       final newline in make.conf
+
 2008-03-19: Paul Varner <fuzzyray@gentoo.org>
        * glsa-check: Fix imports so mail functionality in glsa-check works
        with python versions less than 2.5 (Bug 211706)
index 3b73ec0a475ab56914167cf68c3bbf91d034ba37..ed70932e0a7e9f751e40f2c57a68f8c021949ca8 100755 (executable)
@@ -136,6 +136,9 @@ for x in sys.stdin.read().split():
        elif x[0] != '-' and '-'+x in r:
                r.remove('-'+x)
                r.append(x)
+       elif x == '-*':
+               r = []
+               r.append(x)
        elif x not in r:
                r.append(x)
 print ' '.join(r)" 
@@ -195,13 +198,15 @@ get_all_make_defaults() {
        local parent
        local rvalue
        
-       curdir="$(get_real_path ${MAKE_PROFILE_PATH})"
+       curdir="${1:-$(get_real_path ${MAKE_PROFILE_PATH})}"
        
-       while [ -f "${curdir}/parent" ]; do
-               [ -f "${curdir}/make.defaults" ] && rvalue="${curdir}/make.defaults ${rvalue}"
-               parent="$(egrep -v '(^#|^ *$)' ${curdir}/parent)"
-               curdir="$(get_real_path ${curdir}/${parent})"
-       done
+       [ -f "${curdir}/make.defaults" ] && rvalue="${curdir}/make.defaults ${rvalue}"
+       if [ -f "${curdir}/parent" ]; then
+               for parent in $(egrep -v '(^#|^ *$)' ${curdir}/parent); do
+                       pdir="$(get_real_path ${curdir}/${parent})"
+                       rvalue="$(get_all_make_defaults ${pdir}) ${rvalue}"
+               done
+       fi
 
        echo "${rvalue}"
 }
@@ -211,12 +216,16 @@ get_make_defaults() {
        local curdir
        local parent
        
-       curdir="$(get_real_path ${MAKE_PROFILE_PATH})"
+       curdir="${1:-$(get_real_path ${MAKE_PROFILE_PATH})}"
        
-       while [ ! -f "${curdir}/make.defaults" -a -f "${curdir}/parent" ]; do
-               parent="$(egrep -v '(^#|^ *$)' ${curdir}/parent)"
-               curdir="$(get_real_path ${curdir}/${parent})"
-       done
+       if [ ! -f "${curdir}/make.defaults" -a -f "${curdir}/parent" ]; then
+               for parent in $(egrep -v '(^#|^ *$)' ${curdir}/parent); do
+                       if [ -f "$(get_make_defaults ${curdir}/${parent})" ]; then
+                               curdir="${curdir}/${parent}"
+                               break
+                       fi
+               done
+       fi
 
        echo "${curdir}/make.defaults"
 }
@@ -501,7 +510,10 @@ modify() {
        # closing ", printing our new USE line there instead.
        inuse=0
        had_use=0
-       (while read -r line; do
+       x=0
+       (while [ "$x" -eq "0" ]; do
+               read -r line
+               x="$?"
                [ "${line:0:4}" == "USE=" ] && inuse=1
                [ "${inuse}" == "0" ] && echo -E "${line}"
                if [ "${inuse}" == "1" ] && echo "${line}" | egrep '" *(#.*)?$' > /dev/null; then