From 04257a02d4136269b79b73647b2cbf791aed6978 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Sun, 20 Oct 2024 09:20:14 -0400 Subject: [PATCH] Fix failed to rename archive file --- .../001-fix-failed-to-rename-query-rust.patch | 46 +++++++++++++++++++ gvsbuild/projects/librsvg.py | 5 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch diff --git a/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch b/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch new file mode 100644 index 000000000..ab96c6a14 --- /dev/null +++ b/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch @@ -0,0 +1,46 @@ +diff --git a/meson/query-rustc.py b/meson/query-rustc.py +index 2b169b1fc5ad7dff2dfec1d62214ee4cb1fce0de..f97cb692d1a080a730be8953c60e52ffc9a71b91 100755 +--- a/meson/query-rustc.py ++++ b/meson/query-rustc.py +@@ -64,7 +64,6 @@ def retrive_version_info(output, query): + + if __name__ == "__main__": + args = parser.parse_args() +- dummy_out = tempfile.NamedTemporaryFile() + query = args.query + query_arg = None + rustc_cmd = [Path(args.RUSTC).as_posix()] +@@ -85,17 +84,23 @@ if __name__ == "__main__": + if args.target: + rustc_cmd.extend(['--target', args.target]) + +- # We need these for '--print=native-static-libs' on Windows +- if query == 'native-static-libs': +- rustc_cmd.extend(['--crate-type', 'staticlib']) +- rustc_cmd.append(os.devnull) +- rustc_cmd.extend(['-o', dummy_out.name]) ++ fd, dummy_out = tempfile.mkstemp() ++ os.close(fd) ++ try: ++ # We need these for '--print=native-static-libs' on Windows ++ if query == 'native-static-libs': ++ rustc_cmd.extend(['--crate-type', 'staticlib']) ++ rustc_cmd.append(os.devnull) ++ rustc_cmd.extend(['-o', dummy_out]) ++ ++ query_results = subprocess.run( ++ rustc_cmd, ++ capture_output=True, ++ text=True, ++ ) ++ finally: ++ os.unlink(dummy_out) + +- query_results = subprocess.run( +- rustc_cmd, +- capture_output=True, +- text=True, +- ) + if query == 'native-static-libs': + retrieve_native_static_libs_from_output(query_results.stderr) + elif query == 'default-host-toolchain' or query == 'stable-actual-version': diff --git a/gvsbuild/projects/librsvg.py b/gvsbuild/projects/librsvg.py index 3a90cc264..0a12b1edf 100644 --- a/gvsbuild/projects/librsvg.py +++ b/gvsbuild/projects/librsvg.py @@ -36,7 +36,10 @@ def __init__(self): "libxml2", "freetype", ], - patches=[], + patches=[ + # https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/1040 + "001-fix-failed-to-rename-query-rust.patch", + ], ) if self.opts.enable_gi: