diff options
author | Balint Reczey <rbalint@debian.org> | 2017-03-02 11:12:11 +0000 |
---|---|---|
committer | Balint Reczey <rbalint@debian.org> | 2017-03-02 11:12:11 +0000 |
commit | 4aaa60d864319fc21dd269d4e558634dc0027891 (patch) | |
tree | 0a0f1f02336f7128333a822bd80a9b26ccf90346 /bin/gen-DSA | |
parent | f0221a55f60f430b08fb398fb123f616d0634696 (diff) |
gen-DSA, gen-DLA: Read details from .changes
Package name, version, bug(s) and cve(s) are filled from .changes
file.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@49361 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-x | bin/gen-DSA | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA index 80d32512ef..5b033a56f1 100755 --- a/bin/gen-DSA +++ b/bin/gen-DSA @@ -43,10 +43,14 @@ export LC_ALL=C } [ $# -ge 1 ] || { - echo "usage: $0 [--save] [--embargoed|--unembargo] [$IDMODE] package [regression] [cve(s) [bugnumber(s)]]" + echo "usage: $0 [--save] [--embargoed|--unembargo] [$IDMODE] package[.changes] [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 "" + echo " When specifying package.changes the package name, version, additional bug(s) and cve(s)" + echo " are parsed from the .changes file." + echo "" echo " If it doesn't like your bug number, prefix it with # and report" exit 1 } >&2 @@ -153,7 +157,16 @@ if printf '%s' "$1" | grep -Eq '^('"$IDMODE"'-|)[0-9]+(-[0-9]+|)$'; then shift fi -PACKAGE="$(tolower "$1")" +PACKAGE= +CHANGES= + +if echo "$1" | grep -q '_.*\.changes$'; then + CHANGES="$1" + PACKAGE=$(awk '/^Source: / {print $2}' $CHANGES) +else + PACKAGE="$(tolower "$1")" +fi + shift TYPE=security @@ -183,6 +196,21 @@ while [ $# -gt 0 ]; do shift done +if ! [ -z "$CHANGES" ]; then + # parse info from .changes file + # Version can occur in GPG signature, thus we exit on first occurence + version="$(awk '/^Version: / {print $2; exit 0}' $CHANGES)" + dist="$(awk '/^Distribution: / {print $2}' $CHANGES | sed 's/-.*//')" + export ${dist}_VERSION="$version" + + for bug in $(awk '/^Closes: / {sub(".*"$2,$2); print $0}' $CHANGES); do + BUGNUM="$BUGNUM ${bug#\#}" + done + for cve in $(awk 'BEGIN {RS="[ ():\n]" } /^CVE-[0-9]+-[0-9]+$/ {print $1}' $CHANGES); do + CVE="$CVE $cve" + done +fi + BUGNUM="$(split_n_sort "$BUGNUM")" CVE="$(split_n_sort "$CVE" -V)" |