Package: buildd.debian.org
Tags: patch

Hi,
The Changelog and packages.d.o links on suite-backports(-sloppy) package status
pages (e.g. [1]) point to the non-backports versions. I have attached a
patch to fix this.

Regards,
James

[1] 
https://buildd.debian.org/status/package.php?p=libreoffice&suite=jessie-backports
>From 80f162cc8aafa36126e9d42167c929a9eaffe4b2 Mon Sep 17 00:00:00 2001
From: James Clarke <[email protected]>
Date: Mon, 19 Jun 2017 15:52:41 +0100
Subject: [PATCH] library.php: Use -backports(-sloppy) versions for links where
 appropriate

---
 library.php | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/library.php b/library.php
index fe6269f..72e7391 100644
--- a/library.php
+++ b/library.php
@@ -785,12 +785,12 @@ function pkg_version($version, $binnmu) {
     return $version;
 }
 
-function strip_suite ($suite) {
-  $pos = strpos($suite, "-");
-  if ($pos === false)
-    return $suite;
+function strip_suite ($suite, $strip_bpo=false) {
+  if ($strip_bpo)
+    preg_match("/^[^-]*/", $suite, $suite_base);
   else
-    return substr($suite, 0, $pos);
+    preg_match("/^[^-]*(-backports(-sloppy)?)?/", $suite, $suite_base);
+  return $suite_base[0];
 }
 
 function grep_file($maintainer, $file) {
@@ -863,6 +863,7 @@ function changelog_link($package, $suite) {
 
 function pkg_links($packages, $suite, $p=true, $mail="") {
   $suite = strip_suite($suite);
+  $suite_no_bpo = strip_suite($suite, true);
   $links = array();
   if ($p) echo "<p>";
   if (count($packages) == 1) {
@@ -891,7 +892,7 @@ function pkg_links($packages, $suite, $p=true, $mail="") {
     array_push($links,
               sprintf("<a 
href=\"https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=%s;dist=%s\";>Bugs</a>",
                       $srcs,
-                      urlencode($suite))
+                      urlencode($suite_no_bpo))
               );
   }
   echo implode(" &ndash; ", $links);
-- 
2.13.1

Reply via email to