Class: Yast::SourceManagerClass

Inherits:
Module
  • Object
show all
Defined in:
src/modules/SourceManager.rb,
src/modules/SourceManager.rb

Overview

Representation of the configuration of source-manager. Input and output routines.

Instance Method Summary collapse

Instance Method Details

#AbortBoolean

Abort function


60
61
62
63
64
# File 'src/modules/SourceManager.rb', line 60

def Abort
  return false if fun_ref(method(:AbortFunction), "boolean ()").nil?

  AbortFunction()
end

#AbortFunctionObject

Abort function return boolean return true if abort


54
55
56
# File 'src/modules/SourceManager.rb', line 54

def AbortFunction
  false
end

#AddUpdateSources(urls) ⇒ Object

Used by registration. ZMD sync has been disabled - ZLM7.3 on sle11 supports only HTTP and FTP repositories, sync would fail for other types. See bnc#480845 for more details.


525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'src/modules/SourceManager.rb', line 525

def AddUpdateSources(urls)
  urls = deep_copy(urls)
  ret = []

  # prepare for lookup of known aliases
  aliases = get_alias_to_id
  Builtins.y2milestone("alias mapping: %1", aliases)
  by_url = get_url_to_id
  Builtins.y2milestone("url mapping: %1", by_url)

  # add the repositories
  # but do not make duplicates (#168740)
  # we detect them based on alias that suse_register gives us (#158850#c17)
  # / (but only for SLE... :-/ )
  # / Need to test what happens when we get two different update
  # / servers for SL
  # / Anyway that means only that #168740 remains unfixed for SL
  Builtins.foreach(urls) do |url|
    Builtins.y2milestone("Should add an update repository: %1", url)
    # inst_addon_update_sources also calls Pkg::SourceCreate
    # but it already skips duplicates

    # check if alias already there
    # if yes, delete the old one
    todel = SourceByAliasOrUrl(url, aliases, by_url)
    if todel != -1
      Builtins.y2milestone("deleting the old copy, repository %1", todel)
      Pkg.SourceDelete(todel)
    end
    # then add the new one
    Builtins.y2milestone("Adding update repository...")
    toadd = Pkg.SourceCreate(url, "/")
    # adding failed, try http fallback for ftp repo (#227059)
    if toadd.nil? || Ops.less_than(toadd, 0)
      parsed_url = URL.Parse(url)
      scheme = Ops.get_string(parsed_url, "scheme", "")

      if Builtins.tolower(scheme) == "ftp"
        Builtins.y2milestone(
          "Cannot add FTP update repository, trying HTTP..."
        )

        Ops.set(parsed_url, "scheme", "http")
        fallback_url = URL.Build(parsed_url)

        toadd = Pkg.SourceCreate(fallback_url, "/")
        url = fallback_url
      end
    end
    if toadd != -1 && !toadd.nil?
      ret = Builtins.add(ret, url) # #180820#c26

      # is there any patch available?
      patches = Pkg.ResolvableProperties("", :patch, "")

      if Ops.greater_than(Builtins.size(patches), 0)
        # loaded target is required to get list of applicable patches (#270919)
        Builtins.y2milestone(
          "Repository %1 provides %2 patches, loading target...",
          url,
          Builtins.size(patches)
        )
        # suppose that we are running in an installed system and use "/" directory
        Pkg.TargetInitialize("/")
        Pkg.TargetLoad
      end
    end
  end

  deep_copy(ret)
end

#AskForCD(message) ⇒ Object


598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'src/modules/SourceManager.rb', line 598

def AskForCD(message)
  cdroms = SCR.Read(path(".probe.cdrom"))
  multiple_drives = (cdroms.size > 1)
  drives_sel = Empty()
  if multiple_drives
    devices = cdroms.map do |d|
      Item(Id(d["dev_name"] || ""), "#{d["model"]} (#{d["dev_name"]})")
    end
    # To adjust the width of the dialog, look for the more lengthy device label
    # (and add some extra space for the frame)
    min_width = devices.map { |d| d[1].to_s.size }.max + 4
    drives_sel = MinSize(min_width, 5, SelectionBox(Id(:drives), _("&Drive to eject"), devices))
  end
  contents = HBox(
    HSpacing(1),
    VBox(
      VSpacing(0.5),
      Label(message),
      VSpacing(0.5),
      drives_sel,
      VSpacing(0.5),
      HBox(
        HStretch(),
        HWeight(1, PushButton(Id(:cont), Label.ContinueButton)),
        HWeight(1, PushButton(Id(:cancel), Label.CancelButton)),
        HWeight(1, PushButton(Id(:eject), _("&Eject"))),
        HStretch()
      ),
      VSpacing(0.5)
    ),
    HSpacing(1)
  )
  UI.OpenDialog(contents)
  if multiple_drives
    UI.ChangeWidget(
      Id(:drives),
      :CurrentItem,
      Ops.get_string(cdroms, [0, "dev_name"], "")
    )
  end
  UI.SetFocus(Id(:cont))
  ret = nil
  loop do
    ret = Convert.to_symbol(UI.UserInput)
    break if ret == :cont || ret == :cancel
    if ret == :eject
      if multiple_drives
        device = Convert.to_string(UI.QueryWidget(Id(:drives), :Value))
        SCR.Execute(
          path(".target.bash"),
          Builtins.sformat("/bin/eject %1", device)
        )
      else
        SCR.Execute(
          path(".target.bash"),
          Builtins.sformat(
            "/bin/eject %1",
            Ops.get_string(cdroms, [0, "dev_name"], "")
          )
        )
      end
    end
    ret = nil
  end

  result = { "continue" => ret == :cont }

  if multiple_drives
    result = Builtins.add(
      result,
      "device",
      Convert.to_string(UI.QueryWidget(Id(:drives), :Value))
    )
  end

  UI.CloseDialog

  deep_copy(result)
end

#CommitSourcesObject

Commit changed repositories


134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'src/modules/SourceManager.rb', line 134

def CommitSources
  Builtins.y2debug("In: %1  Out: %2", @sourceStatesIn, @sourceStatesOut)
  success = false
  loop do
    success = Pkg.SourceEditSet(@sourceStatesOut)
    break if success

    # popup message header
    message1 = _("Unable to save changes to the repository.\n")
    # popup message, after message header, header of details
    message2 = Ops.add(_("Details:") + "\n", Pkg.LastError)
    # end of popup message, question
    message2 = Ops.add(Ops.add(message2, "\n"), _("Try again?"))

    tryagain = Popup.YesNo(Ops.add(Ops.add(message1, "\n"), message2))
    break if !tryagain
  end
  success
end

#createItem(_index, source) ⇒ Object

Create Summary Item


346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'src/modules/SourceManager.rb', line 346

def createItem(_index, source)
  source = deep_copy(source)
  id = Ops.get_integer(source, "SrcId", 0)
  generalData = Pkg.SourceGeneralData(id)
  productData = Pkg.SourceProductData(id)
  sitem = ""
  # status info, to be used inside summary
  status = Ops.get_boolean(source, "enabled", true) ? _("Enabled") : _("Disabled")
  color = Ops.get_boolean(source, "enabled", true) ? "#006600" : "#FF0000"
  sitem = Ops.add(
    sitem,
    HTML.Colorize(Ops.add(Ops.add("[", status), "] "), color)
  )
  # translators: name of a repository if no other idenfication found
  sitem = Ops.add(
    sitem,
    Ops.get_locale(
      productData,
      "label",
      Ops.get_locale(generalData, "type", _("unknown"))
    )
  )
  sitem = Ops.add(
    Ops.add(Ops.add(sitem, " ( "), Ops.get_string(generalData, "url", "")),
    ")"
  )
  sitem
end

#createOverviewItem(index, source) ⇒ Object

Create Repository Item for Overview


376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'src/modules/SourceManager.rb', line 376

def createOverviewItem(index, source)
  source = deep_copy(source)
  id = Ops.get_integer(source, "SrcId", 0)
  generalData = Pkg.SourceGeneralData(id)
  productData = Pkg.SourceProductData(id)

  item = Item(
    Id(index),
    # corresponds to the "Enable/Disable" button
    Ops.get_boolean(source, "enabled", true) ? _("On") : _("Off"),
    Ops.get_locale(
      productData,
      "label",
      Ops.get_locale(generalData, "type", _("Unknown"))
    ),
    Ops.get_string(generalData, "url", "")
  )

  deep_copy(item)
end

#createSource(url) ⇒ Object

Create a repository from an URL


256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'src/modules/SourceManager.rb', line 256

def createSource(url)
  return :cancel if url == ""

  if !Mode.commandline
    UI.OpenDialog(
      VBox(VSpacing(0.2), Label(_("Adding repository...")), VSpacing(0.2))
    )
  end
  @newSources = Pkg.SourceScan(url, "")

  UI.CloseDialog if !Mode.commandline

  if Builtins.size(@newSources).zero?
    message1 = Builtins.sformat(
      _("Unable to create repository\nfrom URL '%1'."),
      URL.HidePassword(url)
    )

    message2 = Ops.add(_("Details:") + "\n", Pkg.LastError)
    # end of popup message, question
    message2 = Ops.add(Ops.add(message2, "\n"), _("Try again?"))

    tryagain = Popup.YesNo(Ops.add(Ops.add(message1, "\n"), message2))
    if tryagain
      :again
    else
      :cancel
    end
  else
    ul_sources = Builtins.filter(@newSources) do |s|
      src_data = Pkg.SourceGeneralData(s)
      src_type = Ops.get_string(src_data, "type", "")
      src_type == "YaST"
    end
    if Builtins.size(ul_sources).zero?
      if !Popup.AnyQuestion(
        Popup.NoHeadline,
        # continue-back popup
        _(
          "There is no product information available at the given location.\n" \
            "If you expected to to point a product, go back and enter\n" \
            "the correct location.\n" \
            "To make rpm packages located at the specified location available\n" \
            "in the packages selection, continue.\n"
        ),
        Label.ContinueButton,
        Label.BackButton,
        :focus_yes
      )
        return :again
      end
    end
    Builtins.foreach(@newSources) do |id|
      sourceState = { "SrcId" => id, "enabled" => true }
      @sourceStatesOut = Builtins.add(@sourceStatesOut, sourceState)
    end
    :ok
  end
end

#deleteSourceByIndex(idx) ⇒ Object

Delete Repository by the repository index


334
335
336
337
# File 'src/modules/SourceManager.rb', line 334

def deleteSourceByIndex(idx)
  @sourceStatesOut = Builtins.remove(@sourceStatesOut, idx)
  nil
end

#deleteSourceBySrcId(src_id) ⇒ Object

Delete repository by Repository ID


317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'src/modules/SourceManager.rb', line 317

def deleteSourceBySrcId(src_id)
  Builtins.y2debug("removing repository: %1 %2", src_id, @sourceStatesOut)
  @numSources = Builtins.size(@sourceStatesOut)
  i = 0

  while Ops.less_than(i, @numSources)
    if Ops.get_integer(@sourceStatesOut, [i, "SrcId"], -1) == src_id
      @sourceStatesOut = Builtins.remove(@sourceStatesOut, i)
      break
    end

    i = Ops.add(i, 1)
  end
  nil
end

#deleteSourceByUrl(url) ⇒ Object

Delete Repository by repository URL


340
341
342
343
# File 'src/modules/SourceManager.rb', line 340

def deleteSourceByUrl(url)
  deleteSourceBySrcId(getSourceId(url))
  nil
end

#ExportHash

Dump the repository-manager settings to a single map (For use by autoinstallation.)


208
209
210
# File 'src/modules/SourceManager.rb', line 208

def Export
  {}
end

#get_alias_to_idObject


481
482
483
# File 'src/modules/SourceManager.rb', line 481

def get_alias_to_id
  get_attr_to_id("alias")
end

#get_attr_to_id(attr) ⇒ Object


468
469
470
471
472
473
474
475
476
477
478
# File 'src/modules/SourceManager.rb', line 468

def get_attr_to_id(attr)
  src_ids = Pkg.SourceGetCurrent(
    false # enabled only?
  )
  a2i = Builtins.listmap(src_ids) do |src_id|
    gendata = Pkg.SourceGeneralData(src_id)
    alias_name = Ops.get_string(gendata, attr, "")
    { alias_name => src_id }
  end
  deep_copy(a2i)
end

#get_url_to_idObject


486
487
488
# File 'src/modules/SourceManager.rb', line 486

def get_url_to_id
  get_attr_to_id("url")
end

#getSourceId(url) ⇒ Object

Get Repository ID when only URL is known


225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'src/modules/SourceManager.rb', line 225

def getSourceId(url)
  @numSources = Builtins.size(@sourceStatesOut)
  i = 0
  id = -1
  while Ops.less_than(i, @numSources)
    generalData = Pkg.SourceGeneralData(
      Ops.get_integer(@sourceStatesOut, [i, "SrcId"], -1)
    )
    if Ops.get_string(generalData, "url", "") == url
      id = Ops.get_integer(@sourceStatesOut, [i, "SrcId"], -1)
      break
    end

    i = Ops.add(i, 1)
  end

  id
end

#GetSrcIdByIndex(idx) ⇒ Object

Get Repository ID by index


213
214
215
# File 'src/modules/SourceManager.rb', line 213

def GetSrcIdByIndex(idx)
  Ops.get_integer(@sourceStatesOut, [idx, "SrcId"], -1)
end

#HandleMultipleSources(url) ⇒ Object

Handle Multiple repositories URLs (order/instorder)


398
399
400
401
402
403
404
405
406
407
# File 'src/modules/SourceManager.rb', line 398

def HandleMultipleSources(url)
  Pkg.SourceStartManager(false)
  initial_source = Ops.get(Pkg.SourceScan(url, ""), 0)
  if initial_source.nil?
    Builtins.y2error("No repository in '%1'", url)
    return false
  end

  false
end

#Import(_settings) ⇒ Boolean

Get all repository-manager settings from the first parameter (For use by autoinstallation.)


201
202
203
# File 'src/modules/SourceManager.rb', line 201

def Import(_settings)
  true
end

#InstallationSourceOnPartitionString

Function returns the partiton name which is used as a repository for the installation (IF any partition is used as a repository for installation, of course). Otherwise it returns an empty string “”. See bugzilla #208222 for more information.


683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'src/modules/SourceManager.rb', line 683

def InstallationSourceOnPartition
  install_mode = Linuxrc.InstallInf("InstMode")

  # Hard Disk is used for the installation
  if install_mode == "hd"
    install_partition = Linuxrc.InstallInf("Partition")

    # No partiton is defined - error
    if install_partition == "" || install_partition.nil?
      Builtins.y2error(
        "Despite the fact that the install-mode is '%1', install-partition is '%2'",
        install_mode,
        install_partition
      )
      ""
    else
      install_partition
    end
  else
    ""
  end
end

#InstInitSourceMoveDownloadAreaObject

Finds the biggest temporary directory and uses it as packager download area.


708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
# File 'src/modules/SourceManager.rb', line 708

def InstInitSourceMoveDownloadArea
  spaces = Pkg.TargetGetDU
  root_info = Ops.get_list(
    spaces,
    "/tmp",
    Ops.get_list(spaces, "/tmp/", Ops.get_list(spaces, "/", []))
  )
  total = Ops.get_integer(root_info, 0, 0)
  current = Ops.get_integer(root_info, 1, 0)
  future = Ops.get_integer(root_info, 2, 0)
  future = current if Ops.less_than(future, current)
  tmp_space = Ops.subtract(total, future)
  # no temp space left or read-only
  if Ops.less_than(tmp_space, 0) || Ops.get_integer(root_info, 3, 1) == 1
    tmp_space = 0
  end

  var_info = Ops.get_list(
    spaces,
    "/var/tmp",
    Ops.get_list(
      spaces,
      "/var/tmp/",
      Ops.get_list(
        spaces,
        "/var",
        Ops.get_list(spaces, "/var/", Ops.get_list(spaces, "/", []))
      )
    )
  )
  total = Ops.get_integer(var_info, 0, 0)
  current = Ops.get_integer(var_info, 1, 0)
  future = Ops.get_integer(var_info, 2, 0)
  future = current if Ops.less_than(future, current)
  var_tmp_space = Ops.subtract(total, future)
  # no temp space left or read-only
  if Ops.less_than(var_tmp_space, 0) || Ops.get_integer(var_info, 3, 1) == 1
    var_tmp_space = 0
  end

  #-------
  # /tmp or /var/tmp ?

  download_dir = Ops.greater_than(tmp_space, var_tmp_space) ? "/tmp" : "/var/tmp"
  download_dir = Ops.add(Installation.destdir, download_dir)
  # TODO: check the size of the largest package on CD1
  successful = Convert.to_integer(
    SCR.Execute(
      path(".target.bash"),
      Builtins.sformat(
        "test -d '%1' || mkdir -p '%1'",
        String.Quote(download_dir)
      )
    )
  )
  if successful.zero?
    Pkg.SourceMoveDownloadArea(download_dir)
  else
    Builtins.y2error("Unable to create %1 directory", download_dir)
  end

  nil
end

#mainObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'src/modules/SourceManager.rb', line 10

def main
  Yast.import "UI"
  Yast.import "Pkg"

  textdomain "packager"

  Yast.import "Progress"
  Yast.import "Report"
  Yast.import "Popup"
  Yast.import "Label"
  Yast.import "Summary"
  Yast.import "HTML"
  Yast.import "Mode"
  Yast.import "URL"
  Yast.import "Linuxrc"
  Yast.import "Installation"
  Yast.import "String"

  @newSources = []

  @numSources = 0

  @sourceStates = []

  @sourceStatesIn = []

  @sourceStatesOut = []

  @url_tokens = {}

  @currentUrl = ""

  # Sources that are removed in memory but still not in libzypp
  # They will be removed in Write() at the end
  @just_removed_sources = []

  # Data was modified?
  @modified = false

  @proposal_valid = false
end

#ModifiedObject

Data was modified?


68
69
70
71
72
# File 'src/modules/SourceManager.rb', line 68

def Modified
  Builtins.y2debug("modified=%1", @modified)
  # return modified;
  @sourceStatesIn != @sourceStatesOut
end

#OverviewObject

Create an overview table with all configured cards


432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'src/modules/SourceManager.rb', line 432

def Overview
  @numSources = Builtins.size(@sourceStatesOut)
  i = 0
  source_overview = []
  while Ops.less_than(i, @numSources)
    source_overview = Builtins.add(
      source_overview,
      createOverviewItem(i, Ops.get(@sourceStatesOut, i, {}))
    )
    i = Ops.add(i, 1)
  end
  deep_copy(source_overview)
end

#ParseUrlQuery(query) ⇒ Hash

Parse a URL query (already unescaped) to a map. If no equal sign, the value will be nil.


451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'src/modules/SourceManager.rb', line 451

def ParseUrlQuery(query)
  q_items = Builtins.splitstring(query, "&")
  q_map = Builtins.listmap(q_items) do |q_item|
    eqpos = Builtins.search(q_item, "=")
    if eqpos.nil?
      { q_item => nil }
    else
      key = Builtins.substring(q_item, 0, eqpos)
      val = Builtins.substring(q_item, Ops.add(eqpos, 1))
      { key => val }
    end
  end
  deep_copy(q_map)
end

#ReadObject

Read all source-manager settings


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'src/modules/SourceManager.rb', line 85

def Read
  # SourceManager read dialog caption
  caption = _("Initializing Available Repositories")

  steps = 2

  # We do not set help text here, because it was set outside
  Progress.New(
    caption,
    " ",
    steps,
    [
      # Progress stage 1/3
      _("Read configured repositories"),
      # Progress stage 2/3
      _("Detect available repositories via SLP")
    ],
    [
      # Progress step 1/3
      _("Reading configured repositories..."),
      # Progress step 2/3
      _("Detecting available repositories..."),
      # Progress finished
      _("Finished")
    ],
    ""
  )

  # read database
  return false if Abort()
  Progress.NextStage

  # Error message
  Report.Error(_("Cannot read repositories.")) if !ReadSources()

  # read another database
  return false if Abort()
  Progress.NextStep

  return false if Abort()
  # Progress finished
  Progress.NextStage

  return false if Abort()
  @modified = false
  true
end

#ReadSourcesObject


74
75
76
77
78
79
80
81
# File 'src/modules/SourceManager.rb', line 74

def ReadSources
  success = Pkg.SourceStartManager(false)
  return success if !success
  @sourceStates = Pkg.SourceStartCache(false)
  @sourceStatesIn = Pkg.SourceEditGet
  @sourceStatesOut = deep_copy(@sourceStatesIn)
  true
end

#SetUrlByIndex(idx) ⇒ Object

Set current used repository URL by index


218
219
220
221
222
# File 'src/modules/SourceManager.rb', line 218

def SetUrlByIndex(idx)
  src_id = Ops.get_integer(@sourceStatesOut, [idx, "SrcId"], -1)
  @currentUrl = Ops.get_string(Pkg.SourceGeneralData(src_id), "url", "")
  nil
end

#SourceByAliasOrUrl(url, alias_to_id, url_to_id) ⇒ Object

Extract an alias parameter from the URL and check whether we have such a repository already.


495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'src/modules/SourceManager.rb', line 495

def SourceByAliasOrUrl(url, alias_to_id, url_to_id)
  alias_to_id = deep_copy(alias_to_id)
  url_to_id = deep_copy(url_to_id)
  # parse the URL
  parsed_url = URL.Parse(url)
  Builtins.y2milestone("parsed: %1", parsed_url)
  # (reassemble and warn if it differs)
  reassembled = URL.Build(parsed_url)
  if url != reassembled
    Builtins.y2warning("reassembled differs: %1", reassembled)
  end
  # get the alias
  q_map = ParseUrlQuery(Ops.get_string(parsed_url, "query", ""))
  Builtins.y2milestone("query: %1", q_map)
  alias_name = Ops.get(q_map, "alias", "")

  # (empty: box safeguard)
  if alias_name != "" && Builtins.haskey(alias_to_id, alias_name)
    return Ops.get(alias_to_id, alias_name, -1)
  end
  # #188572: if no match by alias, try url
  Ops.get(url_to_id, url, -1)
end

#SourceData(source) ⇒ Object

Gather Repository Metadata


245
246
247
248
249
250
251
252
253
# File 'src/modules/SourceManager.rb', line 245

def SourceData(source)
  g = Pkg.SourceGeneralData(source)
  Builtins.y2milestone("generalData: %1", g)
  p = Pkg.SourceProductData(source)
  p = {} if p.nil?

  Builtins.y2milestone("productData: %1", p)
  Builtins.union(g, p)
end

#SummaryObject

Create a textual summary and a list of unconfigured cards


411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'src/modules/SourceManager.rb', line 411

def Summary
  summary = ""
  # summary header
  summary = Summary.AddHeader(summary, _("Configured Repositories"))
  summary = Summary.OpenList(summary)
  @numSources = Builtins.size(@sourceStatesOut)
  i = 0
  while Ops.less_than(i, @numSources)
    summary = Summary.AddListItem(
      summary,
      createItem(i, Ops.get(@sourceStatesOut, i, {}))
    )
    i = Ops.add(i, 1)
  end
  summary = Summary.CloseList(summary)

  [summary, []]
end

#WriteObject

Write all repository-manager settings


156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'src/modules/SourceManager.rb', line 156

def Write
  # SourceManager read dialog caption
  caption = _("Saving Repository Configuration")

  steps = 1

  # We do not set help text here, because it was set outside
  Progress.New(
    caption,
    " ",
    steps,
    [
      # Progress stage 1/1
      _("Write repository settings")
    ],
    [
      # Progress step 1/1
      _("Writing the settings..."),
      # Progress finished
      _("Finished")
    ],
    ""
  )

  # write settings
  return false if Abort()

  Progress.NextStage
  # Error message

  exit = CommitSources()

  return false if Abort()
  # Progress finished
  Progress.NextStage

  return false if Abort()

  exit
end