rpms/kernel/devel/scripts sort-config,1.2,1.3
Chuck Ebbert
cebbert at fedoraproject.org
Mon Aug 17 10:36:31 UTC 2009
- Previous message (by thread): rpms/xz/devel .cvsignore,1.3,1.4 sources,1.3,1.4 xz.spec,1.3,1.4
- Next message (by thread): rpms/hyphen-hi/devel hyph_hi_IN.dic,1.1,1.2 hyphen-hi.spec,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: cebbert
Update of /cvs/pkgs/rpms/kernel/devel/scripts
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14155
Modified Files:
sort-config
Log Message:
add nosort option, make comments about unmatched items optional
Index: sort-config
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/scripts/sort-config,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- sort-config 16 Aug 2009 03:08:19 -0000 1.2
+++ sort-config 17 Aug 2009 10:36:31 -0000 1.3
@@ -6,16 +6,18 @@ TGT=($(ls kernel-*/linux-*.noarch/config
TGT1=(${TGT[*]#kernel-*/linux-*.noarch/configs/kernel-2.6.*-})
if [ $# -lt 2 ] ; then
- echo -e "Usage:\n $(basename $0) [-df] input target\n"
+ echo -e "Usage:\n $(basename $0) [-dfcn] input target\n"
echo -e " Sort input config file into the same order as the target\n"
echo -e " -d: show raw unsorted output with extra debug text"
- echo -e " -f: force output to match what is in the target config\n"
+ echo -e " -f: force output to match what is in the target config"
+ echo -e " -c: insert comments about non-matching items"
+ echo -e " -n: do not sort output\n"
echo -e " input: source config file" ' [' "${SRC[*]#config-}" ']\n'
echo -e " target: output arch name" ' [' "${TGT1[*]%.config}" ']\n'
exit 1
fi
-while getopts "df" OPTION ; do
+while getopts "dfcn" OPTION ; do
case $OPTION in
d)
DEBUG=1
@@ -23,12 +25,23 @@ d)
f)
FORCE=1
;;
+c)
+ ADDCOMMENT=1
+;;
+n)
+ NOSORT=1
+;;
\?)
exit 2
;;
esac
done
+if [ "$FORCE" -a "$ADDCOMMENT" ] ; then
+ echo "-f and -c options cannot be used together"
+ exit 2
+fi
+
shift $((OPTIND-1))
if [ -f xx00 -o -f xx01 -o -f xx99 ] ; then
@@ -45,6 +58,7 @@ TGTFILE=kernel-*/linux-*.noarch/configs/
[ ! -f $TGTFILE ] && echo "No target file matching" $TGTFILE "exists" && exit 2
IX=0
+IN=0
declare -a SAVECOMMENT
cat ${SRCFILE} | while read TEXT ; do
@@ -77,7 +91,9 @@ cat ${SRCFILE} | while read TEXT ; do
TEXT=$(grep "$FINDTEXT" $TGTFILE | head -1)
[ "$DEBUG" ] && echo 'forced ->' "$TEXT"
else
- COMMENT="# -- Next option was changed in target line $LINE --"
+ if [ "$ADDCOMMENT" ] ; then
+ COMMENT="# -- Next option was changed in target line $LINE --"
+ fi
fi
fi
fi
@@ -95,7 +111,10 @@ cat ${SRCFILE} | while read TEXT ; do
[ "$DEBUG" -a "$TEXT" ] && echo "text ->" "$LINE" "$TEXT"
if [ "$TEXT" ] ; then
- # we have output, make sure it has a line number
+
+ # use input line numbers if not sorting
+ [ "$NOSORT" ] && LINE=$IN
+ # make sure it has a line number
[ -z "$LINE" ] && LINE=999999
# print saved comments first
@@ -110,13 +129,18 @@ cat ${SRCFILE} | while read TEXT ; do
fi
[ "$COMMENT" ] && echo "$LINE":"$COMMENT"
echo "$LINE":"$TEXT"
+
else
+
# no output yet, save the comment
SAVECOMMENT[$IX]="$COMMENT"
[ "$DEBUG" ] && echo "savecomment ->" "$LINE" "${SAVECOMMENT[$IX]}"
(( IX++ ))
+
fi
+ ((IN++))
+
done > xx99
if [ "$DEBUG" ] ; then
- Previous message (by thread): rpms/xz/devel .cvsignore,1.3,1.4 sources,1.3,1.4 xz.spec,1.3,1.4
- Next message (by thread): rpms/hyphen-hi/devel hyph_hi_IN.dic,1.1,1.2 hyphen-hi.spec,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list