[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-backports
Subject:    [PATCH 07/11] rel-html: revise stable releases prior to display
From:       "Luis R. Rodriguez" <mcgrof () do-not-panic ! com>
Date:       2014-01-24 22:47:12
Message-ID: 1390603636-27841-8-git-send-email-mcgrof () do-not-panic ! com
[Download RAW message or body]

rel-html currently will look for each supported release tag
on earch base URL it enters and if it finds any major release
it'll eventually display it. This is displaying some old
stable releases on supported releases which have sublevels
on the releases. This adds a sanity check on the releases
that revises the weights of each release against the supplied
release tags.

The final stable releases shown are only the releases that
have the *max weight* for the supplied supported release tags.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 rel-html.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/rel-html.py b/rel-html.py
index ae61187..95d4877 100755
--- a/rel-html.py
+++ b/rel-html.py
@@ -358,6 +358,12 @@ class index_tarball_hunter(HTMLParser):
         p = re.compile(index_parser.release_extension + '$')
         rel_name = p.sub("", value)
 
+        base_release = ''
+        for r in index_parser.supported:
+            if (r in value):
+                base_release = r
+                break
+
         ver = rel_name.lstrip(rel_match['rel_name'] + '-')
 
         p = re.compile('-[usnpc]*$')
@@ -378,6 +384,7 @@ class index_tarball_hunter(HTMLParser):
             return
 
         tar = dict(version=short_ver,
+                   base_release=r,
                    weight=w,
                    rel=rel_name,
                    specifics=rel_specifics,
@@ -463,10 +470,27 @@ class index_tarball_hunter(HTMLParser):
                               specifics['RELMOD_UPDATE'],
                               specifics['RELMOD_TYPE']))
 
+    def is_biggest_tarball(self, pivot_tar, tars):
+        other_greater = 0
+        for tar in tars:
+            if pivot_tar.get('rel') == tar.get('rel'):
+                continue
+            if pivot_tar.get('base_release') == tar.get('base_release'):
+                if pivot_tar.get('weight') < tar.get('weight'):
+                    other_greater = other_greater + 1
+
+        if (other_greater == 0):
+            return True
+
+        return False
+
     def update_rel_candidates(self):
         index_parser = self.index_parser
         for tar in self.tarballs:
             index_parser.rel_html_rels.append(tar)
+        for tar in index_parser.rel_html_rels:
+            if not self.is_biggest_tarball(tar, index_parser.rel_html_rels):
+                index_parser.rel_html_rels.remove(tar)
 
     def is_next_rel(self, value):
         index_parser = self.index_parser
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic