Class: Y2Packager::LicensesFetchers::Libzypp

Inherits:
Base
  • Object
show all
Defined in:
library/packages/src/lib/y2packager/licenses_fetchers/libzypp.rb

Overview

This class is responsible for obtaining the license and license content of a given product from libzypp.

Constant Summary

Constants inherited from Base

Base::DEFAULT_LANG

Instance Attribute Summary

Attributes inherited from Base

#product_name

Instance Method Summary collapse

Methods inherited from Base

#content, #found?, #initialize

Constructor Details

This class inherits a constructor from Y2Packager::LicensesFetchers::Base

Instance Method Details

#confirmation_required?Boolean

Determine whether the license should be accepted or not

Returns:

  • (Boolean)

    true if license acceptance is required


39
40
41
# File 'library/packages/src/lib/y2packager/licenses_fetchers/libzypp.rb', line 39

def confirmation_required?
  Yast::Pkg.PrdNeedToAcceptLicense(product_name)
end

#localesArray<String>

Return available locales for product's license

Returns:

  • (Array<String>)

    Language codes ("de_DE", "en_US", etc.)


23
24
25
26
27
28
29
30
31
32
33
34
# File 'library/packages/src/lib/y2packager/licenses_fetchers/libzypp.rb', line 23

def locales
  locales = Yast::Pkg.PrdLicenseLocales(product_name)

  if locales.nil?
    log.error "Error getting the list of available license translations for '#{product_name}'"
    return []
  end

  empty_idx = locales.index("")
  locales[empty_idx] = DEFAULT_LANG if empty_idx
  locales
end