Class: Zypper::Upgraderepo::View::Solved

Inherits:
Ini
  • Object
show all
Defined in:
lib/zypper/upgraderepo/view.rb

Overview

Ini style output with inferred solution.

Class Method Summary collapse

Methods inherited from Ini

available, duplicates_footer, duplicates_header, duplicates_item, footer, forbidden, header, not_found, redirected, separator, server_error, status, timeout, untouched, unused_footer, unused_header, unused_item, upgraded

Class Method Details

.alternative(num, repo, _max_col, alt) ⇒ Object



420
421
422
423
424
# File 'lib/zypper/upgraderepo/view.rb', line 420

def self.alternative(num, repo, _max_col, alt)
  info num, "Not Found", repo, valid: false, suggested: alt[:url]
  puts "hint=#{alt[:message]}"
  puts "suggested_url=#{alt[:url]}" unless alt[:url].to_s.empty?
end

.info(num, status, repo, valid: true, suggested: "") ⇒ Object



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/zypper/upgraderepo/view.rb', line 426

def self.info(num, status, repo, valid: true, suggested: "")
  @@number = num
  puts "[repository_#{num}]"
  puts "name=#{repo.name}"
  puts "alias=#{repo.alias}"
  puts "old_url=#{repo.old_url}" if repo.upgraded? || !suggested.empty?
  if valid
    if repo.unversioned? && repo.old_url
      puts <<-HEADER.gsub(/^ +/, "")
        # The repository is unversioned: its packages should be perfectly
        # working regardless the distribution version, that because all the
        # required dependencies are included in the repository itself and
        # automatically picked up.
      HEADER
    end
    puts "url=#{repo.url}"
  elsif repo.enabled?
    if suggested.empty?
      puts <<-HEADER.gsub(/^ +/, "")
        # The interpolated URL is invalid, and the script has not been able to find
        # an alternative. The best thing to do here is to disable the repository.
        # In case a valid alternative will be discovered, just replace its URL in
        # the "url" field below and make sure to re-enable the repository by switching
        # the "enabled" field to "Yes" again.
        #
      HEADER
      puts "url=#{repo.old_url}"
      puts "enabled=No"
    else
      puts <<-HEADER.gsub(/^ +/, "")
        # The interpolated URL is invalid, but the script found an alternative
        # URL which will be used to override the old value.
        # Unfortunately the script is not able to know if the found URL is exact,
        # so review the result before accepting any change, and in case want
        # to disable it, just turn the "enabled" field below to "No".
        #
      HEADER
      puts "url=#{suggested}"
      puts "enabled=Yes"
    end
  else
    puts <<-HEADER.gsub(/^ +/, "")
      # The interpolated URL is invalid, but being the repository disabled you can
      # keep the old_url in the field below, it will be ignored anyway during the
      # system update and the upgrade process until the repository is enabled again.
    HEADER
    puts "url=#{suggested.empty? ? repo.old_url : suggested}"
  end
  puts "priority=#{repo.priority}"
  puts "status=#{status}"
end