From c494b3bb9212420af350b1fd8306691cc49d6501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 18 Mar 2021 17:38:00 +0100 Subject: [PATCH 1/4] Do not create zypp cache symlink in installed system (bsc#1183683) it would create `/var/cache/zypp` -> `/var/cache/zypp` loop --- src/clients/inst_kickoff.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/clients/inst_kickoff.rb b/src/clients/inst_kickoff.rb index 98078dcc..40b95439 100644 --- a/src/clients/inst_kickoff.rb +++ b/src/clients/inst_kickoff.rb @@ -46,15 +46,18 @@ def main ) end - # copy the credential files (libzypp loads them from target) - # and the repository cache to the target system - Pkg.SourceCacheCopyTo(Installation.destdir) - - # symlink the cache from inst-sys to save same space (RAM!) - cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" - log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") - ::FileUtils.rm_rf(cache_path) - File.symlink(File.join(Installation.destdir, cache_path), cache_path) + # copy the zypp cache to the target system (only when running in inst-sys!) + if Stage.initial + # copy the credential files (libzypp loads them from target) + # and the repository cache to the target system + Pkg.SourceCacheCopyTo(Installation.destdir) + + # symlink the cache from inst-sys to save same space (RAM!) + cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" + log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") + ::FileUtils.rm_rf(cache_path) + File.symlink(File.join(Installation.destdir, cache_path), cache_path) + end # installation, for instance... if !Mode.update From 1c7f06e8b519a20464c296f7f9b82ca4d99615fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 18 Mar 2021 18:15:32 +0100 Subject: [PATCH 2/4] YaST Console: removed "Software Repositories" button (bsc#1183687) Added "configure_repositories" command to the command line interface for experts --- .../plugins/configure_repositories_command.rb | 30 +++++++++++ .../console/plugins/repositories_button.rb | 52 ------------------- .../plugins/repositories_button_test.rb | 40 -------------- 3 files changed, 30 insertions(+), 92 deletions(-) create mode 100644 src/lib/installation/console/plugins/configure_repositories_command.rb delete mode 100644 src/lib/installation/console/plugins/repositories_button.rb delete mode 100644 test/lib/installation/plugins/repositories_button_test.rb diff --git a/src/lib/installation/console/plugins/configure_repositories_command.rb b/src/lib/installation/console/plugins/configure_repositories_command.rb new file mode 100644 index 00000000..1082b660 --- /dev/null +++ b/src/lib/installation/console/plugins/configure_repositories_command.rb @@ -0,0 +1,30 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2021 SUSE LLC, All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# ------------------------------------------------------------------------------ + +module Installation + module Console + # define the "configure_repositories" command in the expert console + class Commands + def configure_repositories + run_yast_module("repositories") + end + + private + + def configure_repositories_description + "Run the repository manager. Be careful when using it,\n" \ + "you might easily break the installer when wrongly used!" + end + end + end +end diff --git a/src/lib/installation/console/plugins/repositories_button.rb b/src/lib/installation/console/plugins/repositories_button.rb deleted file mode 100644 index ae1e0ab2..00000000 --- a/src/lib/installation/console/plugins/repositories_button.rb +++ /dev/null @@ -1,52 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) 2021 SUSE LLC, All Rights Reserved. -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of version 2 of the GNU General Public License as published by the -# Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# ------------------------------------------------------------------------------ - -require "yast" - -require "cwm" - -module Installation - module Console - module Plugins - # define a CWM widget for starting repository configuration - class RepositoriesButton < CWM::PushButton - def initialize - textdomain "packager" - end - - def label - # TRANSLATORS: a button label, it starts the repository configuration - _("Configure Software Repositories...") - end - - def help - # TRANSLATORS: help text - _("

If you need to use an additional repository for installing packages " \ - "then use the Configure Software Repositories button.

") - end - - def handle - Yast::WFM.call("repositories") - nil - end - end - - # define a console plugin - class RepositoriesButtonPlugin < MenuPlugin - def widget - RepositoriesButton.new - end - end - end - end -end diff --git a/test/lib/installation/plugins/repositories_button_test.rb b/test/lib/installation/plugins/repositories_button_test.rb deleted file mode 100644 index d9309c23..00000000 --- a/test/lib/installation/plugins/repositories_button_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) [2021] SUSE LLC -# -# All Rights Reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of version 2 of the GNU General Public License as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, contact SUSE LLC. -# -# To contact SUSE LLC about this file by physical or electronic mail, you may -# find current contact information at www.suse.com. - -require_relative "../../../test_helper" -require "installation/console/plugins/repositories_button" - -require "cwm/rspec" - -describe Installation::Console::Plugins::RepositoriesButton do - before do - allow(Yast::WFM).to receive(:call) - end - - include_examples "CWM::PushButton" -end - -describe Installation::Console::Plugins::RepositoriesButtonPlugin do - context "#widget" do - it "returns a CWM widget" do - w = subject.widget - expect(w).to be_a(CWM::AbstractWidget) - end - end -end From 0b5b634c5aa1b08c5b2d006fabb665456c7dbbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 18 Mar 2021 18:18:23 +0100 Subject: [PATCH 3/4] Changes, 4.3.20 --- package/yast2-packager.changes | 12 ++++++++++++ package/yast2-packager.spec | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package/yast2-packager.changes b/package/yast2-packager.changes index 6230c303..332b4716 100644 --- a/package/yast2-packager.changes +++ b/package/yast2-packager.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Mar 18 16:33:19 UTC 2021 - Ladislav Slezák + +- Do not create zypp cache symlink when running in installed + system, it would create /var/cache/zypp -> /var/cache/zypp + loop (bsc#1183683) +- Remove the "Software Repositories" button from the YaST console, + users can easily break the installer with it. Added + "configure_repositories" command to the command line interface + for experts (bsc#1183687) +- 4.3.20 + ------------------------------------------------------------------- Thu Mar 11 15:01:58 UTC 2021 - Ladislav Slezák diff --git a/package/yast2-packager.spec b/package/yast2-packager.spec index 46870126..ae165e30 100644 --- a/package/yast2-packager.spec +++ b/package/yast2-packager.spec @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.3.19 +Version: 4.3.20 Release: 0 Summary: YaST2 - Package Library License: GPL-2.0-or-later From ca7e906908cdfab545cbf29acda90a8ab485ea1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 19 Mar 2021 13:58:09 +0100 Subject: [PATCH 4/4] Code review fix --- src/clients/inst_kickoff.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/clients/inst_kickoff.rb b/src/clients/inst_kickoff.rb index 40b95439..b362e782 100644 --- a/src/clients/inst_kickoff.rb +++ b/src/clients/inst_kickoff.rb @@ -46,18 +46,7 @@ def main ) end - # copy the zypp cache to the target system (only when running in inst-sys!) - if Stage.initial - # copy the credential files (libzypp loads them from target) - # and the repository cache to the target system - Pkg.SourceCacheCopyTo(Installation.destdir) - - # symlink the cache from inst-sys to save same space (RAM!) - cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" - log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") - ::FileUtils.rm_rf(cache_path) - File.symlink(File.join(Installation.destdir, cache_path), cache_path) - end + copy_zypp_cache # installation, for instance... if !Mode.update @@ -142,6 +131,21 @@ def main :next end + # copy the zypp cache to the target system (only when running in inst-sys!) + def copy_zypp_cache + return unless Stage.initial + + # copy the credential files (libzypp loads them from target) + # and the repository cache to the target system + Pkg.SourceCacheCopyTo(Installation.destdir) + + # symlink the cache from inst-sys to save same space (RAM!) + cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" + log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") + ::FileUtils.rm_rf(cache_path) + File.symlink(File.join(Installation.destdir, cache_path), cache_path) + end + # Handle the backup. def backup_stuff if Installation.update_backup_modified