From abc4f81b165ad9d2ddd8aa13a81fba38279da011 Mon Sep 17 00:00:00 2001 From: Yann Dupont Date: Mon, 23 May 2022 11:11:48 +0200 Subject: [PATCH] missing patches --- .../patches/qemu-build-info-manual.patch | 101 ++++++++++++++++++ .../patches/qemu-fix-agent-paths.patch | 66 ++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 glicid/packages/patches/qemu-build-info-manual.patch create mode 100644 glicid/packages/patches/qemu-fix-agent-paths.patch diff --git a/glicid/packages/patches/qemu-build-info-manual.patch b/glicid/packages/patches/qemu-build-info-manual.patch new file mode 100644 index 0000000..945c48a --- /dev/null +++ b/glicid/packages/patches/qemu-build-info-manual.patch @@ -0,0 +1,101 @@ +From 2793f47c066ed396b38893c10533202fceb1a05f Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer +Date: Thu, 17 Sep 2020 13:28:19 -0400 +Subject: [PATCH] build: Build and install a Texinfo version of the manual. + +Take advantage of the Sphinx texinfo backend to generate a QEMU info +manual. The Texinfo format allows for more structure and info readers +provide more advanced navigation capabilities compared to manpages +readers. + +* configure (infodir): Add an --infodir option, which allows +configuring the directory under which the info manuals are installed. +* docs/meson.build (texi, info): New targets. + +Signed-off-by: Maxim Cournoyer + +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -951,6 +951,8 @@ for opt do + static="yes" + QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" + ;; ++ --infodir=*) infodir="$optarg" ++ ;; + --mandir=*) mandir="$optarg" + ;; + --bindir=*) bindir="$optarg" +@@ -978,7 +980,7 @@ for opt do + --host=*|--build=*|\ + --disable-dependency-tracking|\ + --sbindir=*|--sharedstatedir=*|\ +- --oldincludedir=*|--datarootdir=*|--infodir=*|\ ++ --oldincludedir=*|--datarootdir=*|\ + --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) + # These switches are silently ignored, for compatibility with + # autoconf-generated configure scripts. This allows QEMU's +@@ -1599,6 +1601,7 @@ else + fi + mandir="${mandir:-$prefix/share/man}" + datadir="${datadir:-$prefix/share}" ++infodir="${infodir:-$datadir/info}" + docdir="${docdir:-$prefix/share/doc}" + sysconfdir="${sysconfdir:-$prefix/etc}" + local_statedir="${local_statedir:-$prefix/var}" +@@ -1736,6 +1739,7 @@ Advanced options (experts only): + --with-git-submodules=validate fail if git submodules are not up to date + --with-git-submodules=ignore do not update or check git submodules (default if no .git dir) + --static enable static build [$static] ++ --infodir=PATH install info manual in PATH + --mandir=PATH install man pages in PATH + --datadir=PATH install firmware in PATH/$qemu_suffix + --localedir=PATH install translation in PATH/$qemu_suffix +diff --git a/docs/meson.build b/docs/meson.build +--- a/docs/meson.build ++++ b/docs/meson.build +@@ -104,4 +104,25 @@ if build_docs + alias_target('sphinxdocs', sphinxdocs) + alias_target('html', sphinxdocs) + alias_target('man', sphinxmans) ++ ++ # Generate a Texinfo version of the QEMU manual. ++ makeinfo = find_program(['texi2any', 'makeinfo']) ++ if makeinfo.found() ++ sphinxtexi = custom_target( ++ 'QEMU manual generated texinfo source', ++ output: ['QEMU.texi', 'sphinxtexi.stamp'], ++ depfile: 'sphinxtexi.d', ++ command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@', ++ '-Ddepfile_stamp=@OUTPUT1@', '-b', 'texinfo', ++ meson.current_source_dir(), meson.current_build_dir()]) ++ sphinxinfo = custom_target( ++ 'QEMU info manual', ++ input: sphinxtexi, ++ output: 'QEMU.info', ++ install: true, ++ install_dir: get_option('infodir'), ++ command: [makeinfo, '--no-split', '@INPUT0@', '--output=@OUTPUT@']) ++ alias_target('texi', sphinxtexi) ++ alias_target('info', sphinxinfo) ++ endif + endif +diff --git a/meson.build b/meson.build +--- a/meson.build ++++ b/meson.build +@@ -35,6 +35,7 @@ endif + qemu_confdir = get_option('sysconfdir') / get_option('qemu_suffix') + qemu_datadir = get_option('datadir') / get_option('qemu_suffix') + qemu_docdir = get_option('docdir') / get_option('qemu_suffix') ++qemu_infodir = get_option('infodir') / get_option('qemu_suffix') + qemu_moddir = get_option('libdir') / get_option('qemu_suffix') + + qemu_desktopdir = get_option('datadir') / 'applications' +@@ -2433,6 +2434,7 @@ else + summary_info += {'local state directory': 'queried at runtime'} + endif + summary_info += {'Doc directory': get_option('docdir')} ++summary_info += {'Info directory': get_option('infodir')} + summary_info += {'Build directory': meson.current_build_dir()} + summary_info += {'Source path': meson.current_source_dir()} + summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']} diff --git a/glicid/packages/patches/qemu-fix-agent-paths.patch b/glicid/packages/patches/qemu-fix-agent-paths.patch new file mode 100644 index 0000000..bae62fa --- /dev/null +++ b/glicid/packages/patches/qemu-fix-agent-paths.patch @@ -0,0 +1,66 @@ +Allow a QEMU host to set the time and shutdown Guix guests. Styled +after the patch from the Nix package: + +https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch + +diff --git a/qga/commands-posix.c b/qga/commands-posix.c +index 75dbaab..b416b03 100644 +--- a/qga/commands-posix.c ++++ b/qga/commands-posix.c +@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) + void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) + { + const char *shutdown_flag; ++ const char *command; + Error *local_err = NULL; + pid_t pid; + int status; +@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) + slog("guest-shutdown called, mode: %s", mode); + if (!has_mode || strcmp(mode, "powerdown") == 0) { + shutdown_flag = "-P"; ++ command = "shutdown"; + } else if (strcmp(mode, "halt") == 0) { + shutdown_flag = "-H"; ++ command = "halt"; + } else if (strcmp(mode, "reboot") == 0) { + shutdown_flag = "-r"; ++ command = "reboot"; + } else { + error_setg(errp, + "mode is invalid (valid values are: halt|powerdown|reboot"); +@@ -109,6 +113,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) + reopen_fd_to_null(1); + reopen_fd_to_null(2); + ++ /* try Guix’s shutdown/halt/reboot first */ ++ char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command); ++ execle(path, command, (char *)NULL, environ); ++ g_free(path); ++ + execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + "hypervisor initiated shutdown", (char *)NULL, environ); + _exit(EXIT_FAILURE); +@@ -158,10 +167,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) + Error *local_err = NULL; + struct timeval tv; + static const char hwclock_path[] = "/sbin/hwclock"; ++ static const char hwclock_path_guix[] = "/run/current-system/profile/sbin/hwclock"; + static int hwclock_available = -1; + + if (hwclock_available < 0) { +- hwclock_available = (access(hwclock_path, X_OK) == 0); ++ hwclock_available = (access(hwclock_path_guix, X_OK) == 0) || ++ (access(hwclock_path, X_OK) == 0); + } + + if (!hwclock_available) { +@@ -207,6 +218,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) + + /* Use '/sbin/hwclock -w' to set RTC from the system time, + * or '/sbin/hwclock -s' to set the system time from RTC. */ ++ execle(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s", ++ NULL, environ); + execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", + NULL, environ); + _exit(EXIT_FAILURE);