Class: Yast::SourceManagerClass
- Inherits:
-
Module
- Object
- Module
- Yast::SourceManagerClass
- Defined in:
- ../../src/modules/SourceManager.rb
Instance Method Summary (collapse)
-
- (Boolean) Abort
Abort function.
-
- (Object) AbortFunction
Abort function return boolean return true if abort.
-
- (Object) AddUpdateSources(urls)
Used by registration.
- - (Object) AskForCD(message)
-
- (Object) CommitSources
Commit changed repositories.
-
- (Object) createItem(index, source)
Create Summary Item.
-
- (Object) createOverviewItem(index, source)
Create Repository Item for Overview.
-
- (Object) createSource(url)
Create a repository from an URL.
-
- (Object) deleteSourceByIndex(idx)
Delete Repository by the repository index.
-
- (Object) deleteSourceBySrcId(_SrcId)
Delete repository by Repository ID.
-
- (Object) deleteSourceByUrl(url)
Delete Repository by repository URL.
-
- (Hash) Export
Dump the repository-manager settings to a single map (For use by autoinstallation.).
-
- (Object) get_alias_to_id
For existing repositories, get a mapping from the alias to the id.
-
- (Object) get_attr_to_id(attr)
For existing repositories, get a mapping from an attribute to the id.
-
- (Object) get_url_to_id
For existing repositories, get a mapping from the URL to the id.
-
- (Object) getSourceId(url)
Get Repository ID when only URL is known.
-
- (Object) GetSrcIdByIndex(idx)
Get Repository ID by index.
-
- (Object) HandleMultipleSources(url)
Handle Multiple repositories URLs (order/instorder).
-
- (Boolean) Import(settings)
Get all repository-manager settings from the first parameter (For use by autoinstallation.).
-
- (String) InstallationSourceOnPartition
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).
-
- (Object) InstInitSourceMoveDownloadArea
Finds the biggest temporary directory and uses it as packager download area.
- - (Object) main
-
- (Object) Modified
Data was modified?.
-
- (Object) Overview
Create an overview table with all configured cards.
-
- (Object) ParseUrlQuery(query)
Parse a URL query (already unescaped) to a map.
-
- (Object) Read
Read all source-manager settings.
- - (Object) ReadSources
-
- (Object) SetUrlByIndex(idx)
Set current used repository URL by index.
-
- (Object) SourceByAliasOrUrl(url, alias_to_id, url_to_id)
Extract an alias parameter from the URL and check whether we have such a repository already.
-
- (Object) SourceData(source)
Gather Repository Metadata.
-
- (Object) Summary
Create a textual summary and a list of unconfigured cards.
-
- (Object) Write
Write all repository-manager settings.
Instance Method Details
- (Boolean) Abort
Abort function
72 73 74 75 76 77 |
# File '../../src/modules/SourceManager.rb', line 72 def Abort if fun_ref(method(:AbortFunction), "boolean ()") != nil return AbortFunction() == true end false end |
- (Object) AbortFunction
Abort function return boolean return true if abort
66 67 68 |
# File '../../src/modules/SourceManager.rb', line 66 def AbortFunction false end |
- (Object) AddUpdateSources(urls)
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.
585 586 587 588 589 590 591 592 593 594 595 596 597 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 |
# File '../../src/modules/SourceManager.rb', line 585 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 |
- (Object) AskForCD(message)
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 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 |
# File '../../src/modules/SourceManager.rb', line 659 def AskForCD() 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(), 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 while true 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 |
- (Object) CommitSources
Commit changed repositories
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File '../../src/modules/SourceManager.rb', line 153 def CommitSources Builtins.y2debug("In: %1 Out: %2", @sourceStatesIn, @sourceStatesOut) success = false while true success = Pkg.SourceEditSet(@sourceStatesOut) if !success # popup message header __msg1 = _("Unable to save changes to the repository.\n") # popup message, after message header, header of details __msg2 = Ops.add(_("Details:") + "\n", Pkg.LastError) # end of popup message, question __msg2 = Ops.add(Ops.add(__msg2, "\n"), _("Try again?")) tryagain = Popup.YesNo(Ops.add(Ops.add(__msg1, "\n"), __msg2)) if tryagain next else break end else break end end success end |
- (Object) createItem(index, source)
Create Summary Item
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File '../../src/modules/SourceManager.rb', line 385 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 = Ops.get_boolean(source, "enabled", true) ? # status info, to be used inside summary _("Enabled") : # status info, to be used inside summary _("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 |
- (Object) createOverviewItem(index, source)
Create Repository Item for Overview
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File '../../src/modules/SourceManager.rb', line 419 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), Ops.get_boolean(source, "enabled", true) ? # corresponds to the "Enable/Disable" button _("On") : # corresponds to the "Enable/Disable" button _("Off"), Ops.get_locale( productData, "label", Ops.get_locale(generalData, "type", _("Unknown")) ), Ops.get_string(generalData, "url", "") ) deep_copy(item) end |
- (Object) createSource(url)
Create a repository from an URL
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File '../../src/modules/SourceManager.rb', line 292 def createSource(url) 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) == 0 __msg1 = Builtins.sformat( _("Unable to create repository\nfrom URL '%1'."), URL.HidePassword(url) ) __msg2 = Ops.add(_("Details:") + "\n", Pkg.LastError) # end of popup message, question __msg2 = Ops.add(Ops.add(__msg2, "\n"), _("Try again?")) tryagain = Popup.YesNo(Ops.add(Ops.add(__msg1, "\n"), __msg2)) if tryagain return :again else return :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) == 0 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 return :ok end end :cancel end |
- (Object) deleteSourceByIndex(idx)
Delete Repository by the repository index
373 374 375 376 |
# File '../../src/modules/SourceManager.rb', line 373 def deleteSourceByIndex(idx) @sourceStatesOut = Builtins.remove(@sourceStatesOut, idx) nil end |
- (Object) deleteSourceBySrcId(_SrcId)
Delete repository by Repository ID
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File '../../src/modules/SourceManager.rb', line 355 def deleteSourceBySrcId(_SrcId) Builtins.y2debug("removing repository: %1 %2", _SrcId, @sourceStatesOut) @numSources = Builtins.size(@sourceStatesOut) i = 0 while Ops.less_than(i, @numSources) if Ops.get_integer(@sourceStatesOut, [i, "SrcId"], -1) == _SrcId @sourceStatesOut = Builtins.remove(@sourceStatesOut, i) break end i = Ops.add(i, 1) end nil end |
- (Object) deleteSourceByUrl(url)
Delete Repository by repository URL
379 380 381 382 |
# File '../../src/modules/SourceManager.rb', line 379 def deleteSourceByUrl(url) deleteSourceBySrcId(getSourceId(url)) nil end |
- (Hash) Export
Dump the repository-manager settings to a single map (For use by autoinstallation.)
236 237 238 |
# File '../../src/modules/SourceManager.rb', line 236 def Export {} end |
- (Object) get_alias_to_id
Returns For existing repositories, get a mapping from the alias to the id
539 540 541 |
# File '../../src/modules/SourceManager.rb', line 539 def get_alias_to_id get_attr_to_id("alias") end |
- (Object) get_attr_to_id(attr)
Returns For existing repositories, get a mapping from an attribute to the id
526 527 528 529 530 531 532 533 534 535 536 |
# File '../../src/modules/SourceManager.rb', line 526 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 = Ops.get_string(gendata, attr, "") { _alias => src_id } end deep_copy(a2i) end |
- (Object) get_url_to_id
Returns For existing repositories, get a mapping from the URL to the id
544 545 546 |
# File '../../src/modules/SourceManager.rb', line 544 def get_url_to_id get_attr_to_id("url") end |
- (Object) getSourceId(url)
Get Repository ID when only URL is known
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File '../../src/modules/SourceManager.rb', line 256 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 |
- (Object) GetSrcIdByIndex(idx)
Get Repository ID by index
241 242 243 244 245 |
# File '../../src/modules/SourceManager.rb', line 241 def GetSrcIdByIndex(idx) _SrcId = Ops.get_integer(@sourceStatesOut, [idx, "SrcId"], -1) _SrcId end |
- (Object) HandleMultipleSources(url)
Handle Multiple repositories URLs (order/instorder)
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File '../../src/modules/SourceManager.rb', line 446 def HandleMultipleSources(url) = false theSourceDirectories = [] theSourceOrder = {} theSources = [] tmpdir = Convert.to_string(SCR.Read(path(".target.tmpdir"))) = Ops.add(tmpdir, "/yast-install") 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 |
- (Boolean) Import(settings)
Get all repository-manager settings from the first parameter (For use by autoinstallation.)
228 229 230 231 |
# File '../../src/modules/SourceManager.rb', line 228 def Import(settings) settings = deep_copy(settings) true end |
- (String) InstallationSourceOnPartition
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.
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
# File '../../src/modules/SourceManager.rb', line 744 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 ) return "" else return install_partition end else return "" end end |
- (Object) InstInitSourceMoveDownloadArea
Finds the biggest temporary directory and uses it as packager download area.
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File '../../src/modules/SourceManager.rb', line 769 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) space = Ops.greater_than(tmp_space, var_tmp_space) ? tmp_space : var_tmp_space if true # 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 == 0 Pkg.SourceMoveDownloadArea(download_dir) else Builtins.y2error("Unable to create %1 directory", download_dir) end end nil end |
- (Object) main
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 51 52 53 54 55 56 57 58 59 60 61 62 |
# File '../../src/modules/SourceManager.rb', line 19 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 |
- (Object) Modified
Data was modified?
81 82 83 84 85 |
# File '../../src/modules/SourceManager.rb', line 81 def Modified Builtins.y2debug("modified=%1", @modified) #return modified; @sourceStatesIn != @sourceStatesOut end |
- (Object) Overview
Create an overview table with all configured cards
491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File '../../src/modules/SourceManager.rb', line 491 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 |
- (Object) ParseUrlQuery(query)
Parse a URL query (already unescaped) to a map. If no equal sign, the value will be nil.
509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
# File '../../src/modules/SourceManager.rb', line 509 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 next { q_item => nil } else key = Builtins.substring(q_item, 0, eqpos) val = Builtins.substring(q_item, Ops.add(eqpos, 1)) next { key => val } end end deep_copy(q_map) end |
- (Object) Read
Read all source-manager settings
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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File '../../src/modules/SourceManager.rb', line 98 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 # Error message Report.Error(_("Cannot detect available repositories.")) if false return false if Abort() # Progress finished Progress.NextStage return false if Abort() @modified = false true end |
- (Object) ReadSources
87 88 89 90 91 92 93 94 |
# File '../../src/modules/SourceManager.rb', line 87 def ReadSources success = Pkg.SourceStartManager(false) return success if !success @sourceStates = Pkg.SourceStartCache(false) @sourceStatesIn = Pkg.SourceEditGet @sourceStatesOut = deep_copy(@sourceStatesIn) true end |
- (Object) SetUrlByIndex(idx)
Set current used repository URL by index
248 249 250 251 252 |
# File '../../src/modules/SourceManager.rb', line 248 def SetUrlByIndex(idx) _SrcId = Ops.get_integer(@sourceStatesOut, [idx, "SrcId"], -1) @currentUrl = Ops.get_string(Pkg.SourceGeneralData(_SrcId), "url", "") nil end |
- (Object) SourceByAliasOrUrl(url, alias_to_id, url_to_id)
Extract an alias parameter from the URL and check whether we have such a repository already.
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
# File '../../src/modules/SourceManager.rb', line 555 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 = Ops.get(q_map, "alias", "") # (empty: box safeguard) if _alias != "" && Builtins.haskey(alias_to_id, _alias) return Ops.get(alias_to_id, _alias, -1) end # #188572: if no match by alias, try url Ops.get(url_to_id, url, -1) end |
- (Object) SourceData(source)
Gather Repository Metadata
281 282 283 284 285 286 287 288 289 |
# File '../../src/modules/SourceManager.rb', line 281 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 |
- (Object) Summary
Create a textual summary and a list of unconfigured cards
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
# File '../../src/modules/SourceManager.rb', line 469 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 |
- (Object) Write
Write all repository-manager settings
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File '../../src/modules/SourceManager.rb', line 181 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 |