Skip to content

Commit

Permalink
Display multibuild flavors when asking for local project sources
Browse files Browse the repository at this point in the history
There was a consistency gap between sources coming from local projects
and sources coming from remote projects. Multibuild flavors were only
shown for remote projects. Now the multibuild flavors are shown in both
cases.

Fixes openSUSE#16911
  • Loading branch information
danidoni committed Oct 9, 2024
1 parent 467a26d commit f83c258
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/api/app/controllers/source_project_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def show
@project = Project.find_by_name(project_name)
raise Project::UnknownObjectError, "Project not found: #{project_name}" unless @project

if @project.scmsync.present?
pass_to_backend
return
end

# we let the backend list the packages after we verified the project is visible
if params.key?(:view)
case params[:view]
Expand Down Expand Up @@ -52,7 +57,8 @@ def render_project_issues
end

def render_project_packages
@packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.pluck(:name)
# TODO: Display multibuild flavors when passing the expand param
@packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.sort_by(&:name)
render locals: { expand: params.key?(:expand) }, formats: [:xml]
end

Expand Down
11 changes: 8 additions & 3 deletions src/api/app/views/source_project/show.xml.builder
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
xml.directory(count: @packages.count) do
@packages.map do |name, project|
@packages.map do |package, project|
if expand
xml.entry(name: name, originproject: project)
xml.entry(name: package, originproject: project)
elsif package.multibuild?
xml.entry(name: package.name)
package.multibuild_flavors.each do |flavor|
xml.entry(name: "#{package.name}:#{flavor}", originpackage: package.name)
end
else
xml.entry(name: name)
xml.entry(name: package)
end
end
end

0 comments on commit f83c258

Please sign in to comment.