commit yast2-installation for openSUSE:Factory

Hello community, here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2018-11-01 19:12:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old) and /work/SRC/openSUSE:Factory/.yast2-installation.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-installation" Thu Nov 1 19:12:15 2018 rev:412 rq:645894 version:4.1.24 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes 2018-09-04 22:51:57.080134635 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes 2018-11-01 19:12:18.702040952 +0100 @@ -1,0 +2,73 @@ +Thu Nov 1 08:03:27 UTC 2018 - jreidinger@suse.com + +- extra_urls: compare unexpanded urls, so two identical + repositories with variables are detected (bsc#1090193) +- 4.1.24 + +------------------------------------------------------------------- +Mon Oct 29 13:02:11 CET 2018 - schubi@suse.de + +- Added save_y2logs client. (fate#325737) +- 4.1.23 + +------------------------------------------------------------------- +Thu Oct 25 08:02:13 UTC 2018 - lslezak@suse.cz + +- Remember the selected role (related to FATE#325834) +- 4.1.22 + +------------------------------------------------------------------- +Tue Oct 23 14:17:49 CEST 2018 - schubi@suse.de + +- Saving y2logs after the installation has been finished. + (fate#325737) +- 4.1.21 + +------------------------------------------------------------------- +Tue Oct 16 13:52:00 CEST 2018 - schubi@suse.de + +- Fixed path to license file. . Build error in fate#324713 +- 4.1.20 + +------------------------------------------------------------------- +Tue Sep 25 15:11:15 UTC 2018 - dgonzalez@suse.com + +- Skip the roles' dialog selection when there is only one available + (fate#324713) +- 4.1.19 + +------------------------------------------------------------------- +Tue Sep 25 13:34:50 UTC 2018 - dgonzalez@suse.com + +- Fix syntax error (bsc#1109659) +- 4.1.18 + +------------------------------------------------------------------- +Tue Sep 25 10:35:03 CEST 2018 - schubi@suse.de + +- Updated docu for add_on_products.xml: Added tag "confirm_license" + to handle Add-On-products licenses which will be added while + installation. (bsc#1105758) +- 4.1.17 + +------------------------------------------------------------------- +Tue Sep 18 09:33:59 UTC 2018 - dgonzalez@suse.com + +- Avoid to restore old backups when upgrade fails (bsc#1097297) +- 4.1.16 + +------------------------------------------------------------------- +Thu Sep 13 16:37:43 UTC 2018 - lslezak@suse.cz + +- Copy the selected packages from the self-update repository to an + additional add-on repository, allow updating the installation + workflow from the self-update repository (bsc#1101016) +- 4.1.15 + +------------------------------------------------------------------- +Tue Sep 11 15:29:22 CEST 2018 - aschnell@suse.com + +- do not translate snapshot description (bsc#1092757) +- 4.1.14 + +------------------------------------------------------------------- Old: ---- yast2-installation-4.1.13.tar.bz2 New: ---- yast2-installation-4.1.24.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-installation.spec ++++++ --- /var/tmp/diff_new_pack.07HxDy/_old 2018-11-01 19:12:19.322040979 +0100 +++ /var/tmp/diff_new_pack.07HxDy/_new 2018-11-01 19:12:19.326040979 +0100 @@ -17,7 +17,7 @@ Name: yast2-installation -Version: 4.1.13 +Version: 4.1.24 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -47,8 +47,8 @@ BuildRequires: yast2 >= 4.1.3 Requires: yast2 >= 4.1.3 -# Yast::Packages.check_remote_installation_packages -BuildRequires: yast2-packager >= 4.0.9 +# Y2Packager::SelfUpdateAddonRepo +BuildRequires: yast2-packager >= 4.1.5 # Y2Storage::Inhibitors including systemd masking BuildRequires: yast2-storage-ng >= 4.0.194 @@ -64,8 +64,8 @@ # Mouse-related scripts moved to yast2-mouse Conflicts: yast2-mouse < 2.18.0 -# Yast::AddOnProduct.selected_installation_products -Requires: yast2-packager >= 4.0.56 +# Y2Packager::SelfUpdateAddonRepo +Requires: yast2-packager >= 4.1.5 # use in startup scripts Requires: initviocons @@ -252,7 +252,7 @@ %dir %{yast_vardir}/hooks/installation %dir %{yast_docdir} -%license %{yast_docdir}/COPYING +%license COPYING %doc %{yast_docdir}/README.md %doc %{yast_docdir}/CONTRIBUTING.md ++++++ yast2-installation-4.1.13.tar.bz2 -> yast2-installation-4.1.24.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/Rakefile new/yast2-installation-4.1.24/Rakefile --- old/yast2-installation-4.1.13/Rakefile 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/Rakefile 2018-11-01 12:33:37.000000000 +0100 @@ -1,4 +1,6 @@ require "yast/rake" +require "find" +require "English" Yast::Tasks.configuration do |conf| # lets ignore license check for now @@ -22,3 +24,16 @@ end task tarball: :check_rng_status + +# Extend the "check:syntax" task to check also the shell scripts +task :"check:syntax" do + puts "* Checking the startup shell scripts..." + Find.find("startup") do |path| + # simple and stupid check, either it's executable or ends with .sh + next unless File.file?(path) && (File.executable?(path) || path.end_with?(".sh")) + # -n = read commands but do not execute them, syntax check only + system("bash", "-n", path) + raise "Syntax check failed" unless $CHILD_STATUS.success? + end + puts "* Done" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/doc/SELF_UPDATE.md new/yast2-installation-4.1.24/doc/SELF_UPDATE.md --- old/yast2-installation-4.1.13/doc/SELF_UPDATE.md 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/doc/SELF_UPDATE.md 2018-11-01 12:33:37.000000000 +0100 @@ -31,9 +31,14 @@ containing the updates. 2. If updates are available, they will be downloaded. Otherwise, the process will be silently skipped. -3. The updates will be applied to the installation system. +3. The updates will be applied to the installation system, the meta-packages + which are needed by the installer are copied to the inst-sys instead of + applying. 4. YaST will be restarted to reload the modified files and the installation will be resumed. +5. The selected meta-packages copied to the inst-sys are added as an add-on + installation repository to allow updating the `skelcd-*` or `*-release` + packages via the self-update repository. ### Language Selection @@ -67,7 +72,9 @@ YaST will use RPM packages stored in a rpm-md repository, although they are handled in a different way: -* All RPMs in the repository are considered (no "patch" metadata). +* All RPMs in the repository are considered (no "patch" metadata), only some + meta-packages are skipped (e.g. the packages providing `system-installation()` + or `product()`, it does not make sense to apply them to the inst-sys). * RPMs are not installed in the usual way: they're uncompressed and no scripts are executed. * No dependency checks are performed. RPMs are added in alphabetical order. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/doc/features.md new/yast2-installation-4.1.24/doc/features.md --- old/yast2-installation-4.1.13/doc/features.md 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/doc/features.md 2018-11-01 12:33:37.000000000 +0100 @@ -60,6 +60,15 @@ default is 'false' (optional) --> <selected config:type="boolean">true</selected> + <!-- + Defines priority of the newly added repository (optional). + Libzypp uses its default priority if not set. + --> + <priority config:type="integer">20</priority> + <!-- + User has to accept license? + --> + <confirm_license config:type="boolean">true</confirm_license> </product_item> <!-- Another product item --> @@ -95,6 +104,12 @@ - (boolean) *selected* - Defines the default state of *pre-selected* state in case of *ask\_user* used; default is *false* +- (integer) *priority* - Defines priority of the newly added repository. + Libzypp uses its default priority if not set. + +- (boolean) *confirm_license* - User has to accept license if available? + default: AutoYaST installation:false ; normal installation:true + - (list \<string\>) *install\_products/product* - List of products to add if there are more than one products at the repository URL; if not defined, all products are installed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/package/yast2-installation.changes new/yast2-installation-4.1.24/package/yast2-installation.changes --- old/yast2-installation-4.1.13/package/yast2-installation.changes 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/package/yast2-installation.changes 2018-11-01 12:33:37.000000000 +0100 @@ -1,4 +1,77 @@ ------------------------------------------------------------------- +Thu Nov 1 08:03:27 UTC 2018 - jreidinger@suse.com + +- extra_urls: compare unexpanded urls, so two identical + repositories with variables are detected (bsc#1090193) +- 4.1.24 + +------------------------------------------------------------------- +Mon Oct 29 13:02:11 CET 2018 - schubi@suse.de + +- Added save_y2logs client. (fate#325737) +- 4.1.23 + +------------------------------------------------------------------- +Thu Oct 25 08:02:13 UTC 2018 - lslezak@suse.cz + +- Remember the selected role (related to FATE#325834) +- 4.1.22 + +------------------------------------------------------------------- +Tue Oct 23 14:17:49 CEST 2018 - schubi@suse.de + +- Saving y2logs after the installation has been finished. + (fate#325737) +- 4.1.21 + +------------------------------------------------------------------- +Tue Oct 16 13:52:00 CEST 2018 - schubi@suse.de + +- Fixed path to license file. . Build error in fate#324713 +- 4.1.20 + +------------------------------------------------------------------- +Tue Sep 25 15:11:15 UTC 2018 - dgonzalez@suse.com + +- Skip the roles' dialog selection when there is only one available + (fate#324713) +- 4.1.19 + +------------------------------------------------------------------- +Tue Sep 25 13:34:50 UTC 2018 - dgonzalez@suse.com + +- Fix syntax error (bsc#1109659) +- 4.1.18 + +------------------------------------------------------------------- +Tue Sep 25 10:35:03 CEST 2018 - schubi@suse.de + +- Updated docu for add_on_products.xml: Added tag "confirm_license" + to handle Add-On-products licenses which will be added while + installation. (bsc#1105758) +- 4.1.17 + +------------------------------------------------------------------- +Tue Sep 18 09:33:59 UTC 2018 - dgonzalez@suse.com + +- Avoid to restore old backups when upgrade fails (bsc#1097297) +- 4.1.16 + +------------------------------------------------------------------- +Thu Sep 13 16:37:43 UTC 2018 - lslezak@suse.cz + +- Copy the selected packages from the self-update repository to an + additional add-on repository, allow updating the installation + workflow from the self-update repository (bsc#1101016) +- 4.1.15 + +------------------------------------------------------------------- +Tue Sep 11 15:29:22 CEST 2018 - aschnell@suse.com + +- do not translate snapshot description (bsc#1092757) +- 4.1.14 + +------------------------------------------------------------------- Tue Sep 4 13:34:17 UTC 2018 - dgonzalez@suse.com - Use /media.1/media instead the /media.1/build (bsc#1062297) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/package/yast2-installation.spec new/yast2-installation-4.1.24/package/yast2-installation.spec --- old/yast2-installation-4.1.13/package/yast2-installation.spec 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/package/yast2-installation.spec 2018-11-01 12:33:37.000000000 +0100 @@ -16,7 +16,7 @@ # Name: yast2-installation -Version: 4.1.13 +Version: 4.1.24 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -46,8 +46,8 @@ BuildRequires: yast2 >= 4.1.3 Requires: yast2 >= 4.1.3 -# Yast::Packages.check_remote_installation_packages -BuildRequires: yast2-packager >= 4.0.9 +# Y2Packager::SelfUpdateAddonRepo +BuildRequires: yast2-packager >= 4.1.5 # Y2Storage::Inhibitors including systemd masking BuildRequires: yast2-storage-ng >= 4.0.194 @@ -63,8 +63,8 @@ # Mouse-related scripts moved to yast2-mouse Conflicts: yast2-mouse < 2.18.0 -# Yast::AddOnProduct.selected_installation_products -Requires: yast2-packager >= 4.0.56 +# Y2Packager::SelfUpdateAddonRepo +Requires: yast2-packager >= 4.1.5 # use in startup scripts Requires: initviocons @@ -251,6 +251,6 @@ %dir %{yast_vardir}/hooks/installation %dir %{yast_docdir} -%license %{yast_docdir}/COPYING +%license COPYING %doc %{yast_docdir}/README.md %doc %{yast_docdir}/CONTRIBUTING.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/clients/save_y2logs.rb new/yast2-installation-4.1.24/src/clients/save_y2logs.rb --- old/yast2-installation-4.1.13/src/clients/save_y2logs.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.1.24/src/clients/save_y2logs.rb 2018-11-01 12:33:37.000000000 +0100 @@ -0,0 +1,2 @@ +require "installation/clients/save_y2logs" +Yast::SaveY2logs.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/clients/inst_extrasources.rb new/yast2-installation-4.1.24/src/lib/installation/clients/inst_extrasources.rb --- old/yast2-installation-4.1.13/src/lib/installation/clients/inst_extrasources.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/clients/inst_extrasources.rb 2018-11-01 12:33:37.000000000 +0100 @@ -345,7 +345,7 @@ result = srcs.each_with_object([]) do |src, ret| general = Pkg.SourceGeneralData(src) - url = general["url"] + url = general["raw_url"] next if url.nil? || url.empty? @local_urls[src] = url if Mode.update && url =~ /^dir:\/+mnt\/+/ # check for USB sources which should be disabled diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/clients/inst_update_installer.rb new/yast2-installation-4.1.24/src/lib/installation/clients/inst_update_installer.rb --- old/yast2-installation-4.1.13/src/lib/installation/clients/inst_update_installer.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/clients/inst_update_installer.rb 2018-11-01 12:33:37.000000000 +0100 @@ -15,6 +15,7 @@ require "installation/updates_manager" require "installation/update_repositories_finder" +require "y2packager/self_update_addon_repo" require "uri" require "yaml" @@ -112,6 +113,10 @@ updated = update_repositories.map { |u| add_repository(u) }.any? if updated + # copy the addon packages before applying the updates to inst-sys, + # #apply_all removes the repositories! + Yast::Progress.NextStage + copy_addon_packages log.info("Applying installer updates") Yast::Progress.NextStage updates_manager.apply_all @@ -387,6 +392,7 @@ # TRANSLATORS: progress label _("Add Update Repository"), _("Download the Packages"), + _("Copy the Addon Packages"), _("Apply the Packages"), _("Restart") ] @@ -508,5 +514,15 @@ log.info("Processing profile location...") ProfileLocation.Process end + + # + # Copy the addon packages from the self-update repositories to the inst-sys + # + def copy_addon_packages + log.info("Copying optional addon packages from the self update repositories...") + updates_manager.repositories.each do |u| + ::Y2Packager::SelfUpdateAddonRepo.copy_packages(u.repo_id) + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/clients/save_y2logs.rb new/yast2-installation-4.1.24/src/lib/installation/clients/save_y2logs.rb --- old/yast2-installation-4.1.13/src/lib/installation/clients/save_y2logs.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.1.24/src/lib/installation/clients/save_y2logs.rb 2018-11-01 12:33:37.000000000 +0100 @@ -0,0 +1,25 @@ +# encoding: utf-8 +# File: src/lib/installation/clients/inst_save_y2logs.rb +# Module: Installation +# Summary: Saving y2logs by calling save_y2logs +# + +module Yast + class SaveY2logs < Client + def main + Yast.import "Directory" + Yast.import "Installation" + Yast.import "ProductFeatures" + + if ProductFeatures.GetBooleanFeature("globals", "save_y2logs") + target_path = ::File.join( + Yast::Installation.destdir, + Yast::Directory.logdir + ) + + WFM.Execute(Yast::Path.new(".local.bash"), + "/usr/sbin/save_y2logs '#{target_path}/yast-installation-logs.tar.xz'") + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/copy_logs_finish.rb new/yast2-installation-4.1.24/src/lib/installation/copy_logs_finish.rb --- old/yast2-installation-4.1.13/src/lib/installation/copy_logs_finish.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/copy_logs_finish.rb 2018-11-01 12:33:37.000000000 +0100 @@ -32,6 +32,7 @@ Yast.import "Directory" Yast.import "Installation" + Yast.import "ProductFeatures" end def steps @@ -88,6 +89,9 @@ end end + # Saving y2logs + WFM.CallFunction("save_y2logs") + nil end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/select_system_role.rb new/yast2-installation-4.1.24/src/lib/installation/select_system_role.rb --- old/yast2-installation-4.1.13/src/lib/installation/select_system_role.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/select_system_role.rb 2018-11-01 12:33:37.000000000 +0100 @@ -35,11 +35,6 @@ class SelectSystemRole < ::UI::InstallationDialog include UI::TextHelpers - class << self - # once the user selects a role, remember it in case they come back - attr_accessor :original_role_id - end - NON_OVERLAY_ATTRIBUTES = [ "additional_dialogs", "id", @@ -60,10 +55,18 @@ if Yast::GetInstArgs.going_back # If coming back, we have to run the additional dialogs first... - clients = additional_clients_for(self.class.original_role_id) + clients = additional_clients_for(SystemRole.current) direction = run_clients(clients, going_back: true) - # ... and only run the main dialog (super) if we are *still* going back - return direction unless direction == :back + # ...and only run the main dialog (super) if there is more than one role (fate#324713) and we + # are *still* going back + return direction if single_role? || direction != :back + end + + if single_role? + # Apply the role and skip the dialog when there is only one (fate#324713) + log.info "Only one role available, applying it and skipping the dialog" + clear_role + return select_role(roles.first.id) end super @@ -78,7 +81,7 @@ end def dialog_content - @selected_role_id = self.class.original_role_id + @selected_role_id = SystemRole.current @selected_role_id ||= roles.first && roles.first.id if SystemRole.default? HCenter(ReplacePoint(Id(:rp), role_buttons(selected_role_id: @selected_role_id))) @@ -92,26 +95,7 @@ end def next_handler - role_id = @selected_role_id - - if role_id.nil? # no role selected (bsc#1078809) - # An Error popup - msg = _("Select one of the available roles to continue.") - Yast::Popup.Error(msg) - return - end - - orig_role_id = self.class.original_role_id - if !orig_role_id.nil? && orig_role_id != role_id - # A Continue-Cancel popup - msg = _("Changing the system role may undo adjustments you may have done.") - return unless Yast::Popup.ContinueCancel(msg) - end - self.class.original_role_id = role_id - - apply_role(SystemRole.find(role_id)) - - result = run_clients(additional_clients_for(role_id)) + result = select_role(@selected_role_id) # We show the main role dialog; but the additional clients have # drawn over it, so draw it again and go back to input loop. # create_dialog do not create new dialog if it already exist like in this @@ -139,6 +123,35 @@ private + # checks if there is only one role available + def single_role? + roles.size == 1 + end + + # Applies the role with given id and run its additional clients, if any + # + # @param role_id [Integer] The role to be applied + # + # @see run_clients + # + # @return [:next,:back,:abort] which direction the additional dialogs exited + def select_role(role_id) + if role_id.nil? + # no role selected (bsc#1078809) + Yast::Popup.Error(_("Select one of the available roles to continue.")) + return :back + end + + if SystemRole.current && SystemRole.current != role_id + # Changing the role, show a Continue-Cancel popup to user + msg = _("Changing the system role may undo adjustments you may have done.") + return :back unless Yast::Popup.ContinueCancel(msg) + end + + apply_role(role_id) + run_clients(additional_clients_for(role_id)) + end + # gets array of clients to run for given role def additional_clients_for(role_id) role = SystemRole.find(role_id) @@ -192,8 +205,10 @@ end # Applies given role to configuration - def apply_role(role) - log.info "Applying system role '#{role.id}'" + def apply_role(role_id) + log.info "Applying system role '#{role_id}'" + + role = SystemRole.select(role_id) role.overlay_features adapt_services(role) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/snapshots_finish.rb new/yast2-installation-4.1.24/src/lib/installation/snapshots_finish.rb --- old/yast2-installation-4.1.13/src/lib/installation/snapshots_finish.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/snapshots_finish.rb 2018-11-01 12:33:37.000000000 +0100 @@ -48,15 +48,15 @@ def create_post_snapshot pre_number = Yast2::FsSnapshotStore.load("update") - # TRANSLATORS: label for filesystem snapshot taken after system update - Yast2::FsSnapshot.create_post(_("after update"), pre_number, cleanup: :number, important: true) + # as of bsc #1092757 snapshot descriptions are not translated + Yast2::FsSnapshot.create_post("after update", pre_number, cleanup: :number, important: true) Yast2::FsSnapshotStore.clean("update") true end def create_single_snapshot - # TRANSLATORS: label for filesystem snapshot taken after system installation - Yast2::FsSnapshot.create_single(_("after installation"), cleanup: :number, important: true) + # as of bsc #1092757 snapshot descriptions are not translated + Yast2::FsSnapshot.create_single("after installation", cleanup: :number, important: true) true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/system_role.rb new/yast2-installation-4.1.24/src/lib/installation/system_role.rb --- old/yast2-installation-4.1.13/src/lib/installation/system_role.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/system_role.rb 2018-11-01 12:33:37.000000000 +0100 @@ -130,6 +130,8 @@ # @see current def select(role_id) @current_role = find(role_id) + log.info("Selected role: #{current}") + current_role end # Returns the current role id diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/src/lib/installation/update_repository.rb new/yast2-installation-4.1.24/src/lib/installation/update_repository.rb --- old/yast2-installation-4.1.13/src/lib/installation/update_repository.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/src/lib/installation/update_repository.rb 2018-11-01 12:33:37.000000000 +0100 @@ -18,6 +18,7 @@ require "packages/package_downloader" require "packages/package_extractor" +require "y2packager/self_update_addon_filter" Yast.import "Pkg" Yast.import "Progress" @@ -136,10 +137,11 @@ add_repo end - # Retrieves the list of packages to install + # Retrieves the list of packages to unpack to the inst-sys # - # Only packages in the update repository are considered. Packages are - # sorted by name (alphabetical order). + # Only packages in the update repository are considered, meta-packages + # which should be used in an add-on and not applied to the inst-sys are ignored. + # The packages are sorted by name (alphabetical order). # # @return [Array<Hash>] List of packages to install # @@ -149,7 +151,11 @@ add_repo candidates = Yast::Pkg.ResolvableProperties("", :package, "") @packages = candidates.select { |p| p["source"] == repo_id }.sort_by! { |a| a["name"] } - log.info "Considering #{@packages.size} packages: #{@packages}" + log.info "Found #{@packages.size} packages: #{@packages}" + # remove packages which are used as addons, these should not be applied to the inst-sys + addon_pkgs = Y2Packager::SelfUpdateAddonFilter.packages(repo_id) + @packages.reject! { |p| addon_pkgs.include?(p["name"]) } + log.info "Using #{@packages.size} packages: #{@packages}" @packages end @@ -245,10 +251,9 @@ # Determine whether the repository is empty or not # # @return [Boolean] true if the repository is empty; false otherwise. - # - # @see #packages def empty? - packages.empty? + candidates = Yast::Pkg.ResolvableProperties("", :package, "") + candidates.none? { |p| p["source"] == repo_id } end # Returns whether is a user defined repository diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/startup/YaST2.call new/yast2-installation-4.1.24/startup/YaST2.call --- old/yast2-installation-4.1.13/startup/YaST2.call 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/startup/YaST2.call 2018-11-01 12:33:37.000000000 +0100 @@ -148,7 +148,7 @@ # --- # : - export Y2STYLE="installation_slim" + export Y2STYLE="installation_slim" set_inst_qt_env } @@ -268,7 +268,7 @@ { # SecondStageRequired can be set: # 1. after 1st stage (note 2nd stage is not always required) - # 2. after 2nd stage (when another YaST run is required due to e.g. + # 2. after 2nd stage (when another YaST run is required due to e.g. # kernel update) if [ -f /etc/install.inf ] ; then @@ -282,17 +282,47 @@ fi } +#---[ validate_backup ]---# +function validate_backup () { + # Check that the ID and VERSION_ID in the backup os-release file + # matches with the values in the /etc/os-release to considered it + # as a valid backup to be restored (bsc#1097297) + # + # See also https://www.freedesktop.org/software/systemd/man/os-release.html + root="/mnt" + backup_id=$(grep "^ID=" $root/var/adm/backup/os-release | cut -d'=' -f2 | tr -d '"') + backup_version_id=$(grep "^VERSION_ID=" $root/var/adm/backup/os-release | cut -d'=' -f2 | tr -d '"') + backup_version="$backup_id-$backup_version_id" + current_id=$(grep "^ID=" $root/etc/os-release | cut -d'=' -f2 | tr -d '"') + current_version_id=$(grep "^VERSION_ID=" $root/etc/os-release | cut -d'=' -f2 | tr -d '"') + current_version="$current_id-$current_version_id" + + log "Checking if it is a valid backup" + + if [ $backup_version = $current_version ]; then + return 0 + else + log "\tNot valid backup version. Expected: $current_version. Found: $backup_version" + return 1 + fi +} #----[ restore_backup ]----# function restore_backup () { # restores backup if it is available - if [ -d /mnt/var/adm/backup/system-upgrade ]; then - log "\tStarting restore scripts" - for i in /mnt/var/adm/backup/system-upgrade/restore-*.sh; do - log "\tStarting $i" - sh $i /mnt - done + if [ -d /mnt/var/adm/backup/system-upgrade ]; then + if validate_backup; then + log "\tStarting restore scripts" + + for i in /mnt/var/adm/backup/system-upgrade/restore-*.sh; do + log "\tStarting $i" + + sh $i /mnt + done + else + log "\tBackup was not restore because its version info does not match" fi + fi } #----[ start_yast ]----# @@ -679,7 +709,7 @@ # when found the ssh daemon is killed, so create this file as the very last step!! # (https://github.com/openSUSE/installation-images/blob/c57181329ab7040369da705...) echo $Y2_EXIT_CODE > /tmp/YaST2_ssh_installation_finished -fi +fi if [ $SELECTED_MEDIUM != "SSH" ] && [ "$Y2_MODE" = "ncurses" ]; then # Enable display of status messages on the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/test/inst_extrasources_test.rb new/yast2-installation-4.1.24/test/inst_extrasources_test.rb --- old/yast2-installation-4.1.13/test/inst_extrasources_test.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/test/inst_extrasources_test.rb 2018-11-01 12:33:37.000000000 +0100 @@ -12,10 +12,10 @@ subject.instance_variable_set(:"@usb_sources", {}) allow(Yast::Pkg).to receive(:SourceGetCurrent).with(false).and_return([0, 1, 2, 3]) - allow(Yast::Pkg).to receive(:SourceGeneralData).with(0).and_return("url" => "http://test.com/") + allow(Yast::Pkg).to receive(:SourceGeneralData).with(0).and_return("raw_url" => "http://test.com/") allow(Yast::Pkg).to receive(:SourceGeneralData).with(1) - .and_return("url" => "usb://device=/dev/disk/by-id/usb-15") - allow(Yast::Pkg).to receive(:SourceGeneralData).with(2).and_return("url" => "dir:///mnt/path") + .and_return("raw_url" => "usb://device=/dev/disk/by-id/usb-15") + allow(Yast::Pkg).to receive(:SourceGeneralData).with(2).and_return("raw_url" => "dir:///mnt/path") allow(Yast::Pkg).to receive(:SourceGeneralData).with(3).and_return({}) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/test/inst_update_installer_test.rb new/yast2-installation-4.1.24/test/inst_update_installer_test.rb --- old/yast2-installation-4.1.13/test/inst_update_installer_test.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/test/inst_update_installer_test.rb 2018-11-01 12:33:37.000000000 +0100 @@ -14,7 +14,7 @@ let(:manager) do double("update_manager", all_signed?: all_signed?, apply_all: true, - repositories?: has_repos) + repositories?: has_repos, repositories: repos) end let(:url) { "http://update.opensuse.org/\$arch/update.dud" } let(:real_url) { "http://update.opensuse.org/#{arch}/update.dud" } @@ -26,6 +26,8 @@ let(:all_signed?) { true } let(:network_running) { true } let(:has_repos) { true } + let(:repo) { double("repo", repo_id: 42) } + let(:repos) { [repo] } let(:restarting) { false } let(:profile) { {} } let(:ay_profile) { double("Yast::Profile", current: profile) } @@ -43,6 +45,7 @@ allow(subject).to receive(:require).with("registration/url_helpers").and_raise(LoadError) stub_const("Registration::Storage::InstallationOptions", FakeInstallationOptions) stub_const("Registration::Storage::Config", FakeRegConfig) + allow(Y2Packager::SelfUpdateAddonRepo).to receive(:copy_packages) # skip the libzypp initialization globally, enable in the specific tests allow(subject).to receive(:initialize_packager).and_return(true) @@ -111,14 +114,22 @@ context "and update works" do before do - allow(subject).to receive(:update_installer).and_return(true) + allow(subject).to receive(:self_update_enabled?).and_return(true) + allow(subject).to receive(:add_repository).and_return(true) + allow(manager).to receive(:apply_all) + allow(::FileUtils).to receive(:touch) + allow(Y2Packager::SelfUpdateAddonRepo).to receive(:copy_packages) end it "creates update file and returns :restart_yast" do - expect(::FileUtils).to receive(:touch).once - allow(subject).to receive(:self_update_enabled?).and_return(true) expect(subject.main).to eq(:restart_yast) end + + it "copies the add-on packages from the self-update repository" do + expect(Y2Packager::SelfUpdateAddonRepo).to receive(:copy_packages) + .with(repo.repo_id) + subject.main + end end context "and update fails" do @@ -154,6 +165,7 @@ context "when repository is empty" do let(:has_repos) { false } + let(:repos) { [] } it "does not restart YaST" do expect(manager).to receive(:add_repository) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/test/lib/clients/inst_system_analysis_test.rb new/yast2-installation-4.1.24/test/lib/clients/inst_system_analysis_test.rb --- old/yast2-installation-4.1.13/test/lib/clients/inst_system_analysis_test.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/test/lib/clients/inst_system_analysis_test.rb 2018-11-01 12:33:37.000000000 +0100 @@ -43,6 +43,7 @@ allow(storage).to receive(:activate).and_return activate_result allow(storage).to receive(:probe).and_return probe_result allow(Yast::Mode).to receive(:auto).and_return(auto) + allow(Yast::Execute).to receive(:locally!) stub_const("Y2Autoinstallation::ActivateCallbacks", callbacks_class) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/test/lib/clients/save_y2logs_test.rb new/yast2-installation-4.1.24/test/lib/clients/save_y2logs_test.rb --- old/yast2-installation-4.1.13/test/lib/clients/save_y2logs_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.1.24/test/lib/clients/save_y2logs_test.rb 2018-11-01 12:33:37.000000000 +0100 @@ -0,0 +1,36 @@ +#!/usr/bin/env rspec + +require_relative "../../test_helper" +require "installation/clients/save_y2logs" + +Yast.import "ProductFeatures" + +describe Yast::SaveY2logs do + subject(:client) { described_class.new } + + describe "#main" do + let(:bash_path) { Yast::Path.new(".local.bash") } + + context "globals/save_y2logs in control.xml is false" do + it "does not save y2logs" do + expect(Yast::ProductFeatures).to receive(:GetBooleanFeature).with("globals", "save_y2logs").and_return(false) + expect(Yast::WFM).not_to receive(:Execute).with( + bash_path, + "/usr/sbin/save_y2logs '/var/log/YaST2/yast-installation-logs.tar.xz'" + ) + client.main + end + end + + context "globals/save_y2logs in control.xml is true" do + it "saves y2logs" do + expect(Yast::ProductFeatures).to receive(:GetBooleanFeature).with("globals", "save_y2logs").and_return(true) + expect(Yast::WFM).to receive(:Execute).with( + bash_path, + "/usr/sbin/save_y2logs '/var/log/YaST2/yast-installation-logs.tar.xz'" + ) + client.main + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.1.13/test/select_system_role_test.rb new/yast2-installation-4.1.24/test/select_system_role_test.rb --- old/yast2-installation-4.1.13/test/select_system_role_test.rb 2018-09-04 16:13:02.000000000 +0200 +++ new/yast2-installation-4.1.24/test/select_system_role_test.rb 2018-11-01 12:33:37.000000000 +0100 @@ -13,6 +13,7 @@ "Lorem Ipsum #{s}" end + allow(Installation::SystemRole).to receive(:select) allow(Yast::UI).to receive(:ChangeWidget) allow(Yast::Language).to receive(:language).and_return("en_US") @@ -21,12 +22,10 @@ describe "#run" do before do - # reset previous test - subject.class.original_role_id = nil - allow(Yast::ProductFeatures).to receive(:ClearOverlay) - allow(Yast::ProductFeatures).to receive(:SetOverlay) # .with + allow(Yast::ProductFeatures).to receive(:SetOverlay) allow(Yast::Packages).to receive(:SelectSystemPatterns) + allow(Installation::SystemRole).to receive(:current) end context "when no roles are defined" do @@ -41,6 +40,90 @@ end end + context "when single role is defined" do + let(:additional_dialogs) { "" } + let(:control_file_roles) do + [ + { "id" => "bar", "order" => "200", + "software" => { "desktop" => "knome" }, "additional_dialogs" => additional_dialogs } + ] + end + + before do + allow(Yast::ProductControl).to receive(:system_roles) + .and_return(control_file_roles) + allow(Yast::WFM).to receive(:CallFunction).and_return(:next) + allow(Installation::SystemRole).to receive(:select).with("bar") + .and_return(Installation::SystemRole.new(id: "bar", order: 200)) + end + + it "(re)sets ProductFeatures" do + expect(Yast::ProductFeatures).to receive(:ClearOverlay) + expect(Yast::ProductFeatures).to receive(:SetOverlay) + + subject.run + end + + context "and going forward" do + before do + allow(Yast::UI).to receive(:UserInput).and_return(:next) + end + + it "does not display dialog" do + expect(Yast::Wizard).to_not receive(:SetContents) + expect(Yast::UI).to_not receive(:UserInput) + expect(Yast::UI).to_not receive(:QueryWidget) + + subject.run + end + + it "returns :next" do + expect(subject.run).to be(:next) + end + + context "and there are additional dialogs" do + let(:additional_dialogs) { "a,b" } + + it "shows the first one" do + expect(Yast::WFM).to receive(:CallFunction).with("a", anything).and_return(:next) + + subject.run + end + end + end + + context "and going back" do + before do + allow(Installation::SystemRole).to receive(:current).and_return("bar") + allow(Yast::GetInstArgs).to receive(:going_back).and_return(true) + allow(Yast::UI).to receive(:UserInput).and_return(:back) + end + + it "does not display dialog" do + expect(Yast::Wizard).to_not receive(:SetContents) + expect(Yast::UI).to_not receive(:UserInput) + expect(Yast::UI).to_not receive(:QueryWidget) + + subject.run + end + + it "returns :back" do + expect(subject.run).to be(:back) + end + + context "and there are additional dialogs" do + let(:additional_dialogs) { "a,b" } + + it "shows the last one" do + allow(Yast::GetInstArgs).to receive(:going_back).and_return(true) + expect(Yast::WFM).to receive(:CallFunction).with("b", anything).and_return(:next) + + subject.run + end + end + end + end + context "when some roles are defined" do let(:control_file_roles) do [ @@ -53,6 +136,10 @@ before do allow(Yast::ProductControl).to receive(:system_roles) .and_return(control_file_roles) + allow(Installation::SystemRole).to receive(:select).with("foo") + .and_return(Installation::SystemRole.new(id: "foo", order: 100)) + allow(Installation::SystemRole).to receive(:select).with("bar") + .and_return(Installation::SystemRole.new(id: "bar", order: 200)) end it "displays dialog, and sets ProductFeatures on Next" do @@ -61,7 +148,7 @@ .and_return("foo", :next) expect(Yast::ProductFeatures).to receive(:ClearOverlay) - expect(Yast::ProductFeatures).to receive(:SetOverlay) # .with + expect(Yast::ProductFeatures).to receive(:SetOverlay) expect(subject.run).to eq(:next) end @@ -89,7 +176,7 @@ end it "shows the last dialog when going back" do - subject.class.original_role_id = "bar" + allow(Installation::SystemRole).to receive(:current).and_return("bar") allow(Yast::GetInstArgs).to receive(:going_back).and_return(true) expect(Yast::Wizard).to_not receive(:SetContents) expect(Yast::UI).to_not receive(:UserInput) @@ -103,8 +190,7 @@ context "when re-selecting the same role" do it "just proceeds without a popup" do - subject.class.original_role_id = "foo" - + allow(Installation::SystemRole).to receive(:current).and_return("foo") allow(Yast::Wizard).to receive(:SetContents) allow(Yast::UI).to receive(:UserInput) .and_return("foo", :next) @@ -120,8 +206,7 @@ context "when re-selecting a different role" do it "displays a popup, and proceeds if Continue is answered" do - subject.class.original_role_id = "bar" - + allow(Installation::SystemRole).to receive(:current).and_return("bar") allow(Yast::Wizard).to receive(:SetContents) allow(Yast::UI).to receive(:UserInput) .and_return("foo", :next) @@ -136,8 +221,7 @@ end it "displays a popup, and does not proceed if Cancel is answered" do - subject.class.original_role_id = "bar" - + allow(Installation::SystemRole).to receive(:current).and_return("bar") allow(Yast::Wizard).to receive(:SetContents) allow(Yast::UI).to receive(:UserInput) .and_return("foo", :next, :back)
participants (1)
-
root