Skip to content

Commit

Permalink
Get the project name from the distribution list
Browse files Browse the repository at this point in the history
  • Loading branch information
voegelas committed Dec 20, 2021
1 parent 0883216 commit ecc1d2f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/controllers/download_controller.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class DownloadController < ApplicationController
class DownloadController < OBSController
before_action :set_colors, :hide_search_box

# display documentation
Expand Down Expand Up @@ -58,7 +58,7 @@ def package
repo: "https://download.opensuse.org/repositories/#{@project}/#{distro}/",
package: {}
}
data[distro][:flavor] = set_distro_flavor e.attributes['baseproject']
data[distro][:flavor] = set_distro_flavor get_project(distro, e.attributes['baseproject'])
case e.attributes['baseproject']
when /^(DISCONTINUED:)?openSUSE:/, /^(DISCONTINUED:)?SUSE:SLE-/
data[distro][:ymp] = "https://software.opensuse.org/ymp/#{@project}/#{distro}/#{@package}.ymp"
Expand Down Expand Up @@ -102,7 +102,7 @@ def pattern
repo: "https://download.opensuse.org/repositories/#{@project}/#{distro}/",
package: {}
}
data[distro][:flavor] = set_distro_flavor e.attributes['baseproject']
data[distro][:flavor] = set_distro_flavor get_project(distro, e.attributes['baseproject'])
case e.attributes['baseproject']
when /^(DISCONTINUED:)?openSUSE:/, /^(DISCONTINUED:)?SUSE:SLE-/
data[distro][:ymp] = "https://download.opensuse.org/repositories/#{e.attributes['filepath']}"
Expand Down Expand Up @@ -147,6 +147,17 @@ def render_page(page_template)
end
end

def get_project(distro, baseproject)
project = baseproject
unless @distributions.nil?
distribution = @distributions.find { |d| d[:reponame] == distro }
unless distribution.nil?
project = distribution[:project]
end
end
project
end

def set_distro_flavor(distro)
case distro
when /^(DISCONTINUED:)?openSUSE:/
Expand Down

0 comments on commit ecc1d2f

Please sign in to comment.