Module: Yast::PackagerLoadReleaseNotesInclude

Defined in:
../../src/include/packager/load_release_notes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_packager_load_release_notes(include_target)



14
15
16
17
18
19
20
21
22
23
24
# File '../../src/include/packager/load_release_notes.rb', line 14

def initialize_packager_load_release_notes(include_target)
  Yast.import "Pkg"
  textdomain "packager"

  Yast.import "Language"
  Yast.import "Report"
  Yast.import "Stage"

  # release notes
  @media_text = ""
end

- (Object) load_release_notes(source_id)

function to load release notes



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File '../../src/include/packager/load_release_notes.rb', line 29

def load_release_notes(source_id)
  if source_id == nil || Ops.less_than(source_id, 0)
    Builtins.y2error("Source_id: %1", source_id)
    return false
  end

  path_to_relnotes = "/docu"
  filename_templ = UI.TextMode ? "/RELEASE-NOTES.%1.txt" : "/RELEASE-NOTES.%1.rtf"

  path_templ = path_to_relnotes + filename_templ
  Builtins.y2debug("Path template: %1", path_templ)

  # try 'en_UK' for 'en_UK'
  tmp = Builtins.sformat(path_templ, Language.language)
  Builtins.y2debug("Trying to get %1", tmp)
  tmp = Pkg.SourceProvideDigestedFile(
    source_id, # optional
    1,
    tmp,
    true
  )

  # try 'es' for 'es_ES'
  if tmp == nil
    tmp = Builtins.sformat(
      path_templ,
      Builtins.substring(Language.language, 0, 2)
    )
    Builtins.y2debug("Trying to get %1", tmp)
    tmp = Pkg.SourceProvideDigestedFile(
      source_id, # optional
      1,
      tmp,
      true
    )
  end

  # try 'en'
  if tmp == nil
    tmp = Builtins.sformat(path_templ, "en")
    Builtins.y2debug("Trying to get %1", tmp)
    tmp = Pkg.SourceProvideDigestedFile(
      source_id, # optional
      1,
      tmp,
      true
    )
  end

  # no other fallback
  return false if tmp == nil

  # read the release notes content
  @media_text = Convert.to_string(
    SCR.Read(path(".target.string"), [tmp, ""])
  )
  return true if @media_text != "" && @media_text != nil

  false
end