Skip to content

Commit

Permalink
Self-update fix: remove the architecture suffix
Browse files Browse the repository at this point in the history
from the version when reading the /.packages.root file from the inst-sys
  • Loading branch information
lslezak committed Dec 17, 2024
1 parent 0851b52 commit fb63646
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/installation/instsys_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def self.read(file = "/.packages.root")
name, version = /^(\S+) \[(\S+)\]/.match(line)[1, 2]
next unless name && version

# remove the architecture suffix
version.sub!(/\.(noarch|aarch64|i[3-6]86|ppc64|ppc64le|s390x?|x86_64)$/, "")

# nil repository ID
packages << Y2Packager::Package.new(name, nil, version)
end
Expand Down
8 changes: 7 additions & 1 deletion test/instsys_packages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@

it "reads the package versions" do
pkgs = Installation::InstsysPackages.read(test_file)

yast2 = pkgs.find { |p| p.name == "yast2" }
yast2_add_on = pkgs.find { |p| p.name == "yast2-add-on" }

# no "x86_64" suffix
expect(yast2.version).to eq("4.2.67-1.7")

expect(yast2.version).to eq("4.2.67-1.7.x86_64")
# no "noarch" suffix
expect(yast2_add_on.version).to eq("4.2.15-1.30")
end
end
end

0 comments on commit fb63646

Please sign in to comment.