summaryrefslogtreecommitdiffstats
path: root/bin/gen-DSA
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2014-08-24 21:43:04 +0000
committerRaphael Geissert <geissert@debian.org>2014-08-24 21:43:04 +0000
commit8e72095d4a9e42000bcfb7ae61ec83b4c0cc4faf (patch)
tree1a96fb68ca36a7543e56cbee45b7ef897c7a7b8b /bin/gen-DSA
parent00ceaa4251230f85dda26cf19db97f8bf70e8bdf (diff)
merge bin/gen-D{L,S}A, yay
From Portland, with love git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@28457 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-xbin/gen-DSA112
1 files changed, 65 insertions, 47 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA
index 9998c8509f..ddb1cb26a5 100755
--- a/bin/gen-DSA
+++ b/bin/gen-DSA
@@ -1,7 +1,7 @@
#!/bin/sh
####################
-# Copyright (C) 2011, 2012, 2013 by Raphael Geissert <geissert@debian.org>
+# Copyright (C) 2011, 2012, 2013, 2014 by Raphael Geissert <geissert@debian.org>
#
#
# This file is free software: you can redistribute it and/or modify
@@ -20,6 +20,13 @@
set -e
+IDMODE=DSA
+case "$(basename "$0")" in
+ *gen-D[LS]A)
+ IDMODE=${0#*gen-}
+ ;;
+esac
+
OLDSTABLE=squeeze
STABLE=wheezy
TESTING=jessie
@@ -29,14 +36,14 @@ DATE_SPACING=22
export LANG=C
-[ -f doc/DSA.template ] || {
+[ -f doc/$IDMODE.template ] || {
echo "error: call this script from the root of the repository" >&2
exit 1
}
[ $# -ge 1 ] || {
- echo "usage: $0 [--save] [--embargoed|--unembargo] [DSA] package [regression] [cve(s) [bugnumber(s)]]"
- echo " 'DSA' is the DSA number, required when issuing a revision"
+ echo "usage: $0 [--save] [--embargoed|--unembargo] [$IDMODE] package [regression] [cve(s) [bugnumber(s)]]"
+ echo " '$IDMODE' is the $IDMODE number, required when issuing a revision"
echo " 'cve(s)' and 'bugnumber(s)' can be passed in any order but"
echo " always AFTER the description"
echo " If it doesn't like your bug number, prefix it with # and report"
@@ -139,9 +146,9 @@ else
NORMAL=''
fi
-DSAID=
-if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
- DSAID="${1#DSA-}"
+DAID=
+if printf '%s' "$1" | grep -Eq '^('"$IDMODE"'-|)[0-9]+(-[0-9]+|)$'; then
+ DAID="${1#$IDMODE-}"
shift
fi
@@ -207,63 +214,63 @@ if [ -n "$TEXT" ]; then
fi
fi
-case "$DSAID" in
+case "$DAID" in
*-*|'')
:
;;
*)
- notice "missing DSA revision number, assuming 1" >&2
- DSAID="$DSAID-1"
+ notice "missing $IDMODE revision number, assuming 1" >&2
+ DAID="$DAID-1"
;;
esac
-dsa_exists() {
- grep -wq "DSA-$1" data/DSA/list
+daid_exists() {
+ grep -wq "$IDMODE-$1" data/$IDMODE/list
}
if $embargoed; then
- DSAID=EMBRGD-"$PACKAGE"
+ DAID=EMBRGD-"$PACKAGE"
fi
-if [ -z "$DSAID" ]; then
+if [ -z "$DAID" ]; then
if [ "$TYPE" = regression ]; then
- latest_dsa="$(sed -nr '/DSA-[0-9]+-[0-9]+'" $PACKAGE "'/{s/^.+DSA-[0]*([0-9-]+).*$/\1/;p;q}' data/DSA/list)"
- revision=${latest_dsa#*-}
- dsa=${latest_dsa%-*}
+ latest_daid="$(sed -nr '/'"$IDMODE"'-[0-9]+-[0-9]+'" $PACKAGE "'/{s/^.+'"$IDMODE"'-[0]*([0-9-]+).*$/\1/;p;q}' data/$IDMODE/list)"
+ revision=${latest_daid#*-}
+ daid=${latest_daid%-*}
else
- latest_dsa="$(sed -nr '/DSA-[0-9]+-1/{s/^.+DSA-[0]*([0-9]+).*$/\1/;p;q}' data/DSA/list)"
- dsa=$(($latest_dsa+1))
+ latest_daid="$(sed -nr '/'"$IDMODE"'-[0-9]+-1/{s/^.+'"$IDMODE"'-[0]*([0-9]+).*$/\1/;p;q}' data/$IDMODE/list)"
+ daid=$(($latest_daid+1))
revision=1
fi
c=0
- while dsa_exists "$dsa-$revision"; do
+ while daid_exists "$daid-$revision"; do
if [ "$TYPE" = regression ]; then
revision=$(($revision+1))
else
- dsa=$(($dsa+1))
+ daid=$(($daid+1))
fi
c=$(($c+1))
if [ $c -eq 10 ]; then
- error "unable to find an unused DSA id after $c attempts" >&2
+ error "unable to find an unused $IDMODE id after $c attempts" >&2
error "to workaround specify an id as the first parameter" >&2
exit 1
fi
done
- DSAID="$dsa-$revision"
+ DAID="$daid-$revision"
fi
-if dsa_exists "$DSAID"; then
- error "DSA-$DSAID has already been used" >&2
+if daid_exists "$DAID"; then
+ error "$IDMODE-$DAID has already been used" >&2
exit 1
fi
if $unembargo; then
EMBRGD_ID="EMBRGD-$PACKAGE"
- mv "DSA-${EMBRGD_ID}" DSA-"$DSAID"
+ mv "$IDMODE-${EMBRGD_ID}" $IDMODE-"$DAID"
# get the date of when the embargoed entry was generated
- gen_date="$(sed -rn "/DSA-${EMBRGD_ID}/{s/^\[(.+)\].+$/\1/;p;t}" data/DSA/list)"
+ gen_date="$(sed -rn "/$IDMODE-${EMBRGD_ID}/{s/^\[(.+)\].+$/\1/;p;t}" data/$IDMODE/list)"
OLD_DATE="$(date -d "$gen_date" +"%B %d, %Y")"
OLD_SPACEDDATE="$(right_space "$OLD_DATE" "$DATE_SPACING")"
@@ -271,16 +278,16 @@ if $unembargo; then
NEW_DATE="$(date +"%B %d, %Y")"
NEW_SPACEDDATE="$(right_space "$NEW_DATE" "$DATE_SPACING")"
- sed -ri "/DSA-${EMBRGD_ID}/{s/\[.+\]/[$(date +"%d %b %Y")]/;s/DSA-${EMBRGD_ID}/DSA-$DSAID/;}" data/DSA/list
- sed -i "s/${EMBRGD_ID}/$DSAID/g" DSA-"$DSAID"
- sed -i "s/^$OLD_SPACEDDATE/$NEW_SPACEDDATE/" DSA-"$DSAID"
+ sed -ri "/$IDMODE-${EMBRGD_ID}/{s/\[.+\]/[$(date +"%d %b %Y")]/;s/$IDMODE-${EMBRGD_ID}/$IDMODE-$DAID/;}" data/$IDMODE/list
+ sed -i "s/${EMBRGD_ID}/$DAID/g" $IDMODE-"$DAID"
+ sed -i "s/^$OLD_SPACEDDATE/$NEW_SPACEDDATE/" $IDMODE-"$DAID"
- echo "'Unembargoing' as DSA-$DSAID"
+ echo "'Unembargoing' as $IDMODE-$DAID"
exit
fi
tmpf=$(mktemp)
-cat doc/DSA.template > $tmpf
+cat doc/$IDMODE.template > $tmpf
if [ "$TYPE" = regression ]; then
sed -ri '/^Subject:/s/security update$/regression update/' $tmpf
@@ -300,14 +307,18 @@ setvar DEBFULLNAME
setvar SPACEDDEBFULLNAME
setvar PACKAGE
setvar CVE "$CVE_LIST"
-setvar DSAID
+if [ "$IDMODE" = DSA ]; then
+ setvar DSAID "$DAID"
+else
+ setvar DLAID "$DAID"
+fi
setvar BUGNUM
setvar OLDSTABLE
setvar STABLE
setvar TESTING
setvar SPACEDDATE
setvar DATE
-setvar TEXT "${TEXT:-DSA text goes here}"
+setvar TEXT "${TEXT:-$IDMODE text goes here}"
for dist in $OLDSTABLE $STABLE $TESTING UNSTABLE; do
version="$(eval 'printf "%s" "$'"$dist"_VERSION'"')"
@@ -325,31 +336,38 @@ if ! $save; then
cat $tmpf
echo
echo " ---- "
- echo "Pass --save as the first parameter to save the text to DSA-$DSAID"
- echo "(the data/DSA/list entry will also be added)"
+ echo "Pass --save as the first parameter to save the text to $IDMODE-$DAID"
+ echo "(the data/$IDMODE/list entry will also be added)"
rm -f "$tmpf"
exit
else
- mv -i $tmpf "DSA-$DSAID" || { rm -f $tmpf; exit; }
- dsa_entry=$(mktemp)
- cat <<EOF > $dsa_entry
-[$(date +"%d %b %Y")] DSA-$DSAID $PACKAGE - $TYPE update
+ mv -i $tmpf "$IDMODE-$DAID" || { rm -f $tmpf; exit; }
+
+ if [ "$IDMODE" = DSA ]; then
+ needed_file=data/dsa-needed.txt
+ else
+ needed_file=data/lts-needed.txt
+ fi
+
+ daid_entry=$(mktemp)
+ cat <<EOF > $daid_entry
+[$(date +"%d %b %Y")] $IDMODE-$DAID $PACKAGE - $TYPE update
EOF
if [ "$CVE" ]; then
- printf "\t{%s}\n" "$CVE" >> $dsa_entry
+ printf "\t{%s}\n" "$CVE" >> $daid_entry
fi
for dist in $OLDSTABLE $STABLE; do
version="$(eval 'printf "%s" "$'"$dist"_VERSION'"')"
[ -z "$version" ] || \
- printf "\t[%s] - %s %s\n" "$dist" "$PACKAGE" "$version" >> $dsa_entry
+ printf "\t[%s] - %s %s\n" "$dist" "$PACKAGE" "$version" >> $daid_entry
done
tmp_list="$(mktemp)"
- cat $dsa_entry data/DSA/list > $tmp_list
- cat $tmp_list > data/DSA/list
+ cat $daid_entry data/$IDMODE/list > $tmp_list
+ cat $tmp_list > data/$IDMODE/list
rm -f $tmp_list
- sed -rn '/^'"$PACKAGE"'\b/{: next;n;/^\s/b next;d};p' data/dsa-needed.txt > data/dsa-needed.txt.new
- mv data/dsa-needed.txt.new data/dsa-needed.txt
- echo "DSA text written to ./DSA-$DSAID"
+ sed -rn '/^'"$PACKAGE"'\b/{: next;n;/^\s/b next;d};p' $needed_file > $needed_file.new
+ mv $needed_file.new $needed_file
+ echo "$IDMODE text written to ./$IDMODE-$DAID"
fi

© 2014-2024 Faster IT GmbH | imprint | privacy policy