Module: Y2Packager::LicensesFetchers

Includes:
Yast::Logger
Defined in:
library/packages/src/lib/y2packager/licenses_fetchers.rb,
library/packages/src/lib/y2packager/licenses_fetchers/rpm.rb,
library/packages/src/lib/y2packager/licenses_fetchers/base.rb,
library/packages/src/lib/y2packager/licenses_fetchers/archive.rb,
library/packages/src/lib/y2packager/licenses_fetchers/libzypp.rb,
library/packages/src/lib/y2packager/licenses_fetchers/tarball.rb

Overview

This module contains licenses fetchers

Licenses can be retrieved from different places (libzypp, URLs, etc.). The classes defined in this module are able to retrieve licenses contents.

Defined Under Namespace

Classes: Archive, Base, Libzypp, Rpm, Tarball

Constant Summary collapse

KNOWN_SOURCES =

Candidate sources to retrieve the license content. Note that order matters because it will be chosen the first source able to fetch the content.

[:libzypp, :rpm, :tarball].freeze

Class Method Summary collapse

Class Method Details

.for(product_name) ⇒ Object?

Return the proper license fetcher

Parameters:

  • product_name (String)

    Product's name

Returns:

  • (Object, nil)

    The first valid fetcher found or nil



35
36
37
38
39
40
41
42
43
44
45
46
# File 'library/packages/src/lib/y2packager/licenses_fetchers.rb', line 35

def self.for(product_name)
  KNOWN_SOURCES.each do |source|
    log.info "Looking a license source for #{product_name} from #{source}"

    klass = const_get(source.to_s.capitalize)
    fetcher = klass.new(product_name)

    return fetcher if fetcher.found?
  end

  nil
end