[Secure-testing-commits] r49361 - bin

Balint Reczey rbalint at moszumanska.debian.org
Thu Mar 2 11:12:11 UTC 2017


Author: rbalint
Date: 2017-03-02 11:12:11 +0000 (Thu, 02 Mar 2017)
New Revision: 49361

Modified:
   bin/gen-DSA
Log:
gen-DSA, gen-DLA: Read details from .changes

Package name, version, bug(s) and cve(s) are filled from .changes
file.

Modified: bin/gen-DSA
===================================================================
--- bin/gen-DSA	2017-03-02 10:14:28 UTC (rev 49360)
+++ bin/gen-DSA	2017-03-02 11:12:11 UTC (rev 49361)
@@ -43,10 +43,14 @@
 }
 
 [ $# -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 @@
     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 @@
     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)"




More information about the Secure-testing-commits mailing list