Skip to content

Commit

Permalink
Merge pull request #277 from teclator/readme_beta
Browse files Browse the repository at this point in the history
Replace info.txt beta file by README.BETA
  • Loading branch information
teclator committed Sep 13, 2017
2 parents b2e6ee1 + 4f19d8c commit 42d5148
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 12 10:19:41 UTC 2017 - knut.anderssen@suse.com

- Replace /info.txt by /README.BETA as beta file to be shown
(bsc#1047060).
- 4.0.0

-------------------------------------------------------------------
Thu Sep 7 16:09:38 UTC 2017 - knut.anderssen@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-packager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 3.3.12
Version: 4.0.0
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
4 changes: 2 additions & 2 deletions src/modules/AddOnProduct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def CleanY2Update
nil
end

# Show /media.1/info.txt file in a pop-up message if such file exists.
# Show beta file in a pop-up message if such file exists.
# Show license if such exists and return whether users accepts it.
# Returns 'nil' when did not succed.
#
Expand Down Expand Up @@ -820,7 +820,7 @@ def RegisterAddOnProduct(src_id)
#
# @return [Symbol] the result symbol from wizard sequencer
def DoInstall
# Display /media.1/info.txt if such file exists
# Display beta file if such file exists
# Display license and wait for agreement
# Not needed here, license already shown in the workflow
# boolean license_ret = AcceptedLicenseAndInfoFile(src_id);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/InstShowInfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Yast namespace
module Yast
# Show /info.txt (if present) in a popup
# Show a given info file (if present) in a popup
class InstShowInfoClass < Module
def main
Yast.import "UI"
Expand All @@ -17,7 +17,7 @@ def main
Yast.import "Label"
end

# @param [String] info_file (/info.txt" - Copied from inst media to inst-sys by linuxrc)
# @param [String] info_file path to be shown
def show_info_txt(info_file)
display_info = UI.GetDisplayInfo
size_x = Builtins.tointeger(Ops.get_integer(display_info, "Width", 800))
Expand Down
9 changes: 5 additions & 4 deletions src/modules/ProductLicense.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ProductLicenseClass < Module
include Yast::Logger

DOWNLOAD_URL_SCHEMA = ["http", "https", "ftp"].freeze
INFO_FILE = "/README.BETA".freeze

def main
Yast.import "Pkg"
Expand Down Expand Up @@ -1105,7 +1106,7 @@ def SearchForLicense_FirstStageBaseProduct(_src_id, _fallback_dir)
Builtins.y2milestone("Installation Product doesn't have a license")
end

@info_file = "/info.txt" if FileUtils.Exists("/info.txt")
@info_file = INFO_FILE if FileUtils.Exists(INFO_FILE)

nil
end
Expand Down Expand Up @@ -1146,7 +1147,7 @@ def SearchForLicense_LiveCDInstallation(_src_id, _fallback_dir)
end

Builtins.foreach(license_locations) do |info_location|
info_location = Builtins.sformat("%1/README.BETA", info_location)
info_location += INFO_FILE
if FileUtils.Exists(info_location)
Builtins.y2milestone("Using info file: %1", info_location)
@info_file = info_location
Expand All @@ -1173,7 +1174,7 @@ def SearchForLicense_NormalRunBaseProduct(_src_id, fallback_dir)
@license_dir = nil
end

@info_file = "/info.txt" if FileUtils.Exists("/info.txt")
@info_file = INFO_FILE if FileUtils.Exists(INFO_FILE)

nil
end
Expand All @@ -1184,7 +1185,7 @@ def SearchForLicense_AddOnProduct(src_id, _fallback_dir)
@info_file = Pkg.SourceProvideDigestedFile(
src_id, # optional
1,
"/media.1/info.txt",
"/media.1" + INFO_FILE,
true
)

Expand Down
10 changes: 6 additions & 4 deletions test/product_license_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
Yast.import "Stage"

describe Yast::ProductLicense do
let(:beta_file) { "README.BETA" }

describe "#HandleLicenseDialogRet" do
before(:each) do
# By default, always exit the dialog with :accepted (all licenses accepted)
Expand Down Expand Up @@ -197,8 +199,8 @@
before do
# Tarball with licenses exists
allow(Yast::FileUtils).to receive(:Exists).with(/license.tar.gz/).and_return(true)
# Info file exists
allow(Yast::FileUtils).to receive(:Exists).with(/info.txt/).and_return(true)
# beta file exists
allow(Yast::FileUtils).to receive(:Exists).with(/#{beta_file}/).and_return(true)
end

context "when called for base-product" do
Expand Down Expand Up @@ -242,8 +244,8 @@
before do
# Tarball with licenses does not exist
allow(Yast::FileUtils).to receive(:Exists).with(/license.tar.gz/).and_return(false)
# Info file does not exist
allow(Yast::FileUtils).to receive(:Exists).with(/info.txt/).and_return(false)
# beta file does not exist
allow(Yast::FileUtils).to receive(:Exists).with(/#{beta_file}/).and_return(false)
end

it "do not blame that there is no license directory" do
Expand Down

0 comments on commit 42d5148

Please sign in to comment.