Guessing package version for DLA template
Hi,
Since I made mistakes in setting the package version in DLA texts (and
I'm not alone ;-)) I came up with the attached patch which makes
gen-DLA and guess the proper one.
If both teams like it I'll push it to the repo.
Cheers,
Balint
From 4cae74f5c825aa17e3e847689eab5ea37454db60 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Tue, 28 Feb 2017 01:34:59 +0100
Subject: [PATCH] Guess package version for DSA and DLA templates
---
bin/gen-DSA | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/bin/gen-DSA b/bin/gen-DSA
index 80d3251..ece6a21 100755
--- a/bin/gen-DSA
+++ b/bin/gen-DSA
@@ -135,6 +135,13 @@ setvar() {
sed -i "s=\$$var=$value=g" "$tmpf"
}
+get_last_pkg_version() {
+ local pkg="$1"
+ local dist="$2"
+ local sources="http://security.debian.org/dists/$dist/updates/main/source/Sources.gz"
+ wget -q -O - $sources | zcat | awk -v keyword="Package: $pkg" 'BEGIN{RS="\n\n"} $0 ~ keyword{for(i = 1 ; i <= NF ; i++) {if ($i == "Version:") {version = $(i + 1); break}}} END {print version}'
+}
+
if which tput >/dev/null; then
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
@@ -319,6 +326,12 @@ setvar SPACEDDATE
setvar DATE
setvar TEXT "${TEXT:-$IDMODE text goes here}"
+for dist in $OLDOLDSTABLE $OLDSTABLE $STABLE; do
+ if [ -z "$(eval 'printf "%s" "$'"$dist"_VERSION'"')" ]; then
+ eval "${dist}_VERSION=$(get_last_pkg_version $PACKAGE $dist)"
+ fi
+done
+
for dist in $OLDOLDSTABLE $OLDSTABLE $STABLE $TESTING UNSTABLE; do
version="$(eval 'printf "%s" "$'"$dist"_VERSION'"')"
if $save && [ -z "$version" ] && grep -q "${dist}_VERSION" "$tmpf"; then
--
2.1.4
Reply to: