Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip license fetcher #983

Merged
merged 4 commits into from Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/packages/src/lib/y2packager/license.rb
Expand Up @@ -54,7 +54,7 @@ def find(product_name, content: nil)
log.info "Searching for a license for product #{product_name}"
return cache[product_name] if cache[product_name]

fetcher = LicensesFetchers.for(product_name)
fetcher = LicensesFetchers.for(product_name) unless content
handler = LicensesHandlers.for(fetcher, product_name) if fetcher

license = License.new(product_name: product_name, fetcher: fetcher,
Expand Down
Expand Up @@ -58,7 +58,7 @@ def unpack_archive
expanded_url = Yast::Pkg.ExpandedUrl(url)

src = Yast::Pkg.RepositoryAdd("base_urls" => [expanded_url])
@archive_file_name = Yast::Pkg.SourceProvideFile(src, 1, archive_name)
@archive_file_name = Yast::Pkg.SourceProvideOptionalFile(src, 1, archive_name)

system("tar -C #{archive_dir.shellescape} -x -f #{@archive_file_name.shellescape}") if @archive_file_name

Expand Down
14 changes: 8 additions & 6 deletions library/packages/test/y2packager/license_test.rb
Expand Up @@ -34,14 +34,16 @@

describe ".find" do
context "when some content is given" do
before do
allow(Y2Packager::License).to receive(:new)
.with(product_name: "SLES", fetcher: fetcher, handler: handler, content: content)
.and_return(license)
it "does not look for a license fetcher" do
expect(Y2Packager::LicensesFetchers).to_not receive(:for)

described_class.find("SLES", content: content)
end

it "uses the content as license's content" do
expect(described_class.find("SLES", content: content)).to be(license)
it "uses the content as license's text" do
product_license = described_class.find("SLES", content: content)

expect(product_license.content_for).to eq(content)
end
end

Expand Down
Expand Up @@ -37,7 +37,7 @@ def tar_path_for(package)
allow(Yast::Pkg).to receive(:RepositoryAdd)
.and_return nil

allow(Yast::Pkg).to receive(:SourceProvideFile)
allow(Yast::Pkg).to receive(:SourceProvideOptionalFile)
.and_return tar_path
end

Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Nov 20 08:32:01 UTC 2019 - David Diaz <dgonzalez@suse.com>

- Do not try to find licenses in the installation medium when they
have been already downloaded from SCC (bsc#1153326).
- 4.2.35

-------------------------------------------------------------------
Fri Nov 15 09:30:20 UTC 2019 - Josef Reidinger <jreidinger@suse.com>

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


Name: yast2
Version: 4.2.34
Version: 4.2.35
Release: 0
Summary: YaST2 Main Package
License: GPL-2.0-only
Expand Down