Hello community, here is the log from the commit of package yast2-packager for openSUSE:Factory checked in at 2018-04-07 20:51:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old) and /work/SRC/openSUSE:Factory/.yast2-packager.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-packager" Sat Apr 7 20:51:33 2018 rev:350 rq:593899 version:4.0.55 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes 2018-03-18 21:43:35.900407642 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes 2018-04-07 20:51:42.382010291 +0200 @@ -1,0 +2,41 @@ +Thu Apr 5 15:32:19 UTC 2018 - knut.anders...@suse.com + +- Given a license, remember whether another one with the same + content was already accepted (fate#325461). +- 4.0.55 + +------------------------------------------------------------------- +Wed Apr 4 06:57:12 UTC 2018 - lsle...@suse.cz + +- Better evaluate the product to upgrade, do not use the package + solver if there is only one base product to install, use some + fallbacks when the solver fails (bsc#1086259) +- 4.0.54 + +------------------------------------------------------------------- +Tue Apr 3 10:30:27 UTC 2018 - jlo...@suse.com + +- Fix tests to use correct storage instance (part of fate#318196). +- 4.0.53 + +------------------------------------------------------------------- +Tue Mar 27 07:29:09 UTC 2018 - jlo...@suse.com + +- Adapt to API changes in storage-ng (part of bsc#1082542). +- 4.0.52 + +------------------------------------------------------------------- +Tue Mar 27 07:14:16 UTC 2018 - lsle...@suse.cz + +- Added a known upgrade from SLE-HPC to SLES_HPC (bsc#1086734) +- 4.0.51 + +------------------------------------------------------------------- +Mon Mar 26 12:17:52 UTC 2018 - lsle...@suse.cz + +- SLES-12 + HPC module can be upgraded to SLES_HPC-15, display + correctly this product change in the migration selection and the + upgrade summary dialog (bsc#1086734) +- 4.0.50 + +------------------------------------------------------------------- Old: ---- yast2-packager-4.0.49.tar.bz2 New: ---- yast2-packager-4.0.55.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.ZfPWCo/_old 2018-04-07 20:51:44.249942685 +0200 +++ /var/tmp/diff_new_pack.ZfPWCo/_new 2018-04-07 20:51:44.253942540 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.0.49 +Version: 4.0.55 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -30,11 +30,11 @@ BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) BuildRequires: rubygem(%{rb_default_ruby_abi}:yast-rake) -# Y2Storage::Mountable#mount_path -BuildRequires: yast2-storage-ng >= 4.0.90 +# Y2Storage::Device#exists_in_raw_probed +BuildRequires: yast2-storage-ng >= 4.0.141 -# Y2Packager::Product#license_locales -BuildRequires: yast2 >= 4.0.52 +# Y2Packager::ProductLicense +BuildRequires: yast2 >= 4.0.63 # needed for icon for desktop file, it is verified at the end of build BuildRequires: yast2_theme @@ -51,8 +51,8 @@ # Pkg::PrdLicenseLocales Requires: yast2-pkg-bindings >= 4.0.8 -# Y2Packager::Product#license_locales -Requires: yast2 >= 4.0.52 +# Y2Packager::ProductLicense +Requires: yast2 >= 4.0.63 # unzipping license file Requires: unzip @@ -69,8 +69,8 @@ # .process agent Requires: yast2-core >= 2.16.35 -# Y2Storage::Mountable#mount_path -Requires: yast2-storage-ng >= 4.0.90 +# Y2Storage::Device#exists_in_raw_probed +Requires: yast2-storage-ng >= 4.0.141 # Augeas lenses Requires: augeas-lenses ++++++ yast2-packager-4.0.49.tar.bz2 -> yast2-packager-4.0.55.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/doc/license_code_cleanup.md new/yast2-packager-4.0.55/doc/license_code_cleanup.md --- old/yast2-packager-4.0.49/doc/license_code_cleanup.md 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-packager-4.0.55/doc/license_code_cleanup.md 2018-04-06 09:15:23.000000000 +0200 @@ -0,0 +1,273 @@ +1.0 License locations +======================= + +1.1 Old licenses stile still be used in TW and 3rd parties: +------------------------------------------------------------ + https://download.opensuse.org/tumbleweed/repo/oss/license.tar.gz + content: +``` + < no-acceptance-needed + < license.ar.txt + < license.ca.txt + < license.cs.txt + < license.da.txt + < license.de.txt + < license.txt +``` + This license has to be handled by YAST manually (without libzypp). + +1.2 libzypp licenses of SLES15, LEAP,...: +------------------------------------------ + https://download.opensuse.org/distribution/leap/15.0/repo/oss/repodata/61add773f5583f065ff25a54eb476023dc2a906cabb1ce0740f5223a70b650dc-license.tar.gz + + The content is the same as in 1.1 described. + + This license will be handled by libzypp completely. + + +1.3 SCC licenses +----------------- + The SCC license accesses to the repository that is granted *after* registering, but you + need to accept the license *before* registering. So for the SCC license there is a separate + repository which has public access and contains only the license. + + https://updates.suse.com/SUSE/Products/SLE-WE/12-SP3/x86_64/product.license/ + content: + +``` + < license.de.txt + < license.es.txt + < license.fr.txt + < license.it.txt + < license.ja.txt + < license.ko.txt + < license.pt_BR.txt + < license.ru.txt + < license.txt +``` + + Without file "no-acceptance-needed". So it has to be accepted by the user. + +2.0 Product description: +========================== + +``` +lib/y2packager/product.rb +product.rb - Handles all product items. + + Y2Packager::Product.selected_base + <instance>.license_confirmation_required? + <instance>.license_confirmed? + <instance>.license + <instance>.license? + <instance>.version + <instance>.name + ... + .. + . + +modules/Product.rb + + Product.FindBaseProducts + Product.ReadProducts + <instance>.version + <instance>.name + ... + .. + . + +lib/y2packager/product_reader.rb + Reads the product information from libzypp + +lib/y2packager/product_sorter.rb + Sorting Products in required display order + +lib/y2packager/release_notes_store.rb +lib/y2packager/release_notes.rb +lib/y2packager/release_notes_content_prefs.rb +lib/y2packager/release_notes_reader.rb + Handles release notes for a given product +``` + +3.0 Installation workflow +================================ + +3.1 Calling client/inst_complex_welcome.rb +------------------------------------------- + and lib/installation/clients/inst_complex_welcome.rb +``` + - calling ::Installation::Dialogs::ComplexWelcome.run(product) + (file: lib/installation/dialogs/complex_welcome.rb) + - installation: product = Y2Packager::Product.available_base_products + - upgrade && more available products: product = [] + - checking if there is only ONE product available: + no: selecting product + calling ::Installation::Widgets::ProductSelector + (file: lib/installation/widgets/product_selector.rb) + yes: showing and accepting this one license + calling Y2Packager::Widgets::ProductLicense + (file: lib/y2packager/widgets/product_license.rb) + - using Widgets::ProductLicenseContent (license text ONLY) + (file: lib/y2packager/widgets/product_license_content.rb) + - using Widgets::ProductLicenseConfirmation (Accept button) + (file: lib/y2packager/widgets/product_license_confirmation.rb) + Calling product.license_confirmation to write decision. + - using LicenseTranslationsButton + (file: lib/y2packager/widgets/license_translations_button.rb) + This button calls Y2Packager::Dialogs::ProductLicenseTranslations + which is a popup. (file: lib/y2packager/dialogs/product_license_translations.rb) +``` + +3.2 Calling client/inst_product_license.rb +------------------------------------------- + and lib/y2packager/clients/inst_product_license.rb +``` + - calling Y2Packager::Dialogs::InstProductLicense(product) + (file: lib/y2packager/dialogs/inst_product_license.rb) + - using Widgets::ProductLicenseTranslations (license WITH language selection) + (file: lib/y2packager/widgets/product_license_translationns.rb) + - using Y2Packager::Widgets::SimpleLanguageSelection (language selection) + (file lib/y2packager/widgets/simple_language_translations.rb) + - using Y2Packager::Widgets::ProductLicenseContent (license text ONLY) + (file: lib/y2packager/widgets/product_license_content.rb) + - using Widgets::ProductLicenseConfirmation (Accept button) + (file: lib/y2packager/widgets/product_license_confirmation.rb) + Calling product.license_confirmation to write decision. +``` + +4.0 Adding a new product +========================== + +Calling ProductLicense.AskAddOnLicenseAgreement(src_id) (file: modules/AddOnProduct.rb): + - ProductLicense.AskAddOnLicenseAgreement(src_id) + +The class ProductLicense (file: modules/ProductLicense.rb) is quite old and handles +the licenses acceptance completely (reading, showing and accepting license) +It can handle all license types ( license is in /license.tar.gz, SCC license and libzypp license ) +License types are stored under /tmp/YaST2-<number>/product-license . + +5.0 Firstboot module +====================== +There are two available clients for checking licenses: + +5.1 firstboot_license_novell +----------------------------- +( file: clients/firstboot_license_novell.rb ) +This is Novell only and should be obsolete. + +5.2 firstboot_licenses +----------------------- +( file: clients/firstboot_licenses.rb ) +Checking Novell and SUSE licenses. ( Directories are defined in sysconfig.firstboot ) +- Calling clients/inst_license.rb + and lib/installation/clients/inst_license.rb + This client uses modules/ProductLicense.rb which is explained in 4.0: + - ProductLicense.AskInstalledLicensesAgreement + - ProductLicense.AskFirstStageLicenseAgreement (obsolete by inst_complex_welcome) + +6.0 SCC licenses +================== +AddonEulaDialog (file lib/registration/ui/addon_eula_dialog.rb) is used for accepting +special SCC licenses which have to be accepted before the regarding repo will be loaded. +(see 1.3) + +This lib uses modules/ProductLicense.rb which is explained in 4.0. + +Only the UI part is used in ProductLicense.rb + +- Yast::ProductLicense.SetAcceptanceNeeded(id, true) - Product has to be accepted +- Yast::ProductLicense.license_file_print = ... - Setting print path +- Yast::ProductLicense.DisplayLicenseDialogWithTitle(...) - Establish UI +- Yast::ProductLicense.HandleLicenseDialogRet(...) - User acceptance + +7.0 Upgrade +============= + +Calling clients/inst_product_upgrade_license.rb +and lib/y2packager/clients/inst_repositories_initialization.rb. +This class uses Y2Packager::Dialogs::InstProductLicense(product) +(file: lib/y2packager/dialogs/inst_product_license.rb) which is already described in +section 3.2. + +8.0 AutoYaST installation/update +================================== +AY uses the same codestream as the normal installation/updated (described in section 3.2.). + +9.0 Cleanup +============ + +9.1 General +------------ +We have two main code streams which handles license agreements. + +9.1.1 New code stream +- - - - - - - - - - - - +``` +lib/y2packager/dialogs/inst_product_license.rb +lib/y2packager/dialogs/product_license_translations.rb +lib/y2packager/widgets/product_license.rb +lib/y2packager/widgets/product_license_content.rb +lib/y2packager/widgets/product_license_confirmation.rb +lib/y2packager/widgets/simple_language_translations.rb +lib/y2packager/widgets/license_translations_button.rb +``` + +Handles libzypp licenses (section 1.2 ) only. + +Is used for Installation/Update workflow. + +9.1.2 Old code stream +- - - - - - - - - - - - + +modules/ProductLicense.rb + +Handles all licenses types described in section 1.0. +Sitll used for Add-Ons, SCC licenses, first-boot workflow. + +9.2 Cleanup modules +-------------------- + +9.2.1 Unifiy product classes +- - - - - - - - - - - - - - - +Both of these two classes provide information about products (some information is double): + +``` +lib/y2packager/product.rb +modules/Product.rb +``` + +Would it makes sense to put it into one class or to include one class into another at least ? + +9.2.2 Abstraction of license locations +- - - - - - - - - - - - - - - - - - - - +The three kind of licenses (section 1.0) should be abstracted in one class (e.g. product.rb) +and should not be located in different classes/modules/UIs. + +9.2.3 Removing old Code Stream +- - - - - - - - - - - - - - - - - +Replacing modules/ProductLicense.rb by the new code stream. So, following workflows have to +be adapted: +- Adding a new product (section 4.0) +- Firstboot module (section 5.0) +- SCC licenses (section 6.0) + +The UI of the old code stream is showing the location of the stored license +text. If this is still needed we would have to add this in the new code stream +too. + +This is requested in: + +https://trello.com/c/tUy82u79/2112-create-bug-report-add-license-url-to-product-license-dialog + + +9.2.4 Code cleanup in Firstboot module +- - - - - - - - - - - - - - - - - - - - - +Removing all old NOVELL license stuff. + +9.3 Additional code changes +----------------------------- + +- Make it configurable in the control file where to show the product license if there is + `just one product` on the media (default behavior "as is" now) +- The rest of the requirements should already be fulfilled or quite simple to implement it. + After refactoring It has to be checked again. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/package/yast2-packager.changes new/yast2-packager-4.0.55/package/yast2-packager.changes --- old/yast2-packager-4.0.49/package/yast2-packager.changes 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/package/yast2-packager.changes 2018-04-06 09:15:23.000000000 +0200 @@ -1,4 +1,45 @@ ------------------------------------------------------------------- +Thu Apr 5 15:32:19 UTC 2018 - knut.anders...@suse.com + +- Given a license, remember whether another one with the same + content was already accepted (fate#325461). +- 4.0.55 + +------------------------------------------------------------------- +Wed Apr 4 06:57:12 UTC 2018 - lsle...@suse.cz + +- Better evaluate the product to upgrade, do not use the package + solver if there is only one base product to install, use some + fallbacks when the solver fails (bsc#1086259) +- 4.0.54 + +------------------------------------------------------------------- +Tue Apr 3 10:30:27 UTC 2018 - jlo...@suse.com + +- Fix tests to use correct storage instance (part of fate#318196). +- 4.0.53 + +------------------------------------------------------------------- +Tue Mar 27 07:29:09 UTC 2018 - jlo...@suse.com + +- Adapt to API changes in storage-ng (part of bsc#1082542). +- 4.0.52 + +------------------------------------------------------------------- +Tue Mar 27 07:14:16 UTC 2018 - lsle...@suse.cz + +- Added a known upgrade from SLE-HPC to SLES_HPC (bsc#1086734) +- 4.0.51 + +------------------------------------------------------------------- +Mon Mar 26 12:17:52 UTC 2018 - lsle...@suse.cz + +- SLES-12 + HPC module can be upgraded to SLES_HPC-15, display + correctly this product change in the migration selection and the + upgrade summary dialog (bsc#1086734) +- 4.0.50 + +------------------------------------------------------------------- Thu Mar 15 12:35:23 UTC 2018 - lsle...@suse.cz - Cleanup, do not use the obsolete scripts which have been dropped diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/package/yast2-packager.spec new/yast2-packager-4.0.55/package/yast2-packager.spec --- old/yast2-packager-4.0.49/package/yast2-packager.spec 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/package/yast2-packager.spec 2018-04-06 09:15:23.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.0.49 +Version: 4.0.55 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -30,11 +30,11 @@ BuildRequires: rubygem(%{rb_default_ruby_abi}:yast-rake) BuildRequires: rubygem(%{rb_default_ruby_abi}:cfa) >= 0.5.0 -# Y2Storage::Mountable#mount_path -BuildRequires: yast2-storage-ng >= 4.0.90 +# Y2Storage::Device#exists_in_raw_probed +BuildRequires: yast2-storage-ng >= 4.0.141 -# Y2Packager::Product#license_locales -BuildRequires: yast2 >= 4.0.52 +# Y2Packager::ProductLicense +BuildRequires: yast2 >= 4.0.63 # needed for icon for desktop file, it is verified at the end of build BuildRequires: yast2_theme @@ -51,8 +51,8 @@ # Pkg::PrdLicenseLocales Requires: yast2-pkg-bindings >= 4.0.8 -# Y2Packager::Product#license_locales -Requires: yast2 >= 4.0.52 +# Y2Packager::ProductLicense +Requires: yast2 >= 4.0.63 # unzipping license file Requires: unzip @@ -69,8 +69,8 @@ # .process agent Requires: yast2-core >= 2.16.35 -# Y2Storage::Mountable#mount_path -Requires: yast2-storage-ng >= 4.0.90 +# Y2Storage::Device#exists_in_raw_probed +Requires: yast2-storage-ng >= 4.0.141 # Augeas lenses Requires: augeas-lenses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/lib/y2packager/clients/inst_product_license.rb new/yast2-packager-4.0.55/src/lib/y2packager/clients/inst_product_license.rb --- old/yast2-packager-4.0.49/src/lib/y2packager/clients/inst_product_license.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/lib/y2packager/clients/inst_product_license.rb 2018-04-06 09:15:23.000000000 +0200 @@ -63,7 +63,7 @@ # # @return [Boolean] true if the license is available; false otherwise. def available_license? - return true if product && product.license?(Yast::Language.language) + return true if product && product.license? if product.nil? log.warn "No base product is selected for installation" else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/lib/y2packager/clients/inst_product_upgrade_license.rb new/yast2-packager-4.0.55/src/lib/y2packager/clients/inst_product_upgrade_license.rb --- old/yast2-packager-4.0.49/src/lib/y2packager/clients/inst_product_upgrade_license.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/lib/y2packager/clients/inst_product_upgrade_license.rb 2018-04-06 09:15:23.000000000 +0200 @@ -14,6 +14,7 @@ require "y2packager/clients/inst_product_license" require "y2packager/product" +require "y2packager/product_upgrade" Yast.import "Pkg" Yast.import "Report" @@ -56,29 +57,7 @@ # @return [Y2Packager::Product] # @see Y2Packager::Product.selected_base def product - return @product if @product - - # temporarily run the update mode to let the solver select the product for upgrade - # (this will correctly handle possible product renames) - Yast::Pkg.PkgUpdateAll({}) - @product = Y2Packager::Product.selected_base - # restore the initial status, the package update will be turned on later again - Yast::Pkg.PkgReset - reset_packages(:removed) - reset_packages(:selected) - - @product - end - - # Reset packages having the specific status - # @param status [Symbol] Status symbol, `:removed`, `:selected`, `:installed`, - # `:available`, `:taboo`, `:locked` - # @see Yast::Pkg.GetPackages - def reset_packages(status) - # package names only, without version - names_only = true - # packages in the required status - Yast::Pkg.GetPackages(status, names_only).each { |p| Yast::Pkg.PkgNeutral(p) } + @product ||= Y2Packager::ProductUpgrade.new_base_product end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/lib/y2packager/widgets/product_license_content.rb new/yast2-packager-4.0.55/src/lib/y2packager/widgets/product_license_content.rb --- old/yast2-packager-4.0.49/src/lib/y2packager/widgets/product_license_content.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/lib/y2packager/widgets/product_license_content.rb 2018-04-06 09:15:23.000000000 +0200 @@ -83,7 +83,7 @@ # # @return [String] Formatted license text def formatted_license_text - text = product.license(language) + text = product.license_content(language) if RICHTEXT_REGEXP =~ text text else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/modules/AddOnProduct.rb new/yast2-packager-4.0.55/src/modules/AddOnProduct.rb --- old/yast2-packager-4.0.49/src/modules/AddOnProduct.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/modules/AddOnProduct.rb 2018-04-06 09:15:23.000000000 +0200 @@ -22,6 +22,10 @@ # SLE12 HA GEO is now included in SLE15 HA "sle-ha-geo" => ["sle-ha"], "SUSE_SLES_SAP" => ["SLES_SAP"], + # SLES-12 with HPC module can be replaced by SLES_HPC-15 + "SLES" => ["SLES_HPC"], + # this is an internal product so far... + "SLE-HPC" => ["SLES_HPC"], # SMT is now integrated into the base SLES "sle-smt" => ["SLES"], # Live patching is a module now (bsc#1074154) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/modules/ProductLicense.rb new/yast2-packager-4.0.55/src/modules/ProductLicense.rb --- old/yast2-packager-4.0.49/src/modules/ProductLicense.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/modules/ProductLicense.rb 2018-04-06 09:15:23.000000000 +0200 @@ -3,6 +3,9 @@ require "uri" require "fileutils" +require "y2packager/product" +require "y2packager/product_license" + # Yast namespace module Yast # Provide access / dialog for product license @@ -81,7 +84,7 @@ @beta_file_already_seen = {} end - # Returns whether accepting the license manually is requied. + # Returns whether accepting the license manually is required. # # @see BNC #448598 # @param [Any] id unique ID @@ -191,6 +194,9 @@ return init_ret end + product = repository_product(src_id) + return :accepted if product && license_accepted_for?(product, licenses) + created_new_dialog = false # #459391 @@ -241,9 +247,10 @@ action ) - if ret == :accepted && !license_ident.nil? + if ret == :accepted # store already accepted license ID LicenseHasBeenAccepted(license_ident) + product.license.accept! if product && product.license end CleanUpLicense(@tmpdir) @@ -657,7 +664,7 @@ # @param [Array<String>] languages list of license translations # @param [Boolean] back enable "Back" button # @param [String] license_language default license language - # @param [Hash<String,String>] licenses licenses (mapping "langugage_code" => "license") + # @param [Hash<String,String>] licenses licenses (mapping "language_code" => "license") # @param [String] id unique license ID # @param [String] caption dialog title def DisplayLicenseDialogWithTitle(languages, back, license_language, licenses, id, caption) @@ -778,6 +785,44 @@ end end + # Determines whether the license was accepted for a given product + # + # This method reads the license content and uses the new + # Y2Packager::ProductLicense API to determine whether the license was + # accepted or not. This is just a transitory method because, in the future, + # all licenses should be read through the new API. + # + # @param product [Y2Packager::Product] Product instance + # @param licenses [Hash<String,String>] License files indexed by language + # @return [boolean] true if the license was already accepted; false if it was + # not acceptedd or it is not found. + def license_accepted_for?(product, licenses) + license_file = licenses["en_US"] || licenses["en"] || licenses[""] + content = SCR.Read(path(".target.string"), license_file).to_s + if content.empty? + log.error "No license found for #{product.name} in the repository" + return false + end + + license = Y2Packager::ProductLicense.find(product.name, content: content) + license && license.accepted? + end + + # Find the product in the given repository + # + # @param src_id [Integer] Repository ID + # @return [Y2Packager::Product,nil] Product or nil if it was not found + def repository_product(src_id) + product_h = Yast::Pkg.ResolvableProperties("", :product, "").find do |properties| + properties["source"] == src_id + end + if product_h.nil? + log.error "No product found in the repository (#{src_id})" + return + end + Y2Packager::Product.from_h(product_h) + end + def GetLicenseContent(lic_lang, licenses, id) license_file = ( licenses_ref = arg_ref(licenses.value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/src/modules/SpaceCalculation.rb new/yast2-packager-4.0.55/src/modules/SpaceCalculation.rb --- old/yast2-packager-4.0.49/src/modules/SpaceCalculation.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/src/modules/SpaceCalculation.rb 2018-04-06 09:15:23.000000000 +0200 @@ -583,7 +583,7 @@ used = 0 # If reusing a previously existent filesystem - if filesystem.exists_in_probed? + if filesystem.exists_in_raw_probed? # Mount the filesystem to check the available space. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/test/lib/clients/inst_product_upgrade_license_test.rb new/yast2-packager-4.0.55/test/lib/clients/inst_product_upgrade_license_test.rb --- old/yast2-packager-4.0.49/test/lib/clients/inst_product_upgrade_license_test.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/test/lib/clients/inst_product_upgrade_license_test.rb 2018-04-06 09:15:23.000000000 +0200 @@ -6,27 +6,15 @@ describe Y2Packager::Clients::InstProductUpgradeLicense do describe "#main" do let(:language) { double("Yast::Language", language: "en_US") } + let(:product) { nil } before do - allow(Yast::Pkg).to receive(:PkgUpdateAll) - allow(Yast::Pkg).to receive(:PkgReset) - allow(Yast::Pkg).to receive(:GetPackages).and_return([]) - allow(Y2Packager::Product).to receive(:selected_base).and_return(product) + allow(Y2Packager::ProductUpgrade).to receive(:new_base_product).and_return(product) allow(Yast::Report).to receive(:Error) allow(Yast::GetInstArgs).to receive(:going_back).and_return(false) stub_const("Yast::Language", language) end - let(:product) { nil } - - it "resets the temporarily selected and removed packages" do - expect(Yast::Pkg).to receive(:GetPackages).with(:selected, true).and_return(["foo"]) - expect(Yast::Pkg).to receive(:GetPackages).with(:removed, true).and_return(["bar"]) - expect(Yast::Pkg).to receive(:PkgNeutral).with("foo") - expect(Yast::Pkg).to receive(:PkgNeutral).with("bar") - subject.main - end - context "going back in the workflow" do before do expect(Yast::GetInstArgs).to receive(:going_back).and_return(true) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/test/lib/widgets/product_license_content_test.rb new/yast2-packager-4.0.55/test/lib/widgets/product_license_content_test.rb --- old/yast2-packager-4.0.49/test/lib/widgets/product_license_content_test.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/test/lib/widgets/product_license_content_test.rb 2018-04-06 09:15:23.000000000 +0200 @@ -22,11 +22,11 @@ subject(:widget) { described_class.new(product, language) } let(:language) { "de_DE" } - let(:product) { instance_double(Y2Packager::Product, license: "content") } + let(:product) { instance_double(Y2Packager::Product, license_content: "content") } describe "#contents" do it "includes license content in the given language" do - expect(product).to receive(:license).with(language) + expect(product).to receive(:license_content).with(language) .and_return("license content") widget.contents end @@ -36,7 +36,7 @@ let(:richtext) { CWM::RichText.new } before do - allow(product).to receive(:license).with("es_ES") + allow(product).to receive(:license_content).with("es_ES") .and_return("content es_ES") allow(CWM::RichText).to receive(:new).and_return(richtext) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/test/product_license_test.rb new/yast2-packager-4.0.55/test/product_license_test.rb --- old/yast2-packager-4.0.49/test/product_license_test.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/test/product_license_test.rb 2018-04-06 09:15:23.000000000 +0200 @@ -333,4 +333,63 @@ end end + describe "#license_accepted_for?" do + let(:product) { instance_double(Y2Packager::Product, name: "SLES") } + let(:content) { "license content" } + let(:licenses) { { "en_US" => "license.txt" } } + let(:product_license) { instance_double(Y2Packager::ProductLicense, accepted?: accepted?) } + let(:accepted?) { true } + + before do + allow(Yast::SCR).to receive(:Read).with(path(".target.string"), "license.txt") + .and_return(content) + allow(Y2Packager::ProductLicense).to receive(:find).and_return(product_license) + end + + it "reads the license and asks for a already seen license with the same content" do + expect(Y2Packager::ProductLicense).to receive(:find) + .with(product.name, content: content) + subject.send(:license_accepted_for?, product, licenses) + end + + context "when license has been already accepted" do + let(:accepted?) { true } + + it "returns true" do + expect(subject.send(:license_accepted_for?, product, licenses)).to eq(true) + end + end + + context "when the license has not been already accepted" do + let(:accepted?) { false } + + it "returns false" do + expect(subject.send(:license_accepted_for?, product, licenses)).to eq(false) + end + end + end + + describe "#repository_product" do + let(:resolvable_properties) do + [{ "name" => "SLES-HA", "source" => 1 }, { "name" => "SLES-SDK", "source" => 2 }] + end + + before do + allow(Yast::Pkg).to receive(:ResolvableProperties).with("", :product, "") + .and_return(resolvable_properties) + end + + context "when a product exists in the given repository" do + it "returns the product" do + product = subject.send(:repository_product, 2) + expect(product.name).to eq("SLES-SDK") + end + end + + context "when no product exists in the given repository" do + it "returns nil" do + expect(subject.send(:repository_product, 3)).to be_nil + end + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.0.49/test/space_calculation_test.rb new/yast2-packager-4.0.55/test/space_calculation_test.rb --- old/yast2-packager-4.0.49/test/space_calculation_test.rb 2018-03-15 14:08:35.000000000 +0100 +++ new/yast2-packager-4.0.55/test/space_calculation_test.rb 2018-04-06 09:15:23.000000000 +0200 @@ -41,6 +41,10 @@ end describe Yast::SpaceCalculation do + before do + Y2Storage::StorageManager.create_test_instance + end + describe "#get_partition_info" do context "on test mount during installation" do