summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIsaac David <isacdaavid@isacdaavid.info>2017-10-09 15:22:46 -0500
committerIsaac David <isacdaavid@isacdaavid.info>2017-10-09 15:22:46 -0500
commitce4bc72dbd590231186267c064ae1679c2ba1241 (patch)
tree118e5cc210c96b7a2bb68b4a63cf20e4c0176ad5 /src
parent37c8e4a16bf03509b032385482a1c13041adaf65 (diff)
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).
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/blacklist.sh15
1 files changed, 15 insertions, 0 deletions
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() {