From ce4bc72dbd590231186267c064ae1679c2ba1241 Mon Sep 17 00:00:00 2001 From: Isaac David Date: Mon, 9 Oct 2017 15:22:46 -0500 Subject: blacklist: implement `get-url` function from `reference` and `id` fields The blacklist allows referring to a number of trusted bug trackers to complement the information given in the reason field. However, maintainable shorthand identifiers are used instead of full URLs. Printing the latter based on the former is the job of this new functionality. This also introduces corresponding test cases and l10n strings (together with translations for the `es` locale). --- src/lib/blacklist.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/lib/blacklist.sh b/src/lib/blacklist.sh index 10eafef..e3d976b 100755 --- a/src/lib/blacklist.sh +++ b/src/lib/blacklist.sh @@ -96,6 +96,21 @@ blacklist-get-rep() { blacklist-normalize | cut -d: -f2 } +# Usage: blacklist-cat | blacklist-get-url +# Prints URLs formed from the reference-id fields of the blacklist line(s) on stdin. +# Prints an empty line in the absence of reference. +blacklist-get-url() { + blacklist-normalize | awk -F: ' + BEGIN { + refs["debian"] = "http://bugs.debian.org/" + refs["fsf"] = "http://libreplanet.org/wiki/List_of_software_that_does_not_respect_the_Free_System_Distribution_Guidelines#" + refs["sv"] = "https://savannah.nongnu.org/bugs/?" + refs["fedora"] = "https://bugzilla.redhat.com/show_bug.cgi?id=" + refs["parabola"] = "https://labs.parabola.nu/issues/" + } + refs[$3] { print refs[$3] $4 } !refs[$3] { print "" }' +} + # Usage: blacklist-cat | blacklist-get-reason # Prints only the reason field of the blacklist line(s) on stdin. blacklist-get-reason() { -- cgit v1.2.2