[Secure-testing-commits] r20102 - bin
Raphael Geissert
geissert at alioth.debian.org
Wed Sep 5 18:58:39 UTC 2012
Author: geissert
Date: 2012-09-05 18:58:39 +0000 (Wed, 05 Sep 2012)
New Revision: 20102
Modified:
bin/gen-DSA
Log:
Code cleanup
Modified: bin/gen-DSA
===================================================================
--- bin/gen-DSA 2012-09-05 18:22:54 UTC (rev 20101)
+++ bin/gen-DSA 2012-09-05 18:58:39 UTC (rev 20102)
@@ -44,12 +44,6 @@
shift
fi
-DSAID=
-if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
- DSAID="${1#DSA-}"
- shift
-fi
-
toupper() {
printf '%s' "$1" | tr '[:lower:]' '[:upper:]'
}
@@ -75,6 +69,24 @@
printf "${RED}error:${NORMAL} %s\n" "$1"
}
+check_spelling() {
+ if which aspell >/dev/null && echo test | aspell -l en list 2>/dev/null; then
+ aspell -l en list
+ elif which enchant >/dev/null && echo test | enchant -l -d en 2>/dev/null; then
+ enchant -l -d en
+ fi
+}
+
+setvar() {
+ local var="$1" value="$2"
+
+ if [ -z "$value" ]; then
+ value="$(eval 'printf "%s" "$'"$var"'"')"
+ fi
+
+ sed -i "s=\$$var=$value=g" "$tmpf"
+}
+
if which tput >/dev/null; then
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
@@ -87,6 +99,12 @@
NORMAL=''
fi
+DSAID=
+if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
+ DSAID="${1#DSA-}"
+ shift
+fi
+
PACKAGE="$(tolower "$1")"
VULNERABILITY="$2"
CVE="$(toupper "$3")"
@@ -142,32 +160,15 @@
exit 1
fi
-if which aspell >/dev/null && echo test | aspell -l en list 2>/dev/null; then
- echo "$VULNERABILITY" | aspell -l en list |
- while read word; do
- warn "possible spelling mistake: $word!" >&2
- done
-elif which enchant >/dev/null && echo test | enchant -l -d en 2>/dev/null; then
- echo "$VULNERABILITY" | enchant -l -d en |
- while read word; do
- warn "possible spelling mistake: $word!" >&2
- done
-fi
+echo "$VULNERABILITY" | check_spelling |
+while read word; do
+ warn "possible spelling mistake: $word!" >&2
+done
-setvar() {
- local var="$1" value="$2"
-
- if [ -z "$value" ]; then
- value="$(eval 'printf "%s" "$'"$var"'"')"
- fi
-
- sed -i "s=\$$var=$value=g" "$tmpf"
-}
-
tmpf=$(mktemp)
cat doc/DSA.template > $tmpf
-name_length=$(echo -n "$DEBFULLNAME" | wc -c)
+name_length=${#DEBFULLNAME}
spacing=$((24-$name_length))
SPACEDDEBFULLNAME="$DEBFULLNAME"
while [ $spacing -gt 0 ]; do
@@ -176,7 +177,7 @@
done
DATE="$(date +"%B %d, %Y")"
-date_length=$(echo -n "$DATE" | wc -c)
+date_length=${#DATE}
spacing=$((22-$date_length))
SPACEDDATE="$DATE"
while [ $spacing -gt 0 ]; do
More information about the Secure-testing-commits
mailing list