Rev 21: Consider a package branch stale only if the package version is missing. in http://bazaar.launchpad.net/~canonical-bazaar/udd/hottest100

John Arbash Meinel john at arbash-meinel.com
Tue Jan 26 12:14:31 GMT 2010


At http://bazaar.launchpad.net/~canonical-bazaar/udd/hottest100

------------------------------------------------------------
revno: 21
revision-id: john at arbash-meinel.com-20100126121400-0qd1k65umg5nd0l1
parent: robertc at robertcollins.net-20100126114748-p1gq56e2pocn5oxl
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hottest100
timestamp: Tue 2010-01-26 06:14:00 -0600
message:
  Consider a package branch stale only if the package version is missing.
  
  Use the launchpad project linking information to determine the actual
  Bazaar branch we should be checking for being up-to-date.
-------------- next part --------------
=== modified file 'check-hottest.py'
--- a/check-hottest.py	2010-01-26 11:45:31 +0000
+++ b/check-hottest.py	2010-01-26 12:14:00 +0000
@@ -42,6 +42,7 @@
         elements = line.split(' ')
         self.name = elements[0]
         self.tags = set(elements[1:])
+        self.upstream_branch_url = None
 
     def __repr__(self):
         return '%s(%s)' % (self.__class__.__name__, self.name)
@@ -124,7 +125,8 @@
 
     lp = launchpad.Launchpad.login('check-hottest', '', '', 
                                    launchpad.EDGE_SERVICE_ROOT)
-    archive = lp.distributions['ubuntu'].main_archive
+    distribution = lp.distributions['ubuntu']
+    archive = distribution.main_archive
 
     today = datetime.datetime.now()
     reuse_transports = []
@@ -155,20 +157,20 @@
             package_branch_url = 'lp:ubuntu/%s' % (package.name,)
             age, tags = get_branch_age_and_tags(package_branch_url)
             published_source = archive.getPublishedSources(
-                source_name=package.name, status='Published')
-            source_package_version = published_source[0].source_package_version
+                source_name=package.name, status='Published')[0]
+            source_package_version = published_source.source_package_version
             if source_package_version not in tags:
                 categorize('missing_soyuz', package)
                 package_status = 'missing'
             else:
                 package_status = 'up-to-date'
+                categorize('ok', package)
             output_stream.write(fmt_str % (
                 package_branch_url, age.days, source_package_version,
                 package_status))
-            if age.days < opts.stale_days:
-                categorize('ok', package)
-            else:
-                categorize('stale', package)
+            source_package = published_source.distro_series.getSourcePackage(name=package.name)
+            source_branch = source_package.productseries.branch
+            package.upstream_branch_url = source_branch.bzr_identity
         except errors.BzrError, e:
             # the launchpad plugin sends 
             # <class 'bzrlib.errors.InvalidURL'> Invalid url supplied to transport:
@@ -180,12 +182,15 @@
             else:
                 output_stream.write('  %s\n' % (e,))
                 categorize('broken', package)
+        if package.upstream_branch_url is None:
+            categorize('missing_upstream_link', package)
+            continue
         try:
-            upstream_branch_url = 'lp:%s' % (package.name,)
-            age, _ = get_branch_age_and_tags(upstream_branch_url,
+            age, _ = get_branch_age_and_tags(package.upstream_branch_url,
                                              tags=False)
             output_stream.write(fmt_str
-                                % (upstream_branch_url, age.days, '', ''))
+                                % (package.upstream_branch_url, age.days,
+                                   '', ''))
             if age.days < opts.stale_days:
                 categorize('ok_upstream', package)
             else:



More information about the bazaar-commits mailing list