[bts-link] 01/01: add first try to get the new SF urls in

Sandro Tosi morph at moszumanska.debian.org
Tue Feb 20 04:27:03 UTC 2018


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch new-sourceforge
in repository bts-link.

commit 71923b17b5739f92785f36342173a778b31d4972
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Mar 24 19:46:50 2015 +0000

    add first try to get the new SF urls in
---
 btslink.yaml          | 15 +++++++++------
 remote/sourceforge.py | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/btslink.yaml b/btslink.yaml
index 3bfcffa..8df6911 100644
--- a/btslink.yaml
+++ b/btslink.yaml
@@ -412,12 +412,15 @@ remotes:
       uri: http://savannah.nongnu.org/bugs/
       uri-re: https?://savannah.nongnu.org/bugs/(?:index.php|)\?(?:(?:.*&)*item_id=)?([0-9]+)
   sourceforge2:
-    sourceforge:
-      uri: http://sf.net/tracker/
-      uri-re: https?://(?:sf|sourceforge).net/(?:support/tracker.php|tracker/)(?:index.php|)\?(.*)
-    sourceforge2:
-      uri: http://sourceforge.net/tracker2
-      uri-re: https?://sourceforge.net/tracker2/(?:index.php|)\?(?:.*&)*aid=([0-9]+)
+    sourceforge3:
+      uri: http://sourceforge.net/p/
+      uri-re: https?://sourceforge.net/p/.*
+#    sourceforge:
+#      uri: http://sf.net/tracker/
+#      uri-re: https?://(?:sf|sourceforge).net/(?:support/tracker.php|tracker/)(?:index.php|)\?(.*)
+#    sourceforge2:
+#      uri: http://sourceforge.net/tracker2
+#      uri-re: https?://sourceforge.net/tracker2/(?:index.php|)\?(?:.*&)*aid=([0-9]+)
   trac:
     aircrack-ng:
       uri: http://trac.aircrack-ng.org/
diff --git a/remote/sourceforge.py b/remote/sourceforge.py
index f9dff3c..173ee5c 100644
--- a/remote/sourceforge.py
+++ b/remote/sourceforge.py
@@ -68,6 +68,20 @@ class SourceForgeTrackerTwoData:
 
         if self.resolution == 'Duplicate':
             raise DupeExn(uri)
+
+
+class SourceForgeTrackerThreeData:
+    def __init__(self, uri, id):
+        self.id = id or failwith(uri, "SourceForge: no id")
+
+        soup  = BeautifulSoup(wget(uri))
+        #print soup.prettify()
+
+        self.status     = get_value2(soup, 'Status:') or failwith(uri, "SourceForge", exn=NoStatusExn)
+        self.resolution = get_value2(soup, 'Resolution:') or None
+
+        if self.resolution == 'Duplicate':
+            raise DupeExn(uri)
     
 
 class RemoteSourceForge(RemoteBts):
@@ -83,6 +97,7 @@ class RemoteSourceForge(RemoteBts):
         return "http://sourceforge.net/tracker/?func=detail&" + '&'.join(qs)
 
     def extractBugid(self, uri):
+        print "b"
         query = cgi.parse_qs(urlparse.urlparse(uri)[4])
         id = {}
         if not 'aid' in query: failwith(uri, "SourceForge: aid key is missing")
@@ -99,7 +114,28 @@ class RemoteSourceForge(RemoteBts):
 
 class RemoteSourceForgeTrackerTwo(RemoteSourceForge):
     def __init__(self, cnf):
+        print "c"
         RemoteBts.__init__(self, cnf, None, None, SourceForgeTrackerTwoData)
 
+class RemoteSourceForgeTrackerThree(RemoteSourceForge):
+    def __init__(self, cnf):
+        print "d"
+        RemoteBts.__init__(self, cnf, None, None, SourceForgeTrackerThreeData)
+
+    def extractBugid(self, uri):
+        print "a"
+        bugre = re.compile(r"https?://sourceforge.net/p/(?P<project>.*)/(?P<type>.*)/(?P<id>[0-9]+)$")
+        res = bugre.match(uri)
+        if res:
+            return res.groupdict()
+        else:
+            return None
+
+    # return a meaningful uri
+    def _getUri(self, bugId):
+        return "http://sourceforge.net/p/%(project)s/%(type)s/%(id)s" % bugId
+
 RemoteBts.register('sourceforge', RemoteSourceForge)
 RemoteBts.register('sourceforge2', RemoteSourceForgeTrackerTwo)
+RemoteBts.register('sourceforge3', RemoteSourceForgeTrackerThree)
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bts-link/bts-link.git



More information about the bts-link-commits mailing list