[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#810312: marked as done (tracker.debian.org: Add debian/copyright link)



Your message dated Fri, 8 Jan 2016 12:06:20 +0100
with message-id <20160108110620.GC29263@home.ouaza.com>
and subject line Re: Bug#810312: tracker.debian.org: Add debian/copyright link
has caused the Debian Bug report #810312,
regarding tracker.debian.org: Add debian/copyright link
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
810312: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810312
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: tracker.debian.org
Severity: wishlist
Tags: patch

Dear Maintainer,

I would like to access to the copyright information of packages on the distro-
tracker.
Examples https://sources.debian.net/copyright/license/python-django/1.9.1-1/
https://sources.debian.net/copyright/license/gnubg/1.05.000-3/

I attach a patch that provides a link in the links panel



-- System Information:
Debian Release: 8.2
  APT prefers testing
  APT policy: (1000, 'testing'), (1000, 'stable'), (995, 'stable'), (750, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From 015cf0331508af79cd2afea4ab384964347ba5d0 Mon Sep 17 00:00:00 2001
From: Orestis Ioannou <orestis@oioannou.com>
Date: Sat, 2 Jan 2016 14:36:46 +0200
Subject: [PATCH] Provide link to debsources copyright tracker

---
 distro_tracker/vendor/debian/tests.py          | 13 ++++++++++++-
 distro_tracker/vendor/debian/tracker_panels.py | 10 ++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/distro_tracker/vendor/debian/tests.py b/distro_tracker/vendor/debian/tests.py
index 5757b41..c641cad 100644
--- a/distro_tracker/vendor/debian/tests.py
+++ b/distro_tracker/vendor/debian/tests.py
@@ -2738,7 +2738,14 @@ class CodeSearchLinksTest(TestCase):
     def browse_link_in_content(self, content):
         html = soup(content)
         for a_tag in html.findAll('a', {'href': True}):
-            if a_tag['href'].startswith('https://sources.debian.net'):
+            if a_tag['href'].startswith('https://sources.debian.net/src'):
+                return True
+        return False
+
+    def copyright_link_in_content(self, content):
+        html = soup(content)
+        for a_tag in html.findAll('a', {'href': True}):
+            if a_tag['href'].startswith('https://sources.debian.net/copyright'):
                 return True
         return False
 
@@ -2757,6 +2764,7 @@ class CodeSearchLinksTest(TestCase):
         response = self.get_package_page_response(self.package.name)
 
         self.assertTrue(self.browse_link_in_content(response.content))
+        self.assertTrue(self.copyright_link_in_content(response.content))
         self.assertFalse(self.search_form_in_content(response.content))
 
     def test_package_not_in_allowed_repository(self):
@@ -2771,6 +2779,7 @@ class CodeSearchLinksTest(TestCase):
         response = self.get_package_page_response(self.package.name)
 
         self.assertFalse(self.browse_link_in_content(response.content))
+        self.assertFalse(self.copyright_link_in_content(response.content))
         self.assertFalse(self.search_form_in_content(response.content))
 
     def test_package_in_unstable(self):
@@ -2784,6 +2793,7 @@ class CodeSearchLinksTest(TestCase):
 
         response_content = response.content.decode('utf-8')
         self.assertTrue(self.browse_link_in_content(response_content))
+        self.assertTrue(self.copyright_link_in_content(response_content))
         self.assertTrue(self.search_form_in_content(response_content))
 
     def test_pseudo_package(self):
@@ -2797,6 +2807,7 @@ class CodeSearchLinksTest(TestCase):
 
         response_content = response.content.decode('utf-8')
         self.assertFalse(self.browse_link_in_content(response_content))
+        self.assertFalse(self.copyright_link_in_content(response_content))
         self.assertFalse(self.search_form_in_content(response_content))
 
     def test_code_search_view_missing_query_parameter(self):
diff --git a/distro_tracker/vendor/debian/tracker_panels.py b/distro_tracker/vendor/debian/tracker_panels.py
index 49ba680..35e3b2e 100644
--- a/distro_tracker/vendor/debian/tracker_panels.py
+++ b/distro_tracker/vendor/debian/tracker_panels.py
@@ -132,7 +132,9 @@ class SourceCodeSearchLinks(LinksPanel.ItemProvider):
         'stable',
         'oldstable',
     )
-    SOURCES_URL_TEMPLATE = 'https://sources.debian.net/src/{package}/{suite}/'
+    DEBSOURCES = 'https://sources.debian.net/'
+    SOURCES_TEMPLATE = DEBSOURCES + 'src/{package}/{suite}/'
+    COPYRIGHT_TEMPLATE = DEBSOURCES + 'copyright/license/{package}/{suite}/'
     SEARCH_FORM_TEMPLATE = (
         '<form class="code-search-form"'
         ' action="' + reverse('dtracker-code-search') + '"'
@@ -152,8 +154,12 @@ class SourceCodeSearchLinks(LinksPanel.ItemProvider):
         for allowed_repo in self.ALLOWED_REPOSITORIES:
             if allowed_repo in repositories:
                 links.append(LinksPanel.SimpleLinkItem(
+                    'view copyright',
+                    self.COPYRIGHT_TEMPLATE.format(
+                        package=self.package.name, suite=allowed_repo)))
+                links.append(LinksPanel.SimpleLinkItem(
                     'browse source code',
-                    self.SOURCES_URL_TEMPLATE.format(
+                    self.SOURCES_TEMPLATE.format(
                         package=self.package.name, suite=allowed_repo)))
                 break
 
-- 
2.1.4


--- End Message ---
--- Begin Message ---
On Fri, 08 Jan 2016, Orestis Ioannou wrote:
> I guess it doesn't really make sense to change the link to debsources
> right? In that case please close the bug and sorry for the noise :)

Yes, I would not see the point either. Also we have #754677 which request
to make the various links more visible by adding some sort of redirection
from the link panel to the other panel...

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/

--- End Message ---

Reply to: