Skip to content
This repository
Browse code

[webui] Fix wrong repo names in PackageController#rpmlint_log...

...valid XML id generation was wrong for repository names like '12.1'.
  • Loading branch information...
commit 402a4b9a68edc05e39f484d6804245e7231580bb 1 parent 847d4d1
Sascha Peilicke authored April 13, 2012
15  src/webui/app/controllers/package_controller.rb
@@ -1026,13 +1026,18 @@ def buildresult
1026 1026
 
1027 1027
   def rpmlint_result
1028 1028
     render :text => 'no ajax', :status => 400 and return unless request.xhr?
1029  
-    @repo_arch_hash = {}
1030  
-    @buildresult = find_cached(Buildresult, :project => @project, :package => @package, :view => 'status', :expires_in => 5.minutes )
1031  
-    @buildresult.each('result') do |result|
1032  
-      hash_key = valid_xml_id(result.value('repository'))
  1029
+    @repo_list, @repo_arch_hash = [], {}
  1030
+    @buildresult = find_hashed(Buildresult, :project => @project, :package => @package, :view => 'status', :expires_in => 5.minutes )
  1031
+    repos = [] # Temp var
  1032
+    @buildresult.elements('result') do |result|
  1033
+      hash_key = valid_xml_id(elide(result.value('repository'), 30))
1033 1034
       @repo_arch_hash[hash_key] ||= []
1034  
-      @repo_arch_hash[hash_key] << result.value('arch')
  1035
+      @repo_arch_hash[hash_key] << result['arch']
  1036
+      repos << result.value('repository')
1035 1037
     end if @buildresult
  1038
+    repos.uniq.each do |repo_name|
  1039
+      @repo_list << [repo_name, valid_xml_id(elide(repo_name, 30))]
  1040
+    end
1036 1041
     render :partial => 'rpmlint_result', :locals => {:index => params[:index]}
1037 1042
   end
1038 1043
 
2  src/webui/app/views/package/_rpmlint_result.html.erb
... ...
@@ -1,6 +1,6 @@
1 1
 <% index ||= '' %>
2 2
 <p>
3  
-  <%= select_tag("rpmlint_repo_select_#{index}", options_for_select(@repo_arch_hash.keys, @project.value('name').gsub(':', '_'))) %>
  3
+  <%= select_tag("rpmlint_repo_select_#{index}", options_for_select(@repo_list)) %>
4 4
   <% i = 0 %>
5 5
   <% @repo_arch_hash.each do |repo, arches| %>
6 6
     <%= select_tag("rpmlint_arch_select_#{index}_#{repo}", options_for_select(arches.sort), :class => "rpmlint_arch_select_#{index}") %>

0 notes on commit 402a4b9

Please sign in to comment.
Something went wrong with that request. Please try again.