Skip to content

Commit

Permalink
consider packages without popcon (dev)
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Severo <[email protected]>
Signed-off-by: Lucas Mattioli <[email protected]>
  • Loading branch information
knelasevero committed Jul 8, 2016
1 parent 1c78eb6 commit d408024
Showing 1 changed file with 42 additions and 25 deletions.
67 changes: 42 additions & 25 deletions pet/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,35 +175,52 @@ def __init__(self, session, named_trees,
nt, bugs.get(nt.source, []), suite_packages.get(nt.source, []),
tags.get(nt.package_id, [])))

def order_packages_by_popcon(self, packages):
has_no_popcon = []
packages_queue = PriorityQueue()
for package in packages:
package_popcon = popcon.package(package.name)

# The package has popcon
if package_popcon:
packages_queue.put((-package_popcon[package.name], package))
else:
has_no_popcon.append(package)

ordered_packages = []
while packages_queue.empty() is False:
_, package = packages_queue.get()
ordered_packages.append(package)

for package in has_no_popcon:
ordered_packages.append(package)

return ordered_packages

def classify(self):
self.packages = self.order_packages_by_popcon(self.packages)
classified = dict()
ordered_packages = PriorityQueue()
for p in self.packages:
if p.ready_for_upload:
cls = 'ready_for_upload'
elif p.has_rc_bugs:
cls = 'rc_bugs'
elif p.missing_tag:
cls = 'missing_tag'
elif not p.tags:
cls = 'new'
elif p.newer_upstream:
cls = 'new_upstream'
elif p.watch_problem:
cls = 'watch_problem'
elif p.bugs:
cls = 'bugs'
elif not p.is_tagged:
cls = 'wip'
for package in self.packages:
if package.ready_for_upload:
classification = 'ready_for_upload'
elif package.has_rc_bugs:
classification = 'rc_bugs'
elif package.missing_tag:
classification = 'missing_tag'
elif not package.tags:
classification = 'new'
elif package.newer_upstream:
classification = 'new_upstream'
elif package.watch_problem:
classification = 'watch_problem'
elif package.bugs:
classification = 'bugs'
elif not package.is_tagged:
classification = 'wip'
else:
cls = 'other'
classification = 'other'

package_popcon = popcon.package(p.name)
if package_popcon:
ordered_packages.put((-package_popcon[p.name], cls, p))
while ordered_packages.empty() is False:
_, cls, package = ordered_packages.get()
classified.setdefault(cls, []).append(package)
classified.setdefault(classification, []).append(package)

return classified

Expand Down

0 comments on commit d408024

Please sign in to comment.