Mailinglist Archive: opensuse-buildservice (182 mails)

< Previous Next >
[opensuse-buildservice] [patch] Add info about version/upstream version in status page
  • From: Vincent Untz <vuntz@xxxxxxxxxxxx>
  • Date: Tue, 2 Feb 2010 16:47:42 +0100
  • Message-id: <20100202154742.GZ1302@xxxxxxxxx>
Hi,

Here's a small patch to make use of the new attributes that are defined
for upstream version to list packages that have a new upstream version
in the status page.

Note that the version comparison is very basic (version_a < version_b);
still, it should be working fine most of the time. Of course, ideally,
we'd have something a bit more solid -- ideas for this welcome.

I didn't add a "Only show outdated packages" checkbox, but that was
mostly because having two checkboxes both saying "Only show..." doesn't
make much sense :-) That's something we can work out next.

Cheers,

Vincent

--
Les gens heureux ne sont pas press├ęs.
From 791043ed9cda62880f504d6175875c3b5fd2f73a Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@xxxxxxxxxxxx>
Date: Tue, 2 Feb 2010 16:20:45 +0100
Subject: [PATCH] add version/upstream version to status page

---
src/webui/app/controllers/project_controller.rb | 33 +++++++++++++++++++++-
src/webui/app/views/project/status.rhtml | 14 +++++++++
2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/webui/app/controllers/project_controller.rb
b/src/webui/app/controllers/project_controller.rb
index d029354..f4ca3d7 100644
--- a/src/webui/app/controllers/project_controller.rb
+++ b/src/webui/app/controllers/project_controller.rb
@@ -820,6 +820,26 @@ class ProjectController < ApplicationController
end
end

+ attributes = PackageAttribute.find(:namespace => 'openSUSE',
+ :name => 'UpstreamVersion', :project => @project, :expires_in =>
2.minutes)
+ upstream_versions = Hash.new
+ attributes.data.find('//package//values').each do |p|
+ # unfortunately libxml's find_first does not work on nodes, but on
document (known bug)
+ p.each_element do |v|
+ upstream_versions[p.parent['name']] = v.content
+ end
+ end
+
+ attributes = PackageAttribute.find(:namespace => 'openSUSE',
+ :name => 'UpstreamTarballURL', :project => @project, :expires_in =>
2.minutes)
+ upstream_urls = Hash.new
+ attributes.data.find('//package//values').each do |p|
+ # unfortunately libxml's find_first does not work on nodes, but on
document (known bug)
+ p.each_element do |v|
+ upstream_urls[p.parent['name']] = v.content
+ end
+ end
+
raw_requests = Rails.cache.fetch("requests_new", :expires_in => 5.minutes)
do
Collection.find(:what => 'request', :predicate => "(state/@name='new')")
end
@@ -868,6 +888,15 @@ class ProjectController < ApplicationController
currentpack['requests_from'].concat(submits[key])
end

+ currentpack['version'] = p.version
+ if upstream_versions.has_key? p.name
+ upstream_version = upstream_versions[p.name]
+ if p.version < upstream_version
+ currentpack['upstream_version'] = upstream_version
+ currentpack['upstream_url'] = upstream_urls[p.name] if
upstream_urls.has_key? p.name
+ end
+ end
+
currentpack['md5'] = p.srcmd5

if p.has_element? :develpack
@@ -904,8 +933,8 @@ class ProjectController < ApplicationController
if @limit_to_fails
next if !currentpack['firstfail']
else
- next unless (currentpack['firstfail'] or currentpack['failedcomment']
or !currentpack['problems'].empty? or
- !currentpack['requests_from'].empty? or
!currentpack['requests_to'].empty?)
+ next unless (currentpack['firstfail'] or currentpack['failedcomment']
or currentpack['upstream_version'] or
+ !currentpack['problems'].empty? or
!currentpack['requests_from'].empty? or !currentpack['requests_to'].empty?)
end
@packages << currentpack
end
diff --git a/src/webui/app/views/project/status.rhtml
b/src/webui/app/views/project/status.rhtml
index c2afad4..765ae22 100644
--- a/src/webui/app/views/project/status.rhtml
+++ b/src/webui/app/views/project/status.rhtml
@@ -68,6 +68,8 @@
<th width='4%'>Maintainer</th>
<th width='20%'>Requests</th>
<th width="20%">Comment</th>
+ <th width="4%">Version</th>
+ <th width="4%">Upstream</th>
</tr>
</thead>
<tbody>
@@ -116,6 +118,18 @@
<td id="comment_<%= p['name'] %>">
<%= show_status_comment( p['failedcomment'], p['name'],
p['firstfail'], comments_to_clear ) %>
</td>
+ <td><%= p['version'] %></td>
+ <td>
+ <%= if p['upstream_version']
+ if p['upstream_url']
+ "<a href=\"" + p['upstream_url'] + "\">" +
p['upstream_version'] + "</a>"
+ else
+ p['upstream_version']
+ end
+ else
+ "--"
+ end -%>
+ </td>
</tr>
<% end %>
</tbody>
--
1.6.4.2

< Previous Next >
Follow Ups