fixing bug 95432
authorgenone <genone@gentoo.org>
Fri, 17 Feb 2006 01:32:41 +0000 (01:32 -0000)
committergenone <genone@gentoo.org>
Fri, 17 Feb 2006 01:32:41 +0000 (01:32 -0000)
svn path=/; revision=281

trunk/ChangeLog
trunk/src/euse/euse

index bcac6c20c90b6cd831b1c1f20f9c3886187d7d36..c74fc7d4fecfc0931ecca4e830df523d8a6086ea 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-16 Marius Mauch <genone@gentoo.org>
+       * euse: add/remove use flags even if there is no USE= statement in make.conf
+       (bug #95432)
+
 2006-02-16 Marius Mauch <genone@gentoo.org>
        * glsa-check: Fix bug causing the wrong summary to be displayed 
        for --test --verbose (bug #123084)
index d34c7e45fed8fda9561620e6b9ad4de196fe6d17..299ba18ca8c738d1d9bed43da497a97cbf6dde08 100755 (executable)
@@ -387,6 +387,7 @@ modify() {
        # on our own here. Basically just skip everything between USE=" and the 
        # closing ", printing our new USE line there instead.
        inuse=0
+       had_use=0
        (while read -r line; do
                [ "${line:0:4}" == "USE=" ] && inuse=1
                [ "${inuse}" == "0" ] && echo -E "${line}"
@@ -395,8 +396,14 @@ modify() {
                        echo -ne "${NEW_MAKE_CONF_USE_2%% }"
                        echo '"'
                        inuse=0
+                       had_use=1
                fi
-       done ) < "${MAKE_CONF_BACKUP_PATH}" | sed -e 's:\\ $:\\:' > "${MAKE_CONF_PATH}"
+       done
+       if [ ${haduse} -eq 0 ]; then
+               echo -n 'USE="'
+               echo -ne "${NEW_MAKE_CONF_USE_2%% }"
+               echo '"'
+       fi ) < "${MAKE_CONF_BACKUP_PATH}" | sed -e 's:\\ $:\\:' > "${MAKE_CONF_PATH}"
        
        echo "${MAKE_CONF_PATH} was modified, a backup copy has been placed at ${MAKE_CONF_BACKUP_PATH}"
 }