Skip to content

Commit

Permalink
Merge pull request #548 from yast/fix_patterns
Browse files Browse the repository at this point in the history
Fix patterns
  • Loading branch information
jreidinger committed Feb 15, 2021
2 parents 438bc1c + 14fbd3d commit ddedba6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Feb 12 20:38:23 UTC 2021 - Josef Reidinger <jreidinger@suse.com>

- Fix crash when installation proposal require pattern and such
pattern is not available in any repository (found during testing
jsc#SLE-17427)
- 4.2.68

-------------------------------------------------------------------
Tue Dec 1 15:03:41 UTC 2020 - Josef Reidinger <jreidinger@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-packager.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 4.2.67
Version: 4.2.68
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Packages.rb
Expand Up @@ -2540,7 +2540,7 @@ def check_missing_resolvables

missing[type] = [] unless missing[type]
# use quoted "summary" value for patterns as they usually contain spaces
name = (type == :pattern) ? statuses.first.summary.inspect : item
name = (type == :pattern && !statuses.empty?) ? statuses.first.summary.inspect : item
missing[type] << name
end
end
Expand Down
11 changes: 11 additions & 0 deletions test/packages_test.rb
Expand Up @@ -1856,4 +1856,15 @@ def expect_source_urls(mapping)
end
end
end

describe "#check_missing_resolvables" do
it "does not crash for non available pattern" do
allow(Yast::PackagesProposal).to receive(:GetAllResolvablesForAllTypes)
.and_return(pattern: ["non-existing"])
allow(Y2Packager::Resolvable).to receive(:find).with(kind: :pattern, name: "non-existing")
.and_return([])

expect(subject.send(:check_missing_resolvables)).to eq(pattern: ["non-existing"])
end
end
end

0 comments on commit ddedba6

Please sign in to comment.