Class: Installation::InstsysPackages

Inherits:
Object
  • Object
show all
Defined in:
src/lib/installation/instsys_packages.rb

Overview

Find the packages installed in the inst-sys. Because the inst-sys does not contain the RPM DB we need to load the installed packages from the /.packages.root file.

Class Method Summary collapse

Class Method Details

.read(file = "/.packages.root") ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'src/lib/installation/instsys_packages.rb', line 21

def self.read(file = "/.packages.root")
  packages = []

  File.foreach(file) do |line|
    # each line looks like this (the dependency at the end is optional):
    #   yast2-core [4.1.0-5.18.x86_64] < yast2
    name, version = /^(\S+) \[(\S+)\]/.match(line)[1, 2]
    next unless name && version

    # nil repository ID
    packages << Y2Packager::Package.new(name, nil, version)
  end

  packages
end