summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Trygve Kalleberg <karltk@gentoo.org>2002-07-03 23:46:03 +0000
committerKarl Trygve Kalleberg <karltk@gentoo.org>2002-07-03 23:46:03 +0000
commit12f78810013f3fd210e8abf3aab1267f54596f8d (patch)
tree91f1fef8c8ff131234a9ca02cd0629d0078aefb5 /app-admin
parentmissed a " on the DEPEND list and added a ChangeLog (diff)
downloadgentoo-2-12f78810013f3fd210e8abf3aab1267f54596f8d.tar.gz
gentoo-2-12f78810013f3fd210e8abf3aab1267f54596f8d.tar.bz2
gentoo-2-12f78810013f3fd210e8abf3aab1267f54596f8d.zip
Fixes #4172.
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/gentoolkit/ChangeLog8
-rw-r--r--app-admin/gentoolkit/files/scripts/useflag78
-rw-r--r--app-admin/gentoolkit/files/scripts/useflag.16
3 files changed, 63 insertions, 29 deletions
diff --git a/app-admin/gentoolkit/ChangeLog b/app-admin/gentoolkit/ChangeLog
index 22b3d3472ac6..cfa31d5dceaf 100644
--- a/app-admin/gentoolkit/ChangeLog
+++ b/app-admin/gentoolkit/ChangeLog
@@ -1,9 +1,15 @@
# ChangeLog for app-admin/gentoolkit
# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
-# $Header: /var/cvsroot/gentoo-x86/app-admin/gentoolkit/ChangeLog,v 1.24 2002/06/26 04:20:21 lostlogic Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/gentoolkit/ChangeLog,v 1.25 2002/07/03 23:46:03 karltk Exp $
*gentoolkit-0.1.13 (25 Jun 2002)
+ 04 Jul 2002; Karl Trygve Kalleberg <karltk@gentoo.org> files/scripts/useflag files/scripts/useflag.1 :
+
+ useflag: Fixed problem with multiline USE vars, respelled
+ "depreciation" to "deprectation". Patch by Michael Thompson
+ <psionix@grandecom.net>.
+
25 Jun 2002; Brandon Low <lostlogic@gentoo.org> gentoolkit-0.1.13.ebuild files/digest-gentoolkit-0.1.13:
etc-update: Near complete rewrite of etc-update, should be a lot
diff --git a/app-admin/gentoolkit/files/scripts/useflag b/app-admin/gentoolkit/files/scripts/useflag
index e63c553b26fd..fd4cc08d68d4 100644
--- a/app-admin/gentoolkit/files/scripts/useflag
+++ b/app-admin/gentoolkit/files/scripts/useflag
@@ -1,5 +1,5 @@
#!/bin/bash
-# useflag v0.3.0
+# useflag v0.3.1
# Script to help users manage USE flags in Gentoo Linux
#
# Distributed under the terms of the GNU General Public License, v2 or later
@@ -42,8 +42,9 @@ do_get_desc() {
do_get_make() {
local parm1=$1
# Get the USE flags from make.conf
- local get_make_out=`grep "USE=\"" ${make_conf} | grep -v "#" | \
- cut -d "\"" -f2 -s`
+ # using `source` now instead of brain-damaged grepping
+ source ${make_conf}
+ local get_make_out=${USE}
# If called with "nodashes", then strip the leading dashes
if [ "${parm1}" = "nodashes" ]; then
for tr_sucks in ${get_make_out}; do
@@ -65,8 +66,8 @@ do_get_avail() {
grep -v "#" ${use_desc} | cut -d " " -f1 | tr '\n' ' '
}
-# Get depreciated flags.
-# parm1 = flag to check for depreciation
+# Get deprecated flags.
+# parm1 = flag to check for deprecation
# parm2 = list of available flags
do_get_depr() {
local parm1=$1
@@ -159,10 +160,37 @@ do_write_make() {
local use_write="USE=\"$@\""
local old_use="USE=\"`do_get_make dashes`\""
if [ -w ${make_conf} ] && [ -w ${make_conf_dir} ]; then
- cat ${make_conf} | \
- sed -e "s/${old_use}/${use_write}/" > ${make_temp}
- cp ${make_temp} ${make_conf}
- rm ${make_temp}
+ local use_write="USE=\"$@\""
+ local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"`
+ local start_line=`grep -n "USE=\"" ${make_conf} | \
+ grep -v "#" | cut -d ":" -f1`
+ if [ "${old_use:0-1}" != "\\" ]; then
+ sed -e "s/${old_use}/${use_write}/" ${make_conf} > \
+ ${make_temp}
+ else
+ sed -e "s/${old_use}\\/${use_write}/" ${make_conf} > \
+ ${make_temp}
+ fi
+ let start_line="${start_line} + 1"
+ if [ "${old_use:0-1}" != "\"" ]; then
+ del_line=`head -n ${start_line} ${make_temp} | \
+ tail -n 1`
+ until [ "${del_line:0-1}" != "\\" ]; do
+ let del_length="${#del_line} - 1"
+ del_line="${del_line:0:${del_length}}"
+ grep -v -w "${del_line}" ${make_temp} > \
+ ${make_temp}.2
+ mv ${make_temp}.2 ${make_temp}
+ del_line=`head -n ${start_line} \
+ ${make_temp} | tail -n 1`
+ done
+ let del_length="${#del_line} - 1"
+ del_line="${del_line:0:${del_length}}"
+ grep -v -x "${del_line}\"" ${make_temp} > \
+ ${make_temp}.2
+ mv ${make_temp}.2 ${make_temp}
+ fi
+ mv ${make_temp} ${make_conf}
else
do_report_err ${make_conf} write
fi
@@ -257,7 +285,7 @@ elif [ "$1" = "add" ] || [ "$1" = "-a" ]; then
fi
# lock:
-# This is the feature to lock a depreciated USE flag to prevent removal
+# This is the feature to lock a deprecated USE flag to prevent removal
elif [ "$1" = "lock" ] || [ "$1" = "-l" ]; then
if [ -r ${make_conf} ]; then
make_use=`do_get_make nodashes`
@@ -280,7 +308,7 @@ elif [ "$1" = "lock" ] || [ "$1" = "-l" ]; then
do_write_lock ${lock_out}
# unlock:
-# This is the feature to unlock a depreciated USE flag to allow removal
+# This is the feature to unlock a deprecated USE flag to allow removal
elif [ "$1" = "unlock" ] || [ "$1" = "-k" ]; then
if [ -r ${lock_cache} ]; then
lock_out=`cat ${lock_cache}`
@@ -311,7 +339,7 @@ elif [ "$1" = "showlock" ] || [ "$1" = "-w" ]; then
fi
# update:
-# This is the feature to update your USE by removing depreciated flags and
+# This is the feature to update your USE by removing deprecated flags and
# handling new flags.
elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
if [ -r ${make_conf} ]; then
@@ -326,7 +354,7 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
else
do_report_err ${use_desc} read
fi
- # First we check for depreciated flags.
+ # First we check for deprecated flags.
echo "Your USE variable currently looks like this:"
echo
echo `do_get_make dashes`
@@ -341,7 +369,7 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
fi
fi
echo
- echo "*** Checking for depreciated USE flags ..."
+ echo "*** Checking for deprecated USE flags ..."
echo
for check_flag in ${make_use}; do
depr_ret=`do_get_depr ${check_flag} ${use_avail}`
@@ -358,16 +386,16 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
fi
make_use=`do_get_make dashes`
if [ "${flag_depr}" = "" ]; then
- echo "!!! No depreciated flags were found."
+ echo "!!! No deprecated flags were found."
else
- echo "The following USE flags appear to be depreciated:"
+ echo "The following USE flags appear to be deprecated:"
echo "${flag_depr}"
echo
echo "How would you like to handle them?"
echo "1) Handle them individually"
- echo "2) Remove all depreciated flags"
- echo "3) Don't remove any depreciated flags"
- echo "4) Lock all depreciated flags"
+ echo "2) Remove all deprecated flags"
+ echo "3) Don't remove any deprecated flags"
+ echo "4) Lock all deprecated flags"
echo
echo -n "Type (1, 2, 3, or 4): "
while [ "${luser_input}" = "" ]; do
@@ -380,7 +408,7 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
${flag} ${make_use}`
done
echo
- echo -n "*** All depreciated flags were "
+ echo -n "*** All deprecated flags were "
echo "removed."
;;
"3")
@@ -390,7 +418,7 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
"1")
for flag in ${flag_depr}; do
echo -n "${flag} appears to be "
- echo -n "depreciated. Remove it? "
+ echo -n "deprecated. Remove it? "
echo -n "[Y]es/[N]o/[L]ock : "
luser_yn=""
while [ "${luser_yn}" = "" ]; do
@@ -414,13 +442,13 @@ elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
done
done
echo
- echo -n "*** All depreciated flags "
+ echo -n "*** All deprecated flags "
echo "processed."
;;
"4")
wlk="${flag_depr}"
echo
- echo "*** All depreciated flags were locked."
+ echo "*** All deprecated flags were locked."
;;
*)
luser_input=""
@@ -568,9 +596,9 @@ else
echo "variable."
echo -n "-d, del Deletes the specified flag(s) from "
echo "the USE variable."
- echo "-l, lock Locks the specified flag(s) to prevent depreciation."
+ echo "-l, lock Locks the specified flag(s) to prevent deprecation."
echo -n "-k, unlock Unlocks the specified flags to allow "
- echo "depreciation."
+ echo "deprecation."
echo "-w, showlock Displays a list of locked flags."
echo -n "-u, update Interactively updates the USE variable to "
echo "reflect changes"
diff --git a/app-admin/gentoolkit/files/scripts/useflag.1 b/app-admin/gentoolkit/files/scripts/useflag.1
index 9496fa9594f3..d321861fefbc 100644
--- a/app-admin/gentoolkit/files/scripts/useflag.1
+++ b/app-admin/gentoolkit/files/scripts/useflag.1
@@ -25,10 +25,10 @@ Adds one or more specified flags to the USE variable defined in \fImake.conf\fR.
Deletes one or more specified flags from the USE variable defined in \fImake.conf\fR. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. Attempting to delete a flag that is not in the USE variable returns a non-fatal error. When a flag is deleted from the USE variable using this utility, it is automatically unlocked.
.TP
\fBlock, -l [flag] ...\fR
-Locks one or more specified flags that exist in the USE variable defined in \fImake.conf\fR. Locked flags are not considered to be depreciated by the update function of this utility. This allows the user to avoid being queried by the utility about depreciated, undocumented, or custom flags that the user wishes to preserve when performing an update. A flag must exist in the USE variable in order to be locked. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored.
+Locks one or more specified flags that exist in the USE variable defined in \fImake.conf\fR. Locked flags are not considered to be deprecated by the update function of this utility. This allows the user to avoid being queried by the utility about deprecated, undocumented, or custom flags that the user wishes to preserve when performing an update. A flag must exist in the USE variable in order to be locked. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored.
.TP
\fBunlock, -k [flag] ...\fR
-Unlocks one or more specified USE flags. This allows the update function to consider a flag depreciated if it no longer exists in the master list defined in \fIuse.desc\fR. Any dashes prepended to flags on the command line are ignored. Attempting to unlock flags that are not locked returns a non-fatal error.
+Unlocks one or more specified USE flags. This allows the update function to consider a flag deprecated if it no longer exists in the master list defined in \fIuse.desc\fR. Any dashes prepended to flags on the command line are ignored. Attempting to unlock flags that are not locked returns a non-fatal error.
.TP
\fBshowlock, -w\fR
Displays the raw list of locked flags, seperated by spaces.
@@ -40,7 +40,7 @@ Interactively updates the USE variable defined in \fImake.conf\fR to reflect cha
First, the user is presented with the current raw contents of the USE variable. The user is also shown the list of locked flags if any exist.
.br
-Next, the USE variable is searched for flags that do not appear in the master list. If any are found and they are not locked, then they are considered to be depreciated and are displayed to the user along with a list of options for handling them. The user may choose to remove all of the flags, remove none of the flags, lock all of the flags, or handle each flag individually.
+Next, the USE variable is searched for flags that do not appear in the master list. If any are found and they are not locked, then they are considered to be deprecated and are displayed to the user along with a list of options for handling them. The user may choose to remove all of the flags, remove none of the flags, lock all of the flags, or handle each flag individually.
.br
Last, the master list is searched for any new flags that have become available since the last time the update function was run, and these are displayed to the user. If this is the first time, then all flags not currently defined in the USE variable will be displayed. The user will then be presented with a list of options for handling these flags. The user may choose to add all of the new flags to the USE variable as enabled, add all of the new flags as disabled, use Portage defaults for all of the flags, or handle each flag individually.