diff --git a/Don-t-run-installation-tasks-of-add-ons-in-a-meta-ta.patch b/Don-t-run-installation-tasks-of-add-ons-in-a-meta-ta.patch new file mode 100644 index 0000000000000000000000000000000000000000..fe93cddfbd07307a05f8b36bec5c2d722565c8a2 --- /dev/null +++ b/Don-t-run-installation-tasks-of-add-ons-in-a-meta-ta.patch @@ -0,0 +1,44 @@ +From 2bab62255d81a85e3c2c3fa4a4fd27c4f476ce97 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 11 Feb 2021 10:39:00 +0800 +Subject: [PATCH] Don't run installation tasks of add-ons in a meta task +The UI should be able to handle a failure of an installation task and possibly +continue with the installation if the user allows it. That is not possible if +we run all installation tasks in one meta task. + +--- + initial_setup/__init__.py | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/initial_setup/__init__.py b/initial_setup/__init__.py +index 5273a91..9e5e429 100644 +--- a/initial_setup/__init__.py ++++ b/initial_setup/__init__.py +@@ -8,8 +8,11 @@ import logging + import argparse + import traceback + import atexit ++ + from initial_setup.product import eula_available + from initial_setup import initial_setup_log ++ ++from pyanaconda.core.dbus import DBus + from pyanaconda.localization import setup_locale_environment, setup_locale + from pyanaconda.core.constants import FIRSTBOOT_ENVIRON, SETUP_ON_BOOT_RECONFIG, \ + SETUP_ON_BOOT_DEFAULT +@@ -331,9 +334,9 @@ class InitialSetup(object): + log.info("executing addons") + + boss_proxy = BOSS.get_proxy() +- task_path = boss_proxy.InstallSystemWithTask() +- task_proxy = BOSS.get_proxy(task_path) +- sync_run_task(task_proxy) ++ for service_name, object_path in boss_proxy.CollectInstallSystemTasks(): ++ task_proxy = DBus.get_proxy(service_name, object_path) ++ sync_run_task(task_proxy) + + if self.external_reconfig: + # prevent the reconfig flag from being written out +-- +2.33.0 + diff --git a/Make-sure-the-output-from-custom_getpass-is-serializ.patch b/Make-sure-the-output-from-custom_getpass-is-serializ.patch new file mode 100644 index 0000000000000000000000000000000000000000..114cbf94c035d4a46765fc5eda68f49c5f83e6dd --- /dev/null +++ b/Make-sure-the-output-from-custom_getpass-is-serializ.patch @@ -0,0 +1,193 @@ +From 0634c145af32d17e2e272a30fba4c5421c23761f Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Sat, 8 Aug 2020 23:10:59 +0200 +Subject: [PATCH 060/116] Make sure the output from custom_getpass() is + serialized after stdout + +custom_getpass() writes the prompt to the file descriptor of the console where +the last input came from. At the same time, run() races with it, piping the +sys.stdout data to the same file descriptor (and others). + +To make matters worse, the stdout data is buffered and with nobody flushing it +always loses the race, with important stuff being written out only after +custom_getpass() returns and somebody cares to flush it out: + + Password: + Password (confirm): + Password: + Password (confirm): + ================================================================================ + ================================================================================ + Root password + + Please select new root password. You will have to type it twice. + + The passwords you entered were different. Please try again. + ================================================================================ + ================================================================================ + Root password + + Please select new root password. You will have to type it twice. + + The password is too short + +This patch turns on line buffering, removing the necessity of explicit flushes +from the stdout writer side. + +That alone wouldn't be sufficient because the stdout traffic could still be +delayed until the piper thread is awoken; though things wouldn't be mixed up +nearly as severely. To cope with this race the active console traffic is piped +to the piper thread as well and it is now responsible for ordering things. + +It is still ugly but hey. +--- + initial_setup/tui/tui.py | 90 ++++++++++++++++++++++++++-------------- + 1 file changed, 59 insertions(+), 31 deletions(-) + +diff --git a/initial_setup/tui/tui.py b/initial_setup/tui/tui.py +index 47f876d..347053e 100644 +--- a/initial_setup/tui/tui.py ++++ b/initial_setup/tui/tui.py +@@ -34,9 +34,14 @@ class MultipleTTYHandler(object): + self._tui_stdin_fd = tui_stdin_fd + self._tui_stdin = os.fdopen(tui_stdin_fd, "w") + ++ self._tui_active_out_fd, active_out_fd = os.pipe() ++ self._tui_active_out = os.fdopen(self._tui_active_out_fd, "r") ++ self._active_out = os.fdopen(active_out_fd, "w") ++ + self._shutdown = False + +- self._active_console = None ++ self._active_console_in = None ++ self._active_console_out = None + + self._console_read_fos = {} + self._console_write_fos = [] +@@ -82,6 +87,7 @@ class MultipleTTYHandler(object): + fds = list(self._console_read_fos.keys()) + # as well as from the anaconda stdout + fds.append(self._tui_stdout_fd) ++ fds.append(self._tui_active_out_fd) + log.info("multi TTY handler starting") + while True: + # Watch the consoles and IS TUI stdout for data and +@@ -93,41 +99,58 @@ class MultipleTTYHandler(object): + if self._shutdown: + log.info("multi TTY handler shutting down") + break +- for fd in rlist: +- if fd == self._tui_stdout_fd: +- # We need to set the TUI stdout fd to non-blocking, +- # as otherwise reading from it would (predictably) result in +- # the readline() function blocking once it runs out of data. +- os.set_blocking(fd, False) +- +- # The IS TUI wants to write something, +- # read all the lines. +- lines = self._tui_stdout.readlines() +- +- # After we finish reading all the data we need to set +- # the TUI stdout fd to blocking again. +- # Otherwise the fd will not be usable when we try to read from +- # it again for unclear reasons. +- os.set_blocking(fd, True) +- +- lines.append("\n") # seems to get lost somewhere on the way +- +- # Write all the lines IS wrote to stdout to all consoles +- # that we consider usable for the IS TUI. +- for console_fo in self._console_write_fos.values(): +- for one_line in lines: +- try: +- console_fo.write(one_line) +- except OSError: +- log.exception("failed to write %s to console %s", one_line, console_fo) +- else: ++ if self._tui_stdout_fd in rlist: ++ # We need to set the TUI stdout fd to non-blocking, ++ # as otherwise reading from it would (predictably) result in ++ # the readline() function blocking once it runs out of data. ++ os.set_blocking(self._tui_stdout_fd, False) ++ ++ # The IS TUI wants to write something, ++ # read all the lines. ++ lines = self._tui_stdout.readlines() ++ ++ # After we finish reading all the data we need to set ++ # the TUI stdout fd to blocking again. ++ # Otherwise the fd will not be usable when we try to read from ++ # it again for unclear reasons. ++ os.set_blocking(self._tui_stdout_fd, True) ++ ++ lines.append("\n") # seems to get lost somewhere on the way ++ ++ # Write all the lines IS wrote to stdout to all consoles ++ # that we consider usable for the IS TUI. ++ for console_fo in self._console_write_fos.values(): ++ for one_line in lines: ++ try: ++ console_fo.write(one_line) ++ except OSError: ++ log.exception("failed to write %s to console %s", one_line, console_fo) ++ ++ # Don't go processing the events on other file descriptors until ++ # we're done with everything that's supposed to be on stdout ++ continue ++ elif self._tui_active_out_fd in rlist: ++ # Essentially the same as above but for the acrive console only ++ os.set_blocking(self._tui_active_out_fd, False) ++ lines = self._tui_active_out.readlines() ++ os.set_blocking(self._tui_active_out_fd, True) ++ write_fo = self._active_console_out ++ try: ++ for one_line in lines: ++ write_fo.write(one_line) ++ write_fo.flush() ++ except OSError: ++ log.exception("failed to write %s to active console", lines) ++ else: ++ for fd in rlist: + # Someone typed some input to a console and hit enter, + # forward the input to the IS TUI stdin. + read_fo = self._console_read_fos[fd] + write_fo = self._console_write_fos[fd] + # as the console is getting input we consider it to be + # the currently active console +- self._active_console = read_fo, write_fo ++ self._active_console_in = read_fo ++ self._active_console_out = write_fo + try: + data = read_fo.readline() + except TypeError: +@@ -148,7 +171,10 @@ class MultipleTTYHandler(object): + + Always restores terminal settings before returning. + """ +- input_fo, output_fo = self._active_console ++ ++ input_fo = self._active_console_in ++ output_fo = self._active_out ++ + passwd = None + with contextlib.ExitStack() as stack: + input_fd = input_fo.fileno() +@@ -179,6 +205,7 @@ class MultipleTTYHandler(object): + passwd = self._fallback_getpass(prompt, output_fo, input_fo) + + output_fo.write('\n') ++ output_fo.flush() + return passwd + + def _fallback_getpass(self, prompt='Password: ', output_fo=None, input_fo=None): +@@ -239,6 +266,7 @@ class InitialSetupTextUserInterface(TextUserInterface): + # stdout + tui_stdout_fd, stdout_fd = os.pipe() + sys.stdout = os.fdopen(stdout_fd, "w") ++ sys.stdout.reconfigure(line_buffering=True) + + # instantiate and start the multi TTY handler + self.multi_tty_handler = MultipleTTYHandler(tui_stdin_fd=tui_stdin_fd, tui_stdout_fd=tui_stdout_fd) +-- +2.38.1.windows.1 + diff --git a/Remove-deprecated-support-for-add-ons.patch b/Remove-deprecated-support-for-add-ons.patch new file mode 100644 index 0000000000000000000000000000000000000000..b69b9d3d67b2f4600c4fee365e164229513f380e --- /dev/null +++ b/Remove-deprecated-support-for-add-ons.patch @@ -0,0 +1,50 @@ +From 6995fc0923d61bd4d42380a34aefc17e4e94f13a Mon Sep 17 00:00:00 2001 +From: wang--ge +Date: Tue, 30 May 2023 09:34:35 +0800 +Subject: [PATCH] Remove deprecated support for add-ons + +--- + initial_setup/__init__.py | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/initial_setup/__init__.py b/initial_setup/__init__.py +index a418cbe..5273a91 100644 +--- a/initial_setup/__init__.py ++++ b/initial_setup/__init__.py +@@ -125,14 +125,14 @@ class InitialSetup(object): + gi.overrides.__path__.insert(0, p) + log.debug("GI overrides imported") + +- from pyanaconda.addons import collect_addon_paths ++ from pyanaconda.ui.lib.addons import collect_addon_ui_paths + + addon_paths = ["/usr/share/initial-setup/modules", "/usr/share/anaconda/addons"] + + # append ADDON_PATHS dirs at the end + sys.path.extend(addon_paths) + +- self._addon_module_paths = collect_addon_paths(addon_paths, self.gui_mode_id) ++ self._addon_module_paths = collect_addon_ui_paths(addon_paths, self.gui_mode_id) + log.info("found %d addon modules:", len(self._addon_module_paths)) + for addon_path in self._addon_module_paths: + log.debug(addon_path) +@@ -202,7 +202,7 @@ class InitialSetup(object): + commandMap = dict((k, kickstart.commandMap[k]) for k in SUPPORTED_KICKSTART_COMMANDS) + + # Prepare new data object +- self.data = kickstart.AnacondaKSHandler(self._addon_module_paths["ks"], commandUpdates=commandMap) ++ self.data = kickstart.AnacondaKSHandler(commandUpdates=commandMap) + + kickstart_path = INPUT_KICKSTART_PATH + if os.path.exists(OUTPUT_KICKSTART_PATH): +@@ -329,7 +329,6 @@ class InitialSetup(object): + + # Configure all addons + log.info("executing addons") +- self.data.addons.execute(storage=None, ksdata=self.data, users=None, payload=None) + + boss_proxy = BOSS.get_proxy() + task_path = boss_proxy.InstallSystemWithTask() +-- +2.33.0 + diff --git a/initial-setup.spec b/initial-setup.spec index 8f8307bff2939b3cc13e73f1a266cdbf41517307..40e12c4330d9e1cc50a5fd2ddc289cd438554e14 100644 --- a/initial-setup.spec +++ b/initial-setup.spec @@ -1,6 +1,6 @@ Name: initial-setup Version: 0.3.83 -Release: 4 +Release: 7 Summary: Initialize system configuration for a newly installed computer License: GPLv2+ URL: https://github.com/rhinstaller/initial-setup @@ -9,7 +9,9 @@ Patch0001: Drop-python-nose-from-the-dependencies.patch Patch9001: initial-setup-add-support-openeuler.patch Patch9002: Adapt-to-category-title-translation-fix-in-Anaconda.patch Patch9003: Add-Packit-support-for-initial-setup.patch - +Patch9004: Remove-deprecated-support-for-add-ons.patch +Patch9005: Don-t-run-installation-tasks-of-add-ons-in-a-meta-ta.patch +Patch9006: Make-sure-the-output-from-custom_getpass-is-serializ.patch %define debug_package %{nil} @@ -67,9 +69,21 @@ rm -rf %{buildroot} %changelog -* Mon Jun 12 2023 chenchen - 0.3.83-4 +* Thu Jul 27 2023 shechenglong - 0.3.83-7 +- Make sure the output from custom_getpass() is serialized after stdout + +* Thu Jun 15 2023 yueyuankun - 0.3.83-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Don't run installation tasks of add-ons in a meta task + +* Mon Jun 12 2023 chenchen - 0.3.83-5 - Remove old failing pre scriptlet +* Tue May 30 2023 Ge Wang - 0.3.83-4 +- Remove deprecated support for add-ons + * Fri Dec 30 2022 xulei - 0.3.83-3 - Add Packit support for initial-setup