From a6bc7baa5430f2388ea6a134146908e830ef3a21 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 23 Jun 2022 19:22:23 +0200 Subject: gnu: freeglut: Update to 3.2.2. * gnu/packages/gl.scm (freeglut): Update to 3.2.2. [source](uri): Switch to new primary download location. [source](patches): Remove. * gnu/packages/patches/freeglut-gcc-compat.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. --- gnu/packages/patches/freeglut-gcc-compat.patch | 53 -------------------------- 1 file changed, 53 deletions(-) delete mode 100644 gnu/packages/patches/freeglut-gcc-compat.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/freeglut-gcc-compat.patch b/gnu/packages/patches/freeglut-gcc-compat.patch deleted file mode 100644 index 126bbd89f4..0000000000 --- a/gnu/packages/patches/freeglut-gcc-compat.patch +++ /dev/null @@ -1,53 +0,0 @@ -Fix build failure with GCC 10. - -Taken from upstream: -https://github.com/dcnieho/FreeGLUT/commit/b9998bbc1e1c329f6bf69c24606a2be7a4973b8c - -diff --git a/src/fg_gl2.c b/src/fg_gl2.c ---- a/src/fg_gl2.c -+++ b/src/fg_gl2.c -@@ -27,6 +27,20 @@ - #include "fg_internal.h" - #include "fg_gl2.h" - -+#ifndef GL_ES_VERSION_2_0 -+/* GLES2 has the corresponding entry points built-in, and these fgh-prefixed -+ * names are defined in fg_gl2.h header to reference them, for any other case, -+ * define them as function pointers here. -+ */ -+FGH_PFNGLGENBUFFERSPROC fghGenBuffers; -+FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; -+FGH_PFNGLBINDBUFFERPROC fghBindBuffer; -+FGH_PFNGLBUFFERDATAPROC fghBufferData; -+FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; -+FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; -+FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; -+#endif -+ - void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) { - if (fgStructure.CurrentWindow != NULL) - fgStructure.CurrentWindow->Window.attribute_v_coord = attrib; -diff --git a/src/fg_gl2.h b/src/fg_gl2.h ---- a/src/fg_gl2.h -+++ b/src/fg_gl2.h -@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); - typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); - typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - --FGH_PFNGLGENBUFFERSPROC fghGenBuffers; --FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; --FGH_PFNGLBINDBUFFERPROC fghBindBuffer; --FGH_PFNGLBUFFERDATAPROC fghBufferData; --FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; --FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; --FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; -+extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers; -+extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; -+extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer; -+extern FGH_PFNGLBUFFERDATAPROC fghBufferData; -+extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; -+extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; -+extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; - - # endif - -- cgit v1.2.3 From 66e3adcad8cb07962d75e89d562057ded9946348 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Fri, 24 Jun 2022 00:07:32 +0200 Subject: gnu: Remove unused patch. This is a follow-up to commit fce910af555b72d02ba868885571b2fdc38b2d5f. * gnu/packages/patches/postgresql-riscv-spinlocks.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. --- gnu/local.mk | 1 - .../patches/postgresql-riscv-spinlocks.patch | 41 ---------------------- 2 files changed, 42 deletions(-) delete mode 100644 gnu/packages/patches/postgresql-riscv-spinlocks.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 4e19b64f6e..f8ccbd34ec 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1646,7 +1646,6 @@ dist_patch_DATA = \ %D%/packages/patches/portaudio-audacity-compat.patch \ %D%/packages/patches/portmidi-modular-build.patch \ %D%/packages/patches/postgresql-disable-resolve_symlinks.patch \ - %D%/packages/patches/postgresql-riscv-spinlocks.patch \ %D%/packages/patches/procmail-ambiguous-getline-debian.patch \ %D%/packages/patches/procmail-CVE-2014-3618.patch \ %D%/packages/patches/procmail-CVE-2017-16844.patch \ diff --git a/gnu/packages/patches/postgresql-riscv-spinlocks.patch b/gnu/packages/patches/postgresql-riscv-spinlocks.patch deleted file mode 100644 index 984a573642..0000000000 --- a/gnu/packages/patches/postgresql-riscv-spinlocks.patch +++ /dev/null @@ -1,41 +0,0 @@ -https://www.postgresql.org/message-id/dea97b6d-f55f-1f6d-9109-504aa7dfa421@gentoo.org - -The attached patch adds native spinlock support to PostgreSQL on RISC-V -systems. As suspected by Richard W.M. Jones of Red Hat back in 2016, the -__sync_lock_test_and_set() approach applied on arm and arm64 works here -as well. - - -Tested against PostgreSQL 13.3 on a physical rv64gc system (BeagleV -Starlight beta board) - builds and installs fine, all tests pass. From -what I can see in gcc documentation this should in theory work on rv32 -(and possibly rv128) as well, therefore the patch as it stands covers -all RISC-V systems (i.e. doesn't check the value of __risc_xlen) - but I -haven't confirmed this experimentally. - ---- a/src/include/storage/s_lock.h -+++ b/src/include/storage/s_lock.h -@@ -315,12 +315,12 @@ - #endif /* __ia64__ || __ia64 */ - - /* -- * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. -+ * On ARM, ARM64 and RISC-V, we use __sync_lock_test_and_set(int *, int) if available. - * - * We use the int-width variant of the builtin because it works on more chips - * than other widths. - */ --#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) -+#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__riscv) - #ifdef HAVE_GCC__SYNC_INT32_TAS - #define HAS_TEST_AND_SET - -@@ -337,7 +337,7 @@ - #define S_UNLOCK(lock) __sync_lock_release(lock) - - #endif /* HAVE_GCC__SYNC_INT32_TAS */ --#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ -+#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */ - - - /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ -- cgit v1.2.3 From 5cf9a03b7a86de9b7cc696fe4e45a650a4196b99 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 5 Jul 2022 10:26:03 +0300 Subject: gnu: rust: Bootstrap with rust-1.54.0. * gnu/packages/rust.scm (rust-1.39): Rename to rust-bootstrap. Update to 1.54.0. [source]: Update snippet to new version. Replace mrustc patch for 1.39.0 with patch for 1.54.0. [inputs]: Remove libssh2. Replace llvm-9 with llvm. Add gcc-9. [arguments]: Adjust custom 'setup-mrustc-sources to also create file with rust version. Adjust custom 'patch-makefiles phase to changes in mrustc's build steps. Adjust custom 'build phase to follow mrustc's build steps for rust-1.54. (rust-1.40): Replace post-bootstrapped rust-1.40 with 1.55. [arguments]: Add custom 'set-linker-locale-to-utf8 phase. Adjust custom 'build phase. Remove custom 'neuter-tidy phase. [inputs]: Replace llvm-9 with llvm. (rust-1.41, rust-1.42, rust-1.43, rust-1.44, rust-1.45, rust-1.46, rust-1.47, rust-1.48, rust-1.49, rust-1.50, rust-1.51, rust-1.52, rust-1.53): Remove variables. * gnu/packages/patches/rust-1.39.0-src.patch: Remove file. * gnu/packages/patches/rust-1.54.0-src.patch: Add file. * gnu/local.mk (dist_patch_DATA): Register changes. --- gnu/local.mk | 2 +- gnu/packages/patches/rustc-1.39.0-src.patch | 99 ------------ gnu/packages/patches/rustc-1.54.0-src.patch | 117 ++++++++++++++ gnu/packages/rust.scm | 238 ++++++++-------------------- 4 files changed, 182 insertions(+), 274 deletions(-) delete mode 100644 gnu/packages/patches/rustc-1.39.0-src.patch create mode 100644 gnu/packages/patches/rustc-1.54.0-src.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index f8ccbd34ec..be6d37fc26 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1769,7 +1769,7 @@ dist_patch_DATA = \ %D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \ %D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \ %D%/packages/patches/ruby-sanitize-system-libxml.patch \ - %D%/packages/patches/rustc-1.39.0-src.patch \ + %D%/packages/patches/rustc-1.54.0-src.patch \ %D%/packages/patches/rust-adblock-ignore-live-tests.patch \ %D%/packages/patches/i3status-rust-enable-unstable-features.patch \ %D%/packages/patches/rust-ndarray-remove-blas-src-dep.patch \ diff --git a/gnu/packages/patches/rustc-1.39.0-src.patch b/gnu/packages/patches/rustc-1.39.0-src.patch deleted file mode 100644 index 7859bd44d5..0000000000 --- a/gnu/packages/patches/rustc-1.39.0-src.patch +++ /dev/null @@ -1,99 +0,0 @@ -# This modified patch is to disable the hunk applying to LLVM, unbundled in Guix. - -# Add mrustc slice length intrinsics ---- src/libcore/intrinsics.rs -+++ src/libcore/intrinsics.rs -@@ -685,4 +685,8 @@ - pub fn min_align_of_val(_: &T) -> usize; - -+ /// Obtain the length of a slice pointer -+ #[cfg(rust_compiler="mrustc")] -+ pub fn mrustc_slice_len(pointer: *const [T]) -> usize; -+ - /// Gets a static string slice containing the name of a type. - pub fn type_name() -> &'static str; - ---- src/libcore/slice/mod.rs -+++ src/libcore/slice/mod.rs -@@ -68,5 +68,8 @@ - pub const fn len(&self) -> usize { -- unsafe { -- crate::ptr::Repr { rust: self }.raw.len -- } -+ #[cfg(not(rust_compiler="mrustc"))] -+ #[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_union))] -+ const fn len_inner(s: &[T]) -> usize { unsafe { crate::ptr::Repr { rust: s }.raw.len } }; -+ #[cfg(rust_compiler="mrustc")] -+ const fn len_inner(s: &[T]) -> usize { unsafe { crate::intrinsics::mrustc_slice_len(s) } } -+ len_inner(self) - } -# -# Static-link rustc_codegen_llvm so the generated rustc is standalone -# > Note: Interacts with `rustc-1.39.0-overrides.toml` -# ---- src/librustc_interface/util.rs -+++ src/librustc_interface/util.rs -@@ -421,2 +421,4 @@ - pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { -+ #[cfg(rust_compiler="mrustc")] -+ { if(backend_name == "llvm") { extern "Rust" { fn __rustc_codegen_backend() -> Box; } return || unsafe { __rustc_codegen_backend() } } } - // For now we only allow this function to be called once as it'll dlopen a -# Disable most architecture intrinsics ---- src/stdarch/crates/std_detect/src/detect/mod.rs -+++ src/stdarch/crates/std_detect/src/detect/mod.rs -@@ -74,4 +74,7 @@ - // this run-time detection logic is never called. - #[path = "os/other.rs"] - mod os; -+ } else if #[cfg(rust_compiler="mrustc")] { -+ #[path = "os/other.rs"] -+ mod os; - } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { ---- vendor/ppv-lite86/src/lib.rs -+++ vendor/ppv-lite86/src/lib.rs -@@ -12,10 +12,10 @@ --#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] -+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))] - pub mod x86_64; --#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] -+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))] - use self::x86_64 as arch; - --#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] -+#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))] - pub mod generic; --#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] -+#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))] - use self::generic as arch; - -# diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h -# index da9d9d5bfdc0..3d47471f0ef0 100644 -# --- src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h -# +++ src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h -# @@ -16,6 +16,8 @@ -# #include "llvm/Demangle/DemangleConfig.h" -# #include "llvm/Demangle/StringView.h" -# #include -# +#include -# +#include - -# namespace llvm { -# namespace itanium_demangle { -## -## gcc (used by mrustc) has 16-byte uint128_t alignment, while rustc uses 8 -## -#--- src/libsyntax/ast.rs -#+++ src/libsyntax/ast.rs -#@@ -986,2 +986,2 @@ -#-#[cfg(target_arch = "x86_64")] -#-static_assert_size!(Expr, 96); -#+//#[cfg(target_arch = "x86_64")] -#+//static_assert_size!(Expr, 96); -#--- src/librustc/ty/sty.rs -#+++ src/librustc/ty/sty.rs -#@@ -2258,2 +2258,2 @@ -#-#[cfg(target_arch = "x86_64")] -#-static_assert_size!(Const<'_>, 40); -#+//#[cfg(target_arch = "x86_64")] -#+//static_assert_size!(Const<'_>, 40); - diff --git a/gnu/packages/patches/rustc-1.54.0-src.patch b/gnu/packages/patches/rustc-1.54.0-src.patch new file mode 100644 index 0000000000..d075dce39b --- /dev/null +++ b/gnu/packages/patches/rustc-1.54.0-src.patch @@ -0,0 +1,117 @@ +# mrustc is much better at enum packing, so causes almost all of these to be smaller by one pointer +--- compiler/rustc_ast/src/ast.rs ++++ compiler/rustc_ast/src/ast.rs +@@ -1075,7 +1075,7 @@ pub struct Expr { + } + + // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger. +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Expr, 104); + + impl Expr { +@@ -2779,7 +2779,7 @@ pub enum AssocItemKind { + MacCall(MacCall), + } + +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(AssocItemKind, 72); + + impl AssocItemKind { +@@ -2831,7 +2831,7 @@ pub enum ForeignItemKind { + MacCall(MacCall), + } + +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(ForeignItemKind, 72); + + impl From for ItemKind { +--- compiler/rustc_hir/src/hir.rs ++++ compiler/rustc_hir/src/hir.rs +@@ -3050,3 +3050,3 @@ + // Some nodes are used a lot. Make sure they don't unintentionally get bigger. +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))] + mod size_asserts { +--- compiler/rustc_middle/src/mir/interpret/error.rs ++++ compiler/rustc_middle/src/mir/interpret/error.rs +@@ -452,2 +452,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + static_assert_size!(InterpError<'_>, 64); +--- compiler/rustc_middle/src/mir/mod.rs ++++ compiler/rustc_middle/src/mir/mod.rs +@@ -2203,2 +2203,2 @@ +-#[cfg(target_arch = "x86_64")] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64"))] + static_assert_size!(AggregateKind<'_>, 48); +--- compiler/rustc_middle/src/thir.rs ++++ compiler/rustc_middle/src/thir.rs +@@ -147,2 +147,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Expr<'_>, 144); +--- compiler/rustc_mir/src/interpret/place.rs ++++ compiler/rustc_mir/src/interpret/place.rs +@@ -91,2 +91,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Place, 64); +@@ -100,2 +100,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80); +--- compiler/rustc_mir/src/interpret/operand.rs ++++ compiler/rustc_mir/src/interpret/operand.rs +@@ -35,2 +35,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Immediate, 56); +@@ -90,2 +90,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(ImmTy<'_>, 72); + +# +# Disable crc32fast's use of stdarch +# +--- vendor/crc32fast/src/specialized/mod.rs ++++ vendor/crc32fast/src/specialized/mod.rs +@@ -1,5 +1,6 @@ + cfg_if! { + if #[cfg(all( ++ not(rust_compiler = "mrustc"), + crc32fast_stdarchx86, + any(target_arch = "x86", target_arch = "x86_64") + ))] { + +# +# Disable std_detect's detection logic (use the same logic as miri) +# +--- library/stdarch/crates/std_detect/src/detect/mod.rs ++++ library/stdarch/crates/std_detect/src/detect/mod.rs +@@ -88,2 +88,2 @@ + cfg_if! { +- if #[cfg(miri)] { ++ if #[cfg(any(miri, rust_compiler = "mrustc"))] { + +# PPV-Lite also needs to know that we're pretending to be miri +--- vendor/ppv-lite86/src/lib.rs ++++ vendor/ppv-lite86/src/lib.rs +@@ -12,9 +12,9 @@ +-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] ++#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))] + pub mod x86_64; +-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] ++#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))] + use self::x86_64 as arch; + +-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] ++#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))] + pub mod generic; +-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] ++#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))] + use self::generic as arch; + diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 67dc5cdaf3..fa8a96d7cf 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2016 Nikita ;;; Copyright © 2017 Ben Woodcroft ;;; Copyright © 2017, 2018 Nikolai Merinov -;;; Copyright © 2017, 2019, 2020, 2021 Efraim Flashner +;;; Copyright © 2017, 2019-2022 Efraim Flashner ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2018 Danny Milosavljevic ;;; Copyright © 2019 Ivan Petkov @@ -138,23 +138,23 @@ (define %mrustc-source (base32 "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0"))))) -;;; Rust 1.39 is special in that it is built with mrustc, which shortens the +;;; Rust 1.54 is special in that it is built with mrustc, which shortens the ;;; bootstrap path. -(define rust-1.39 +(define rust-bootstrap (package (name "rust") - (version "1.39.0") + (version "1.54.0") (source (origin (method url-fetch) (uri (rust-uri version)) - (sha256 (base32 "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl")) + (sha256 (base32 "0xk9dhfff16caambmwij67zgshd8v9djw6ha0fnnanlv7rii31dc")) (modules '((guix build utils))) - (snippet '(for-each delete-file-recursively - '("src/llvm-emscripten" - "src/llvm-project" - "vendor/jemalloc-sys/jemalloc"))) - (patches (search-patches "rustc-1.39.0-src.patch")) + (snippet + '(begin + (for-each delete-file-recursively + '("src/llvm-project")))) + (patches (search-patches "rustc-1.54.0-src.patch")) (patch-flags '("-p0")))) ;default is -p1 (outputs '("out" "cargo")) (properties '((timeout . 72000) ;20 hours @@ -162,12 +162,15 @@ (define rust-1.39 (build-system gnu-build-system) (inputs `(("libcurl" ,curl) - ("libssh2" ,libssh2) - ("llvm" ,llvm-9) + ("llvm" ,llvm) ("openssl" ,openssl) ("zlib" ,zlib))) (native-inputs `(("bison" ,bison) + ;; A compiler bug in gcc 10/11/12/13 prevents us from using gcc-10.4. See: + ;; https://github.com/thepowersgang/mrustc/issues/266 + ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860 + ("gcc" ,gcc-9) ("flex" ,flex) ("pkg-config" ,pkg-config) ;; Required for the libstd sources. @@ -206,25 +209,24 @@ (define rust-1.39 ;; to be at this location, and it simplifies things to make it ;; so. (symlink (getcwd) - (string-append "../mrustc/rustc-" ,version "-src")))) + (string-append "../mrustc/rustc-" ,version "-src")) + (with-output-to-file "dl-version" + (lambda _ + (format #t "~a~%" + ,version))))) (add-after 'setup-mrustc-sources 'patch-makefiles ;; This disables building the (unbundled) LLVM. (lambda* (#:key inputs parallel-build? #:allow-other-keys) - (let ((llvm (assoc-ref inputs "llvm")) - (job-spec (format #f "-j~a" - (if parallel-build? - (number->string (parallel-job-count)) - "1")))) + (let ((llvm (assoc-ref inputs "llvm"))) (with-directory-excursion "../mrustc" (substitute* '("minicargo.mk" "run_rustc/Makefile") ;; Use the system-provided LLVM. (("LLVM_CONFIG := .*") - (string-append "LLVM_CONFIG := " llvm "/bin/llvm-config\n")) - (("\\$\\(LLVM_CONFIG\\): .*") - "$(LLVM_CONFIG):\n") - (("\\$Vcd \\$\\(RUSTCSRC\\)build && \\$\\(MAKE\\).*") - "true\n")) + (string-append "LLVM_CONFIG := " llvm "/bin/llvm-config\n"))) + (substitute* "minicargo.mk" + ;; Do not try to fetch sources from the Internet. + (("@curl.*") "")) (substitute* "Makefile" ;; Patch date and git obtained version information. ((" -D VERSION_GIT_FULLHASH=.*") @@ -269,9 +271,6 @@ (define rust-1.39 (setenv "CXX" "g++") ;; The Guix LLVM package installs only shared libraries. (setenv "LLVM_LINK_SHARED" "1") - ;; This is a workaround for - ;; https://github.com/thepowersgang/mrustc/issues/138. - (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "yes") ;; rustc still insists on having 'cc' on PATH in some places ;; (e.g. when building the 'test' library crate). (mkdir-p "/tmp/bin") @@ -283,22 +282,36 @@ (define rust-1.39 (let* ((src-root (getcwd)) (job-count (if parallel-build? (parallel-job-count) - 1)) - (job-spec (string-append "-j" (number->string job-count)))) + 1))) ;; Adapted from: - ;; https://github.com/dtolnay/bootstrap/blob/master/build.sh. + ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh. (chdir "../mrustc") - (setenv "MINICARGO_FLAGS" job-spec) + ;; Use PARLEVEL since both minicargo and mrustc use it + ;; to set the level of parallelism. + (setenv "PARLEVEL" (number->string job-count)) (setenv "CARGO_BUILD_JOBS" (number->string job-count)) + (display "Building mrustc...\n") + (apply invoke "make" make-flags) + + ;; This doesn't seem to build anything, but it + ;; sets additional minicargo flags. + (display "Building RUSTCSRC...\n") + (apply invoke "make" "RUSTCSRC" make-flags) + + ;; This probably doesn't need to be called explicitly. + (display "Building LIBS...\n") + (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags) + (display "Building rustc...\n") (apply invoke "make" "-f" "minicargo.mk" "output/rustc" - job-spec make-flags) + make-flags) + (display "Building cargo...\n") (apply invoke "make" "-f" "minicargo.mk" "output/cargo" - job-spec make-flags) + make-flags) + + ;; This one isn't listed in the build script. (display "Rebuilding stdlib with rustc...\n") - ;; Note: invoking make with -j would cause a compiler error - ;; (unexpected panic). (apply invoke "make" "-C" "run_rustc" make-flags)))) (replace 'install (lambda* (#:key inputs outputs #:allow-other-keys) @@ -331,35 +344,23 @@ (define rust-1.39 ;; Dual licensed. (license (list license:asl2.0 license:expat)))) -(define rust-1.40 +(define rust-1.55 (package (name "rust") - (version "1.40.0") + (version "1.55.0") (source (origin (method url-fetch) (uri (rust-uri version)) - (sha256 (base32 "1ba9llwhqm49w7sz3z0gqscj039m53ky9wxzhaj11z6yg1ah15yx")) + (sha256 (base32 "07l28f7grdmi65naq71pbmvdd61hwcpi40ry7kp7dy7m233rldxj")) (modules '((guix build utils))) - ;; llvm-emscripten is no longer bundled, as that codegen backend got - ;; removed. (snippet '(for-each delete-file-recursively '("src/llvm-project" - "vendor/jemalloc-sys/jemalloc"))))) + "vendor/tikv-jemalloc-sys/jemalloc"))))) (outputs '("out" "cargo")) (properties '((timeout . 72000) ;20 hours (max-silent-time . 18000))) ;5 hours (for armel) (build-system gnu-build-system) - ;; Rust 1.40 does not ship rustc-internal libraries by default (see - ;; rustc-dev-split). This means that librustc_driver.so is no longer - ;; available in lib/rustlib/$target/lib, which is the directory - ;; included in the runpath of librustc_codegen_llvm-llvm.so. This is - ;; detected by our validate-runpath phase as an error, but it is - ;; harmless as the codegen backend is loaded by librustc_driver.so - ;; itself, which must at that point have been already loaded. As such, - ;; we skip validating the runpath for Rust 1.40. Rust 1.41 stopped - ;; putting the codegen backend in a separate library, which makes this - ;; workaround only necessary for this release. (arguments `(#:validate-runpath? #f ;; Only the final Rust is tested, not the intermediate bootstrap ones, @@ -380,24 +381,16 @@ (define rust-1.40 (setenv "CC" (search-input-file inputs "/bin/gcc")) ;; The Guix LLVM package installs only shared libraries. (setenv "LLVM_LINK_SHARED" "1"))) + (add-after 'unpack 'set-linker-locale-to-utf8 + (lambda _ + (substitute* (find-files "." "^linker.rs$") + (("linker.env\\(\"LC_ALL\", \"C\"\\);") + "linker.env(\"LC_ALL\", \"en_US.UTF-8\");")))) (add-after 'unpack 'add-cc-shim-to-path (lambda _ (mkdir-p "/tmp/bin") (symlink (which "gcc") "/tmp/bin/cc") (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) - (add-after 'unpack 'neuter-tidy - ;; We often need to patch tests with various Guix-specific paths. - ;; This often increases the line length and makes tidy, rustc's - ;; style checker, complain. We could insert additional newlines or - ;; add an "// ignore-tidy-linelength" comment, but as an ignore - ;; comment must be used, both approaches are fragile due to - ;; upstream formatting changes. As such, disable running the - ;; linter during tests, since it's intended for rustc developers - ;; anyway. - (lambda _ - (substitute* "src/bootstrap/builder.rs" - ((".*::Tidy,.*") - "")))) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -443,13 +436,14 @@ (define rust-1.40 [dist] ") port)))))) (replace 'build + ;; The standard library source location moved in this release. (lambda* (#:key parallel-build? #:allow-other-keys) (let ((job-spec (string-append "-j" (if parallel-build? (number->string (parallel-job-count)) "1")))) (invoke "./x.py" job-spec "build" "--stage=1" - "src/libstd" + "library/std" "src/tools/cargo")))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) @@ -490,12 +484,12 @@ (define rust-1.40 `(("cmake" ,cmake-minimal) ("pkg-config" ,pkg-config) ; For "cargo" ("python" ,python-wrapper) - ("rustc-bootstrap" ,rust-1.39) - ("cargo-bootstrap" ,rust-1.39 "cargo") + ("rustc-bootstrap" ,rust-bootstrap) + ("cargo-bootstrap" ,rust-bootstrap "cargo") ("which" ,which))) (inputs `(("jemalloc" ,jemalloc) - ("llvm" ,llvm-9) + ("llvm" ,llvm) ("openssl" ,openssl) ("libssh2" ,libssh2) ; For "cargo" ("libcurl" ,curl))) ; For "cargo" @@ -519,10 +513,10 @@ (define rust-1.40 ;; Dual licensed. (license (list license:asl2.0 license:expat)))) -(define rust-1.41 +(define rust-1.56 (let ((base-rust (rust-bootstrapped-package - rust-1.40 "1.41.1" - "0ws5x0fxv57fyllsa6025h3q6j9v3m8nb3syl4x0hgkddq0kvj9q"))) + rust-1.55 "1.56.1" + "04cmqx7nn63hzz7z27b2b0dj2qx18rck9ifvip43s6dampx8v2f3"))) (package (inherit base-rust) (arguments @@ -539,110 +533,6 @@ (define rust-1.41 (string-append name "\"" ,%cargo-reference-hash "\""))) (generate-all-checksums "vendor")))))))))) -(define rust-1.42 - (rust-bootstrapped-package - rust-1.41 "1.42.0" "0x9lxs82may6c0iln0b908cxyn1cv7h03n5cmbx3j1bas4qzks6j")) - -(define rust-1.43 - (rust-bootstrapped-package - rust-1.42 "1.43.0" "18akhk0wz1my6y9vhardriy2ysc482z0fnjdcgs9gy59kmnarxkm")) - -;; This version requires llvm <= 11. -(define rust-1.44 - (rust-bootstrapped-package - rust-1.43 "1.44.1" - "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky")) - -(define rust-1.45 - (let ((base-rust (rust-bootstrapped-package - rust-1.44 "1.45.2" - "0273a1g3f59plyi1n0azf21qjzwml1yqdnj5z472crz37qggr8xp"))) - (package - (inherit base-rust) - (arguments - (substitute-keyword-arguments (package-arguments base-rust) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'set-linker-locale-to-utf8 - (lambda _ - (substitute* (find-files "." "^linker.rs$") - (("linker.env\\(\"LC_ALL\", \"C\"\\);") - "linker.env(\"LC_ALL\", \"en_US.UTF-8\");"))))))))))) - -(define rust-1.46 - (rust-bootstrapped-package - rust-1.45 "1.46.0" "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid")) - -(define rust-1.47 - (let ((base-rust (rust-bootstrapped-package - rust-1.46 "1.47.0" - "07fqd2vp7cf1ka3hr207dnnz93ymxml4935vp74g4is79h3dz19i"))) - (package/inherit base-rust - (arguments - (substitute-keyword-arguments (package-arguments base-rust) - ((#:phases phases) - `(modify-phases ,phases - (replace 'build - ;; The standard library source location moved in this release. - (lambda* (#:key parallel-build? #:allow-other-keys) - (let ((job-spec (string-append - "-j" (if parallel-build? - (number->string (parallel-job-count)) - "1")))) - (invoke "./x.py" job-spec "build" "--stage=1" - "library/std" - "src/tools/cargo"))))))))))) - -(define rust-1.48 - (rust-bootstrapped-package - rust-1.47 "1.48.0" "0fz4gbb5hp5qalrl9lcl8yw4kk7ai7wx511jb28nypbxninkwxhf")) - -(define rust-1.49 - (rust-bootstrapped-package - rust-1.48 "1.49.0" "0yf7kll517398dgqsr7m3gldzj0iwsp3ggzxrayckpqzvylfy2mm")) - -(define rust-1.50 - (rust-bootstrapped-package - rust-1.49 "1.50.0" "0pjs7j62maiyvkmhp9zrxl528g2n0fphp4rq6ap7aqdv0a6qz5wm")) - -(define rust-1.51 - (rust-bootstrapped-package - rust-1.50 "1.51.0" "0ixqkqglv3isxbvl4ldr4byrkx692wghsz3fasy1pn5kr2prnsvs")) - -;;; The LLVM requiriment has been bumped to version 10 in Rust 1.52. Use the -;;; latest available. -(define rust-1.52 - (let ((base-rust (rust-bootstrapped-package - rust-1.51 "1.52.1" - "165zs3xzp9dravybwslqs1qhn35agp6wacmzpymqg3qfdni26vrs"))) - (package - (inherit base-rust) - (inputs (alist-replace "llvm" (list llvm-12) - (package-inputs base-rust)))))) - -(define rust-1.53 - (rust-bootstrapped-package - rust-1.52 "1.53.0" "1f95p259dfp5ca118bg107rj3rqwlswy65dxn3hg8sqgl4wwmxsw")) - -(define rust-1.54 - (let ((base-rust - (rust-bootstrapped-package - rust-1.53 - "1.54.0" "0xk9dhfff16caambmwij67zgshd8v9djw6ha0fnnanlv7rii31dc"))) - (package/inherit base-rust - (source - (origin - (inherit (package-source base-rust)) - (snippet '(delete-file-recursively "src/llvm-project"))))))) - -(define rust-1.55 - (rust-bootstrapped-package - rust-1.54 "1.55.0" "07l28f7grdmi65naq71pbmvdd61hwcpi40ry7kp7dy7m233rldxj")) - -(define rust-1.56 - (rust-bootstrapped-package - rust-1.55 "1.56.1" "04cmqx7nn63hzz7z27b2b0dj2qx18rck9ifvip43s6dampx8v2f3")) - (define rust-1.57 (let ((base-rust (rust-bootstrapped-package -- cgit v1.2.3 From ca4bfb0f2de7a2c9997f92574be65fcba4e86d64 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 10 Jul 2022 20:18:05 +0300 Subject: gnu: rust-bootstrap: Add support for riscv64-linux. * gnu/packages/rust.scm (%mrustc-source): Add patch. (rust-bootstrap)[native-inputs]: On riscv64-linux add gcc@9:lib. [supported-systems]: Add riscv64-linux. Adjust comment. * gnu/packages/patches/mrustc-riscv64-support.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/patches/mrustc-riscv64-support.patch | 48 +++++++++++++++++++++++ gnu/packages/rust.scm | 13 ++++-- 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/mrustc-riscv64-support.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index be6d37fc26..5a5ec334d9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1509,6 +1509,7 @@ dist_patch_DATA = \ %D%/packages/patches/mono-mdoc-timestamping.patch \ %D%/packages/patches/mosaicatcher-unbundle-htslib.patch \ %D%/packages/patches/mrrescue-support-love-11.patch \ + %D%/packages/patches/mrustc-riscv64-support.patch \ %D%/packages/patches/mtools-mformat-uninitialized.patch \ %D%/packages/patches/mumps-build-parallelism.patch \ %D%/packages/patches/mumps-shared-libseq.patch \ diff --git a/gnu/packages/patches/mrustc-riscv64-support.patch b/gnu/packages/patches/mrustc-riscv64-support.patch new file mode 100644 index 0000000000..6312116585 --- /dev/null +++ b/gnu/packages/patches/mrustc-riscv64-support.patch @@ -0,0 +1,48 @@ +Patch sent upstream for review: +https://github.com/thepowersgang/mrustc/pull/276 + +diff --git a/src/trans/target.cpp b/src/trans/target.cpp +index 420a2870..4d5eefb3 100644 +--- a/src/trans/target.cpp ++++ b/src/trans/target.cpp +@@ -65,6 +65,13 @@ const TargetArch ARCH_POWERPC64LE = { + { /*atomic(u8)=*/true, true, true, true, true }, + TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) + }; ++// This is a guess ++const TargetArch ARCH_RISCV64 = { ++ "riscv64", ++ 64, false, ++ { /*atomic(u8)=*/true, true, true, true, true }, ++ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) ++}; + TargetSpec g_target; + + +@@ -455,6 +462,13 @@ namespace + ARCH_POWERPC64LE + }; + } ++ else if(target_name == "riscv64-unknown-linux-gnu") ++ { ++ return TargetSpec { ++ "unix", "linux", "gnu", {CodegenMode::Gnu11, false, "riscv64-unknown-linux-gnu", BACKEND_C_OPTS_GNU}, ++ ARCH_RISCV64 ++ }; ++ } + else if(target_name == "i586-pc-windows-gnu") + { + return TargetSpec { +diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h +index a052da6b..42fea91a 100644 +--- a/tools/common/target_detect.h ++++ b/tools/common/target_detect.h +@@ -34,6 +34,8 @@ + # define DEFAULT_TARGET_NAME "powerpc64-unknown-linux-gnu" + # elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) + # define DEFAULT_TARGET_NAME "powerpc64le-unknown-linux-gnu" ++# elif defined(__riscv) && __riscv_xlen == 64 ++# define DEFAULT_TARGET_NAME "riscv64-unknown-linux-gnu" + # else + # warning "Unable to detect a suitable default target (linux-gnu)" + # endif diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 38ed83f6bc..2942c5cb1f 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -137,7 +137,8 @@ (define %mrustc-source (file-name (git-file-name name (git-version version revision commit))) (sha256 (base32 - "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0"))))) + "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0")) + (patches (search-patches "mrustc-riscv64-support.patch"))))) ;;; Rust 1.54 is special in that it is built with mrustc, which shortens the ;;; bootstrap path. @@ -172,6 +173,10 @@ (define rust-bootstrap ;; https://github.com/thepowersgang/mrustc/issues/266 ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860 ("gcc" ,gcc-9) + ;; TODO: STARTFILE_PREFIX_SPEC is fixed on gcc<10 on core-updates. + ,@(if (target-riscv64?) + `(("gcc:lib" ,gcc-9 "lib")) + '()) ("flex" ,flex) ("pkg-config" ,pkg-config) ;; Required for the libstd sources. @@ -338,9 +343,11 @@ (define rust-bootstrap safety and thread safety guarantees.") (home-page "https://github.com/thepowersgang/mrustc") - ;; So far mrustc is (x86_64|aarch64)-only. It may support i686 soon: + ;; The intermediate generated code is known to be inefficient and + ;; therefore the build process needs 8GB of RAM while building. + ;; It may support i686 soon: ;; . - (supported-systems '("x86_64-linux" "aarch64-linux")) + (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux")) ;; Dual licensed. (license (list license:asl2.0 license:expat)))) -- cgit v1.2.3 From 9c02f19d6de8a09b90f3bca7c0eba5dd86f4edc0 Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Sun, 26 Jun 2022 19:23:19 +0200 Subject: gnu: gst-plugins-good: Update to 1.20.3. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/gstreamer.scm (gst-plugins-good): Update to 1.20.3. [source]: Remove “gst-plugins-good-fix-test.patch”. [arguments]<#:phases>: Add ‘absolutize-libsoup-library’ and ‘skip-failing-tests’. * gnu/packages/patches/gst-plugins-good-fix-test.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. --- gnu/local.mk | 1 - gnu/packages/gstreamer.scm | 19 ++++- .../patches/gst-plugins-good-fix-test.patch | 94 ---------------------- 3 files changed, 16 insertions(+), 98 deletions(-) delete mode 100644 gnu/packages/patches/gst-plugins-good-fix-test.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 33b8194dc1..bb8514c0d9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1226,7 +1226,6 @@ dist_patch_DATA = \ %D%/packages/patches/grub-efi-fat-serial-number.patch \ %D%/packages/patches/grub-setup-root.patch \ %D%/packages/patches/gspell-dash-test.patch \ - %D%/packages/patches/gst-plugins-good-fix-test.patch \ %D%/packages/patches/guile-1.8-cpp-4.5.patch \ %D%/packages/patches/guile-2.2-skip-oom-test.patch \ %D%/packages/patches/guile-2.2-skip-so-test.patch \ diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm index 0f655db067..b781fa06e9 100644 --- a/gnu/packages/gstreamer.scm +++ b/gnu/packages/gstreamer.scm @@ -608,7 +608,7 @@ (define-public gst-plugins-base (define-public gst-plugins-good (package (name "gst-plugins-good") - (version "1.18.5") + (version "1.20.3") (source (origin (method url-fetch) @@ -616,15 +616,28 @@ (define-public gst-plugins-good (string-append "https://gstreamer.freedesktop.org/src/" name "/" name "-" version ".tar.xz")) - (patches (search-patches "gst-plugins-good-fix-test.patch")) (sha256 - (base32 "0svrapawych2s3lm4lx3x023zxq5kcx50jnfmh0qigszfskyxbis")))) + (base32 "1dv8b2md1xk6d45ir1wzbvqhxbvm6mxv881rjl0brnjwpw3c5wzq")))) (build-system meson-build-system) (arguments `(#:glib-or-gtk? #t ; To wrap binaries and/or compile schemas #:phases (modify-phases %standard-phases ,@%common-gstreamer-phases + (add-after 'unpack 'absolutize-libsoup-library + (lambda* (#:key inputs #:allow-other-keys) + (define libsoup + (search-input-file inputs "lib/libsoup-3.0.so")) + + (substitute* "ext/soup/gstsouploader.c" + (("(#define LIBSOUP_3_SONAME ).+$" _ prefix) + (string-append prefix "\"" libsoup "\"\n"))))) + (add-after 'unpack 'skip-failing-tests + (lambda _ + (substitute* "tests/check/meson.build" + ;; Reported as shaky upstream, see + ;; + (("\\[ 'elements/flvmux' \\]") "[ 'elements/flvmux', true ]")))) (add-before 'check 'pre-check (lambda _ ;; Tests require a running X server. diff --git a/gnu/packages/patches/gst-plugins-good-fix-test.patch b/gnu/packages/patches/gst-plugins-good-fix-test.patch deleted file mode 100644 index 38ec0ba802..0000000000 --- a/gnu/packages/patches/gst-plugins-good-fix-test.patch +++ /dev/null @@ -1,94 +0,0 @@ -Fix a broken test: - -https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/803 - -Patches copied from upstream source repository: - -https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/commit/2ce5909f3a0b0da3abb7b794215d6b8b72a3b7fa -https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/commit/f5310ce346180a717f091f2f09bcbb3ddfb15436 - -From 2ce5909f3a0b0da3abb7b794215d6b8b72a3b7fa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= -Date: Thu, 12 Nov 2020 23:38:21 +0000 -Subject: [PATCH 1/2] tests: qtdemux: fix crash on 32-bit architectures - -Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/803 - -Part-of: ---- - tests/check/elements/qtdemux.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/tests/check/elements/qtdemux.c b/tests/check/elements/qtdemux.c -index 5271c6576..0c748278b 100644 ---- a/tests/check/elements/qtdemux.c -+++ b/tests/check/elements/qtdemux.c -@@ -797,9 +797,10 @@ GST_START_TEST (test_qtdemux_pad_names) - "protection-system", G_TYPE_STRING, - "9a04f079-9840-4286-ab92-e65be0885f95", NULL); - caps = -- gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, -- "mss-fragmented", "timesacle", G_TYPE_UINT64, 10000000, "media-caps", -- GST_TYPE_CAPS, mediacaps, NULL); -+ gst_caps_new_simple ("video/quicktime", -+ "variant", G_TYPE_STRING, "mss-fragmented", -+ "timesacle", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), -+ "media-caps", GST_TYPE_CAPS, mediacaps, NULL); - - /* Send segment event* */ - event = gst_event_new_caps (caps); -@@ -852,9 +853,10 @@ GST_START_TEST (test_qtdemux_pad_names) - "protection-system", G_TYPE_STRING, - "9a04f079-9840-4286-ab92-e65be0885f95", NULL); - caps = -- gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, -- "mss-fragmented", "timesacle", G_TYPE_UINT64, 10000000, "media-caps", -- GST_TYPE_CAPS, mediacaps, NULL); -+ gst_caps_new_simple ("video/quicktime", -+ "variant", G_TYPE_STRING, "mss-fragmented", -+ "timesacle", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), -+ "media-caps", GST_TYPE_CAPS, mediacaps, NULL); - - /* Send segment event* */ - event = gst_event_new_caps (caps); --- -2.30.0 - - -From f5310ce346180a717f091f2f09bcbb3ddfb15436 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= -Date: Thu, 12 Nov 2020 23:39:21 +0000 -Subject: [PATCH 2/2] tests: qtdemux: fix typo in caps field - -timesacle -> timescale - -Part-of: ---- - tests/check/elements/qtdemux.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/check/elements/qtdemux.c b/tests/check/elements/qtdemux.c -index 0c748278b..4a14c45c0 100644 ---- a/tests/check/elements/qtdemux.c -+++ b/tests/check/elements/qtdemux.c -@@ -799,7 +799,7 @@ GST_START_TEST (test_qtdemux_pad_names) - caps = - gst_caps_new_simple ("video/quicktime", - "variant", G_TYPE_STRING, "mss-fragmented", -- "timesacle", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), -+ "timescale", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), - "media-caps", GST_TYPE_CAPS, mediacaps, NULL); - - /* Send segment event* */ -@@ -855,7 +855,7 @@ GST_START_TEST (test_qtdemux_pad_names) - caps = - gst_caps_new_simple ("video/quicktime", - "variant", G_TYPE_STRING, "mss-fragmented", -- "timesacle", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), -+ "timescale", G_TYPE_UINT64, G_GUINT64_CONSTANT (10000000), - "media-caps", GST_TYPE_CAPS, mediacaps, NULL); - - /* Send segment event* */ --- -2.30.0 - -- cgit v1.2.3 From 6ba74ab29c641c9b43b64473a69e3210c132eeca Mon Sep 17 00:00:00 2001 From: Tom Fitzhenry Date: Fri, 24 Jun 2022 21:08:35 +1000 Subject: gnu: Remove texlive's dependence on ruby-rspec and ruby-byebug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation: Break the dependency chain from guix to mariadb. Prior to this patch: $ guix graph --path guix mariadb guix@1.3.0-27.598f728 po4a@0.63 texlive-tiny@59745 texlive-latex-base@59745 texlive-hyphen-afrikaans@59745 ruby-hydra@0.0-0.5abfa37 ruby-byebug@11.1.3 ruby-rubocop@1.10.0 ruby-parallel@1.21.0 ruby-mysql2@0.5.2 mariadb@10.5.12 As of this patch: $ ./pre-inst-env guix graph --path guix mariadb guix graph: error: no path from 'guix@1.3.0-27.598f728' to 'mariadb@10.5.12' * gnu/local.mk (dist_patch_DATA): Add texlive-hyph-utf8-no-byebug.patch. * gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch: New file. * gnu/packages/tex.scm (hyph-utf8-scripts): Add patch. (texlive-hyphen-package): Depend on ruby-hydra-minimal. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 1 + gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch | 13 +++++++++++++ gnu/packages/tex.scm | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 4cf006dd60..872437cb42 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1851,6 +1851,7 @@ dist_patch_DATA = \ %D%/packages/patches/telegram-purple-adjust-test.patch \ %D%/packages/patches/texi2html-document-encoding.patch \ %D%/packages/patches/texi2html-i18n.patch \ + %D%/packages/patches/texlive-hyph-utf8-no-byebug.patch \ %D%/packages/patches/thefuck-test-environ.patch \ %D%/packages/patches/tidy-CVE-2015-5522+5523.patch \ %D%/packages/patches/timescaledb-flaky-test.patch \ diff --git a/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch b/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch new file mode 100644 index 0000000000..fb29b76ef2 --- /dev/null +++ b/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch @@ -0,0 +1,13 @@ +Description: Avoid dependency on byebug to reduce package closure + significantly, see https://issues.guix.gnu.org/55997 +diff --git a/lib/tex/hyphen/language.rb b/lib/tex/hyphen/language.rb +index 12831417..df6daa39 100644 +--- a/lib/tex/hyphen/language.rb ++++ b/lib/tex/hyphen/language.rb +@@ -1,6 +1,5 @@ + require 'yaml' + require 'hydra' +-require 'byebug' + + require_relative 'path' + diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index ddcd0043c4..d075a6e475 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -157,6 +157,7 @@ (define hyph-utf8-scripts (file-name (string-append "hyph-utf8-scripts-" (number->string %texlive-revision) "-checkout")) + (patches (search-patches "texlive-hyph-utf8-no-byebug.patch")) (sha256 (base32 "04xzf5gr3ylyh3ls09imrx4mwq3qp1k97r9njzlan6hlff875rx2")))) @@ -225,7 +226,7 @@ (define (texlive-hyphen-package name code locations hash) (invoke "ruby" "generate-ptex-patterns.rb"))))))))) (native-inputs `(("ruby" ,ruby) - ("ruby-hydra" ,ruby-hydra) + ("ruby-hydra-minimal" ,ruby-hydra-minimal) ("hyph-utf8-scripts" ,hyph-utf8-scripts))) (home-page "https://ctan.org/pkg/hyph-utf8")))) -- cgit v1.2.3 From 7a485d43c92ea01f7fb64d96d73361a925596abf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 8 Aug 2022 18:33:10 +0200 Subject: gnu: ruby-hydra-minimal: Add missing patch. This is a followup to bb907402a613494e7fb6f8f04bf8d9d16ff9ee66. * gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch: New file. --- gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch b/gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch new file mode 100644 index 0000000000..7b338ca03e --- /dev/null +++ b/gnu/packages/patches/ruby-hydra-minimal-no-byebug.patch @@ -0,0 +1,11 @@ +Description: Avoid dependency on byebug to reduce package closure + significantly, see https://issues.guix.gnu.org/55997 +diff --git a/lib/hydra.rb b/lib/hydra.rb +index 29fbad2..6b5058a 100644 +--- a/lib/hydra.rb ++++ b/lib/hydra.rb +@@ -1,4 +1,3 @@ +-require 'byebug' unless ENV['RACK_ENV'] == "production" + require 'pp' + + module CoreExt -- cgit v1.2.3 From 431df1214e5c5819ca22157a8a6d94d1e066a56b Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Fri, 12 Aug 2022 20:45:18 +0200 Subject: gnu: python-dateutil: Adjust tests for Pytest 7. * gnu/packages/patches/python-dateutil-pytest-compat.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/time.scm (python-dateutil)[source](patches): New field. --- gnu/local.mk | 1 + .../patches/python-dateutil-pytest-compat.patch | 43 ++++++++++++++++++++++ gnu/packages/time.scm | 1 + 3 files changed, 45 insertions(+) create mode 100644 gnu/packages/patches/python-dateutil-pytest-compat.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 0ee0a4d8b6..f0c1f60c8a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1692,6 +1692,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch \ %D%/packages/patches/python-cross-compile.patch \ %D%/packages/patches/python-configobj-setuptools.patch \ + %D%/packages/patches/python-dateutil-pytest-compat.patch \ %D%/packages/patches/python-debugpy-unbundle-pydevd.patch \ %D%/packages/patches/python-docopt-pytest6-compat.patch \ %D%/packages/patches/python-execnet-read-only-fix.patch \ diff --git a/gnu/packages/patches/python-dateutil-pytest-compat.patch b/gnu/packages/patches/python-dateutil-pytest-compat.patch new file mode 100644 index 0000000000..5cff57e94c --- /dev/null +++ b/gnu/packages/patches/python-dateutil-pytest-compat.patch @@ -0,0 +1,43 @@ +Add compatibility with newer versions of pytest. + +Taken from upstream: + + https://github.com/dateutil/dateutil/commit/2bdd63158b7f981fc6d70a869680451bdfd8d848 + +diff --git a/dateutil/test/test_internals.py b/dateutil/test/test_internals.py +index 53081314..b32e6723 100644 +--- a/dateutil/test/test_internals.py ++++ b/dateutil/test/test_internals.py +@@ -9,6 +9,7 @@ + + import sys + import pytest ++import warnings + + from dateutil.parser._parser import _ymd + from dateutil import tz +@@ -65,18 +66,17 @@ def test_parser_parser_private_not_warns(): + from dateutil.parser._parser import _timelex, _tzparser + from dateutil.parser._parser import _parsetz + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _tzparser() +- assert len(recorder) == 0 + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _timelex('2014-03-03') + +- assert len(recorder) == 0 +- +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _parsetz('+05:00') +- assert len(recorder) == 0 + + + @pytest.mark.tzstr diff --git a/gnu/packages/time.scm b/gnu/packages/time.scm index fea9ff25f7..9128056f78 100644 --- a/gnu/packages/time.scm +++ b/gnu/packages/time.scm @@ -196,6 +196,7 @@ (define-public python-dateutil (origin (method url-fetch) (uri (pypi-uri "python-dateutil" version)) + (patches (search-patches "python-dateutil-pytest-compat.patch")) (sha256 (base32 "11iy7m4bp2lgfkcl0r6xzf34bvk7ppjmsyn2ygfikbi72v6cl8q1")))) -- cgit v1.2.3 From 290ac5cd1e67d99b4d704603c1559dfb72f542c2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 25 Aug 2022 12:59:42 +0200 Subject: gnu: polkit: Update to 121. * gnu/packages/polkit.scm (polkit-mozjs): Update to 121. [source](patches): Remove. [source](snippet): Adjust for build system changes. [build-system]: Change to MESON-BUILD-SYSTEM. [inputs]: Replace MOZJS-78 with MOZJS-91. [native-inputs]: Add GETTEXT-MINIMAL and LIBXML2. [arguments]: Remove #:phases. Adjust #:configure-flags for build system changes. Use G-expression. (polkit-duktape)[source]: Remove. [arguments]: Adjust for build build system changes. * gnu/packages/patches/polkit-CVE-2021-4034.patch, gnu/packages/patches/polkit-configure-elogind.patch, gnu/packages/patches/polkit-use-duktape.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. --- gnu/local.mk | 3 - gnu/packages/patches/polkit-CVE-2021-4034.patch | 82 - .../patches/polkit-configure-elogind.patch | 15 - gnu/packages/patches/polkit-use-duktape.patch | 5030 -------------------- gnu/packages/polkit.scm | 110 +- 5 files changed, 36 insertions(+), 5204 deletions(-) delete mode 100644 gnu/packages/patches/polkit-CVE-2021-4034.patch delete mode 100644 gnu/packages/patches/polkit-configure-elogind.patch delete mode 100644 gnu/packages/patches/polkit-use-duktape.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 1094e2dfd5..68d2a3dc8c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1650,9 +1650,6 @@ dist_patch_DATA = \ %D%/packages/patches/plib-CVE-2011-4620.patch \ %D%/packages/patches/plib-CVE-2012-4552.patch \ %D%/packages/patches/plotutils-spline-test.patch \ - %D%/packages/patches/polkit-CVE-2021-4034.patch \ - %D%/packages/patches/polkit-configure-elogind.patch \ - %D%/packages/patches/polkit-use-duktape.patch \ %D%/packages/patches/portaudio-audacity-compat.patch \ %D%/packages/patches/portmidi-modular-build.patch \ %D%/packages/patches/postgresql-disable-resolve_symlinks.patch \ diff --git a/gnu/packages/patches/polkit-CVE-2021-4034.patch b/gnu/packages/patches/polkit-CVE-2021-4034.patch deleted file mode 100644 index ca766cb3be..0000000000 --- a/gnu/packages/patches/polkit-CVE-2021-4034.patch +++ /dev/null @@ -1,82 +0,0 @@ -Fixes CVE-2021-4034, local privilege escalation with 'pkexec': - - https://www.openwall.com/lists/oss-security/2022/01/25/11 - -Patch from . - -From a2bf5c9c83b6ae46cbd5c779d3055bff81ded683 Mon Sep 17 00:00:00 2001 -From: Jan Rybar -Date: Tue, 25 Jan 2022 17:21:46 +0000 -Subject: [PATCH] pkexec: local privilege escalation (CVE-2021-4034) - ---- - src/programs/pkcheck.c | 5 +++++ - src/programs/pkexec.c | 23 ++++++++++++++++++++--- - 2 files changed, 25 insertions(+), 3 deletions(-) - -diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c -index f1bb4e1..768525c 100644 ---- a/src/programs/pkcheck.c -+++ b/src/programs/pkcheck.c -@@ -363,6 +363,11 @@ main (int argc, char *argv[]) - local_agent_handle = NULL; - ret = 126; - -+ if (argc < 1) -+ { -+ exit(126); -+ } -+ - /* Disable remote file access from GIO. */ - setenv ("GIO_USE_VFS", "local", 1); - -diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c -index 7698c5c..84e5ef6 100644 ---- a/src/programs/pkexec.c -+++ b/src/programs/pkexec.c -@@ -488,6 +488,15 @@ main (int argc, char *argv[]) - pid_t pid_of_caller; - gpointer local_agent_handle; - -+ -+ /* -+ * If 'pkexec' is called THIS wrong, someone's probably evil-doing. Don't be nice, just bail out. -+ */ -+ if (argc<1) -+ { -+ exit(127); -+ } -+ - ret = 127; - authority = NULL; - subject = NULL; -@@ -614,10 +623,10 @@ main (int argc, char *argv[]) - - path = g_strdup (pwstruct.pw_shell); - if (!path) -- { -+ { - g_printerr ("No shell configured or error retrieving pw_shell\n"); - goto out; -- } -+ } - /* If you change this, be sure to change the if (!command_line) - case below too */ - command_line = g_strdup (path); -@@ -636,7 +645,15 @@ main (int argc, char *argv[]) - goto out; - } - g_free (path); -- argv[n] = path = s; -+ path = s; -+ -+ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated. -+ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination -+ */ -+ if (argv[n] != NULL) -+ { -+ argv[n] = path; -+ } - } - if (access (path, F_OK) != 0) - { diff --git a/gnu/packages/patches/polkit-configure-elogind.patch b/gnu/packages/patches/polkit-configure-elogind.patch deleted file mode 100644 index 8fefb7a0c2..0000000000 --- a/gnu/packages/patches/polkit-configure-elogind.patch +++ /dev/null @@ -1,15 +0,0 @@ -Even when the polkit configure script detects elogind, it does not use -it. This patch ensures that elogind is used when it is detected. - -diff -ruN a/configure b/configure ---- a/configure 1969-12-31 19:00:01.000000000 -0500 -+++ b/configure 2021-11-19 00:04:55.581385020 -0500 -@@ -20390,7 +20390,7 @@ - - - -- if test "$have_libsystemd" = "yes"; then -+ if test "$have_libsystemd" = "yes" || test "$have_libelogind" = "yes"; then - HAVE_LIBSYSTEMD_TRUE= - HAVE_LIBSYSTEMD_FALSE='#' - else diff --git a/gnu/packages/patches/polkit-use-duktape.patch b/gnu/packages/patches/polkit-use-duktape.patch deleted file mode 100644 index 4eaa7963c2..0000000000 --- a/gnu/packages/patches/polkit-use-duktape.patch +++ /dev/null @@ -1,5030 +0,0 @@ -From 4f66a9549a393e4d74b93eb85301a04ea94bc750 Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Wed, 24 Jul 2019 15:55:17 +0800 -Subject: [PATCH 01/16] Add duktape as javascript engine. - -Signed-off-by: Gustavo Lima Chaves ---- - configure.ac | 28 +- - src/polkitbackend/Makefile.am | 14 +- - .../polkitbackendduktapeauthority.c | 1402 +++++++++++++++++ - 3 files changed, 1436 insertions(+), 8 deletions(-) - create mode 100644 src/polkitbackend/polkitbackendduktapeauthority.c - -diff --git a/configure.ac b/configure.ac -index e434ca2..5a03593 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -80,11 +80,22 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0]) - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - --PKG_CHECK_MODULES(LIBJS, [mozjs-78]) -- --AC_SUBST(LIBJS_CFLAGS) --AC_SUBST(LIBJS_CXXFLAGS) --AC_SUBST(LIBJS_LIBS) -+dnl --------------------------------------------------------------------------- -+dnl - Check javascript backend -+dnl --------------------------------------------------------------------------- -+AC_ARG_WITH(duktape, AS_HELP_STRING([--with-duktape],[Use Duktape as javascript backend]),with_duktape=yes,with_duktape=no) -+AS_IF([test x${with_duktape} == xyes], [ -+ PKG_CHECK_MODULES(LIBJS, [duktape >= 2.0.0 ]) -+ AC_SUBST(LIBJS_CFLAGS) -+ AC_SUBST(LIBJS_LIBS) -+], [ -+ PKG_CHECK_MODULES(LIBJS, [mozjs-78]) -+ -+ AC_SUBST(LIBJS_CFLAGS) -+ AC_SUBST(LIBJS_CXXFLAGS) -+ AC_SUBST(LIBJS_LIBS) -+]) -+AM_CONDITIONAL(USE_DUKTAPE, [test x$with_duktape == xyes], [Using duktape as javascript engine library]) - - EXPAT_LIB="" - AC_ARG_WITH(expat, [ --with-expat= Use expat from here], -@@ -585,6 +596,13 @@ echo " - PAM support: ${have_pam} - systemdsystemunitdir: ${systemdsystemunitdir} - polkitd user: ${POLKITD_USER}" -+if test "x${with_duktape}" = xyes; then -+echo " -+ Javascript engine: Duktape" -+else -+echo " -+ Javascript engine: Mozjs" -+fi - - if test "$have_pam" = yes ; then - echo " -diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am -index 7e3c080..abcbc6f 100644 ---- a/src/polkitbackend/Makefile.am -+++ b/src/polkitbackend/Makefile.am -@@ -33,7 +33,7 @@ libpolkit_backend_1_la_SOURCES = \ - polkitbackendprivate.h \ - polkitbackendauthority.h polkitbackendauthority.c \ - polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \ -- polkitbackendjsauthority.h polkitbackendjsauthority.cpp \ -+ polkitbackendjsauthority.h \ - polkitbackendactionpool.h polkitbackendactionpool.c \ - polkitbackendactionlookup.h polkitbackendactionlookup.c \ - $(NULL) -@@ -51,19 +51,27 @@ libpolkit_backend_1_la_CFLAGS = \ - -D_POLKIT_BACKEND_COMPILATION \ - $(GLIB_CFLAGS) \ - $(LIBSYSTEMD_CFLAGS) \ -- $(LIBJS_CFLAGS) \ -+ $(LIBJS_CFLAGS) \ - $(NULL) - - libpolkit_backend_1_la_CXXFLAGS = $(libpolkit_backend_1_la_CFLAGS) - - libpolkit_backend_1_la_LIBADD = \ - $(GLIB_LIBS) \ -+ $(DUKTAPE_LIBS) \ - $(LIBSYSTEMD_LIBS) \ - $(top_builddir)/src/polkit/libpolkit-gobject-1.la \ - $(EXPAT_LIBS) \ -- $(LIBJS_LIBS) \ -+ $(LIBJS_LIBS) \ - $(NULL) - -+if USE_DUKTAPE -+libpolkit_backend_1_la_SOURCES += polkitbackendduktapeauthority.c -+libpolkit_backend_1_la_LIBADD += -lm -+else -+libpolkit_backend_1_la_SOURCES += polkitbackendjsauthority.cpp -+endif -+ - rulesdir = $(sysconfdir)/polkit-1/rules.d - rules_DATA = 50-default.rules - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -new file mode 100644 -index 0000000..ae98453 ---- /dev/null -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -0,0 +1,1402 @@ -+/* -+ * Copyright (C) 2008-2012 Red Hat, Inc. -+ * Copyright (C) 2015 Tangent Space -+ * Copyright (C) 2019 Wu Xiaotian -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General -+ * Public License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, -+ * Boston, MA 02111-1307, USA. -+ * -+ * Author: David Zeuthen -+ */ -+ -+#include "config.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "polkitbackendjsauthority.h" -+ -+#include -+ -+#ifdef HAVE_LIBSYSTEMD -+#include -+#endif /* HAVE_LIBSYSTEMD */ -+ -+#include "initjs.h" /* init.js */ -+#include "duktape.h" -+ -+/** -+ * SECTION:polkitbackendjsauthority -+ * @title: PolkitBackendJsAuthority -+ * @short_description: JS Authority -+ * @stability: Unstable -+ * -+ * An implementation of #PolkitBackendAuthority that reads and -+ * evalates Javascript files and supports interaction with -+ * authentication agents (virtue of being based on -+ * #PolkitBackendInteractiveAuthority). -+ */ -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+struct _PolkitBackendJsAuthorityPrivate -+{ -+ gchar **rules_dirs; -+ GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */ -+ duk_context *cx; -+}; -+ -+#define WATCHDOG_TIMEOUT (15 * G_TIME_SPAN_SECOND) -+ -+static void utils_spawn (const gchar *const *argv, -+ guint timeout_seconds, -+ GCancellable *cancellable, -+ GAsyncReadyCallback callback, -+ gpointer user_data); -+ -+gboolean utils_spawn_finish (GAsyncResult *res, -+ gint *out_exit_status, -+ gchar **out_standard_output, -+ gchar **out_standard_error, -+ GError **error); -+ -+static void on_dir_monitor_changed (GFileMonitor *monitor, -+ GFile *file, -+ GFile *other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data); -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+enum -+{ -+ PROP_0, -+ PROP_RULES_DIRS, -+}; -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details); -+ -+static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync ( -+ PolkitBackendInteractiveAuthority *authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details, -+ PolkitImplicitAuthorization implicit); -+ -+G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY); -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static void -+polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) -+{ -+ authority->priv = G_TYPE_INSTANCE_GET_PRIVATE (authority, -+ POLKIT_BACKEND_TYPE_JS_AUTHORITY, -+ PolkitBackendJsAuthorityPrivate); -+} -+ -+static gint -+rules_file_name_cmp (const gchar *a, -+ const gchar *b) -+{ -+ gint ret; -+ const gchar *a_base; -+ const gchar *b_base; -+ -+ a_base = strrchr (a, '/'); -+ b_base = strrchr (b, '/'); -+ -+ g_assert (a_base != NULL); -+ g_assert (b_base != NULL); -+ a_base += 1; -+ b_base += 1; -+ -+ ret = g_strcmp0 (a_base, b_base); -+ if (ret == 0) -+ { -+ /* /etc wins over /usr */ -+ ret = g_strcmp0 (a, b); -+ g_assert (ret != 0); -+ } -+ -+ return ret; -+} -+ -+static void -+load_scripts (PolkitBackendJsAuthority *authority) -+{ -+ duk_context *cx = authority->priv->cx; -+ GList *files = NULL; -+ GList *l; -+ guint num_scripts = 0; -+ GError *error = NULL; -+ guint n; -+ -+ files = NULL; -+ -+ for (n = 0; authority->priv->rules_dirs != NULL && authority->priv->rules_dirs[n] != NULL; n++) -+ { -+ const gchar *dir_name = authority->priv->rules_dirs[n]; -+ GDir *dir = NULL; -+ -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Loading rules from directory %s", -+ dir_name); -+ -+ dir = g_dir_open (dir_name, -+ 0, -+ &error); -+ if (dir == NULL) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error opening rules directory: %s (%s, %d)", -+ error->message, g_quark_to_string (error->domain), error->code); -+ g_clear_error (&error); -+ } -+ else -+ { -+ const gchar *name; -+ while ((name = g_dir_read_name (dir)) != NULL) -+ { -+ if (g_str_has_suffix (name, ".rules")) -+ files = g_list_prepend (files, g_strdup_printf ("%s/%s", dir_name, name)); -+ } -+ g_dir_close (dir); -+ } -+ } -+ -+ files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp); -+ -+ for (l = files; l != NULL; l = l->next) -+ { -+ const gchar *filename = l->data; -+ -+#if (DUK_VERSION >= 20000) -+ gchar *contents; -+ gsize length; -+ GError *error = NULL; -+ if (!g_file_get_contents (filename, &contents, &length, &error)){ -+ g_warning("Error when file contents of %s: %s\n", filename, error->message); -+ g_error_free (error); -+ continue; -+ } -+ if (duk_peval_lstring_noresult(cx, contents,length) != 0) -+#else -+ if (duk_peval_file_noresult (cx, filename) != 0) -+#endif -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error compiling script %s: %s", -+ filename, duk_safe_to_string (authority->priv->cx, -1)); -+#if (DUK_VERSION >= 20000) -+ g_free (contents); -+#endif -+ continue; -+ } -+#if (DUK_VERSION >= 20000) -+ g_free (contents); -+#endif -+ num_scripts++; -+ } -+ -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Finished loading, compiling and executing %d rules", -+ num_scripts); -+ g_list_free_full (files, g_free); -+} -+ -+static void -+reload_scripts (PolkitBackendJsAuthority *authority) -+{ -+ duk_context *cx = authority->priv->cx; -+ -+ duk_set_top (cx, 0); -+ duk_get_global_string (cx, "polkit"); -+ duk_push_string (cx, "_deleteRules"); -+ -+ duk_call_prop (cx, 0, 0); -+ -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Collecting garbage unconditionally..."); -+ -+ load_scripts (authority); -+ -+ /* Let applications know we have new rules... */ -+ g_signal_emit_by_name (authority, "changed"); -+} -+ -+static void -+on_dir_monitor_changed (GFileMonitor *monitor, -+ GFile *file, -+ GFile *other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data); -+ -+ /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution? -+ * Because when editing a file with emacs we get 4-8 events.. -+ */ -+ -+ if (file != NULL) -+ { -+ gchar *name; -+ -+ name = g_file_get_basename (file); -+ -+ /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */ -+ if (!g_str_has_prefix (name, ".") && -+ !g_str_has_prefix (name, "#") && -+ g_str_has_suffix (name, ".rules") && -+ (event_type == G_FILE_MONITOR_EVENT_CREATED || -+ event_type == G_FILE_MONITOR_EVENT_DELETED || -+ event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Reloading rules"); -+ reload_scripts (authority); -+ } -+ g_free (name); -+ } -+} -+ -+ -+static void -+setup_file_monitors (PolkitBackendJsAuthority *authority) -+{ -+ guint n; -+ GPtrArray *p; -+ -+ p = g_ptr_array_new (); -+ for (n = 0; authority->priv->rules_dirs != NULL && authority->priv->rules_dirs[n] != NULL; n++) -+ { -+ GFile *file; -+ GError *error; -+ GFileMonitor *monitor; -+ -+ file = g_file_new_for_path (authority->priv->rules_dirs[n]); -+ error = NULL; -+ monitor = g_file_monitor_directory (file, -+ G_FILE_MONITOR_NONE, -+ NULL, -+ &error); -+ g_object_unref (file); -+ if (monitor == NULL) -+ { -+ g_warning ("Error monitoring directory %s: %s", -+ authority->priv->rules_dirs[n], -+ error->message); -+ g_clear_error (&error); -+ } -+ else -+ { -+ g_signal_connect (monitor, -+ "changed", -+ G_CALLBACK (on_dir_monitor_changed), -+ authority); -+ g_ptr_array_add (p, monitor); -+ } -+ } -+ g_ptr_array_add (p, NULL); -+ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE); -+} -+ -+static duk_ret_t js_polkit_log (duk_context *cx); -+static duk_ret_t js_polkit_spawn (duk_context *cx); -+static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx); -+ -+static const duk_function_list_entry js_polkit_functions[] = -+{ -+ { "log", js_polkit_log, 1 }, -+ { "spawn", js_polkit_spawn, 1 }, -+ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 }, -+ { NULL, NULL, 0 }, -+}; -+ -+static void -+polkit_backend_js_authority_constructed (GObject *object) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); -+ duk_context *cx; -+ -+ cx = duk_create_heap (NULL, NULL, NULL, authority, NULL); -+ if (cx == NULL) -+ goto fail; -+ -+ authority->priv->cx = cx; -+ -+ duk_push_global_object (cx); -+ duk_push_object (cx); -+ duk_put_function_list (cx, -1, js_polkit_functions); -+ duk_put_prop_string (cx, -2, "polkit"); -+ -+ duk_eval_string (cx, init_js); -+ -+ if (authority->priv->rules_dirs == NULL) -+ { -+ authority->priv->rules_dirs = g_new0 (gchar *, 3); -+ authority->priv->rules_dirs[0] = g_strdup (PACKAGE_SYSCONF_DIR "/polkit-1/rules.d"); -+ authority->priv->rules_dirs[1] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d"); -+ } -+ -+ setup_file_monitors (authority); -+ load_scripts (authority); -+ -+ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->constructed (object); -+ return; -+ -+ fail: -+ g_critical ("Error initializing JavaScript environment"); -+ g_assert_not_reached (); -+} -+ -+static void -+polkit_backend_js_authority_finalize (GObject *object) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); -+ guint n; -+ -+ for (n = 0; authority->priv->dir_monitors != NULL && authority->priv->dir_monitors[n] != NULL; n++) -+ { -+ GFileMonitor *monitor = authority->priv->dir_monitors[n]; -+ g_signal_handlers_disconnect_by_func (monitor, -+ G_CALLBACK (on_dir_monitor_changed), -+ authority); -+ g_object_unref (monitor); -+ } -+ g_free (authority->priv->dir_monitors); -+ g_strfreev (authority->priv->rules_dirs); -+ -+ duk_destroy_heap (authority->priv->cx); -+ -+ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object); -+} -+ -+static void -+polkit_backend_js_authority_set_property (GObject *object, -+ guint property_id, -+ const GValue *value, -+ GParamSpec *pspec) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); -+ -+ switch (property_id) -+ { -+ case PROP_RULES_DIRS: -+ g_assert (authority->priv->rules_dirs == NULL); -+ authority->priv->rules_dirs = (gchar **) g_value_dup_boxed (value); -+ break; -+ -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -+ break; -+ } -+} -+ -+static const gchar * -+polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority) -+{ -+ return "js"; -+} -+ -+static const gchar * -+polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority) -+{ -+ return PACKAGE_VERSION; -+} -+ -+static PolkitAuthorityFeatures -+polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority) -+{ -+ return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION; -+} -+ -+static void -+polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass) -+{ -+ GObjectClass *gobject_class; -+ PolkitBackendAuthorityClass *authority_class; -+ PolkitBackendInteractiveAuthorityClass *interactive_authority_class; -+ -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ gobject_class->finalize = polkit_backend_js_authority_finalize; -+ gobject_class->set_property = polkit_backend_js_authority_set_property; -+ gobject_class->constructed = polkit_backend_js_authority_constructed; -+ -+ authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass); -+ authority_class->get_name = polkit_backend_js_authority_get_name; -+ authority_class->get_version = polkit_backend_js_authority_get_version; -+ authority_class->get_features = polkit_backend_js_authority_get_features; -+ -+ interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass); -+ interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities; -+ interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync; -+ -+ g_object_class_install_property (gobject_class, -+ PROP_RULES_DIRS, -+ g_param_spec_boxed ("rules-dirs", -+ NULL, -+ NULL, -+ G_TYPE_STRV, -+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)); -+ -+ -+ g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate)); -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static void -+set_property_str (duk_context *cx, -+ const gchar *name, -+ const gchar *value) -+{ -+ duk_push_string (cx, value); -+ duk_put_prop_string (cx, -2, name); -+} -+ -+static void -+set_property_strv (duk_context *cx, -+ const gchar *name, -+ GPtrArray *value) -+{ -+ guint n; -+ duk_push_array (cx); -+ for (n = 0; n < value->len; n++) -+ { -+ duk_push_string (cx, g_ptr_array_index (value, n)); -+ duk_put_prop_index (cx, -2, n); -+ } -+ duk_put_prop_string (cx, -2, name); -+} -+ -+static void -+set_property_int32 (duk_context *cx, -+ const gchar *name, -+ gint32 value) -+{ -+ duk_push_int (cx, value); -+ duk_put_prop_string (cx, -2, name); -+} -+ -+static void -+set_property_bool (duk_context *cx, -+ const char *name, -+ gboolean value) -+{ -+ duk_push_boolean (cx, value); -+ duk_put_prop_string (cx, -2, name); -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static gboolean -+push_subject (duk_context *cx, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ GError **error) -+{ -+ gboolean ret = FALSE; -+ pid_t pid; -+ uid_t uid; -+ gchar *user_name = NULL; -+ GPtrArray *groups = NULL; -+ struct passwd *passwd; -+ char *seat_str = NULL; -+ char *session_str = NULL; -+ -+ duk_get_global_string (cx, "Subject"); -+ duk_new (cx, 0); -+ -+ if (POLKIT_IS_UNIX_PROCESS (subject)) -+ { -+ pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject)); -+ } -+ else if (POLKIT_IS_SYSTEM_BUS_NAME (subject)) -+ { -+ PolkitSubject *process; -+ process = polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, error); -+ if (process == NULL) -+ goto out; -+ pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (process)); -+ g_object_unref (process); -+ } -+ else -+ { -+ g_assert_not_reached (); -+ } -+ -+#ifdef HAVE_LIBSYSTEMD -+ if (sd_pid_get_session (pid, &session_str) == 0) -+ { -+ if (sd_session_get_seat (session_str, &seat_str) == 0) -+ { -+ /* do nothing */ -+ } -+ } -+#endif /* HAVE_LIBSYSTEMD */ -+ -+ g_assert (POLKIT_IS_UNIX_USER (user_for_subject)); -+ uid = polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_for_subject)); -+ -+ groups = g_ptr_array_new_with_free_func (g_free); -+ -+ passwd = getpwuid (uid); -+ if (passwd == NULL) -+ { -+ user_name = g_strdup_printf ("%d", (gint) uid); -+ g_warning ("Error looking up info for uid %d: %m", (gint) uid); -+ } -+ else -+ { -+ gid_t gids[512]; -+ int num_gids = 512; -+ -+ user_name = g_strdup (passwd->pw_name); -+ -+ if (getgrouplist (passwd->pw_name, -+ passwd->pw_gid, -+ gids, -+ &num_gids) < 0) -+ { -+ g_warning ("Error looking up groups for uid %d: %m", (gint) uid); -+ } -+ else -+ { -+ gint n; -+ for (n = 0; n < num_gids; n++) -+ { -+ struct group *group; -+ group = getgrgid (gids[n]); -+ if (group == NULL) -+ { -+ g_ptr_array_add (groups, g_strdup_printf ("%d", (gint) gids[n])); -+ } -+ else -+ { -+ g_ptr_array_add (groups, g_strdup (group->gr_name)); -+ } -+ } -+ } -+ } -+ -+ set_property_int32 (cx, "pid", pid); -+ set_property_str (cx, "user", user_name); -+ set_property_strv (cx, "groups", groups); -+ set_property_str (cx, "seat", seat_str); -+ set_property_str (cx, "session", session_str); -+ set_property_bool (cx, "local", subject_is_local); -+ set_property_bool (cx, "active", subject_is_active); -+ -+ ret = TRUE; -+ -+ out: -+ free (session_str); -+ free (seat_str); -+ g_free (user_name); -+ if (groups != NULL) -+ g_ptr_array_unref (groups); -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static gboolean -+push_action_and_details (duk_context *cx, -+ const gchar *action_id, -+ PolkitDetails *details, -+ GError **error) -+{ -+ gchar **keys; -+ guint n; -+ -+ duk_get_global_string (cx, "Action"); -+ duk_new (cx, 0); -+ -+ set_property_str (cx, "id", action_id); -+ -+ keys = polkit_details_get_keys (details); -+ for (n = 0; keys != NULL && keys[n] != NULL; n++) -+ { -+ gchar *key; -+ const gchar *value; -+ key = g_strdup_printf ("_detail_%s", keys[n]); -+ value = polkit_details_lookup (details, keys[n]); -+ set_property_str (cx, key, value); -+ g_free (key); -+ } -+ g_strfreev (keys); -+ -+ return TRUE; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static GList * -+polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); -+ GList *ret = NULL; -+ guint n; -+ GError *error = NULL; -+ const char *ret_str = NULL; -+ gchar **ret_strs = NULL; -+ duk_context *cx = authority->priv->cx; -+ -+ duk_set_top (cx, 0); -+ duk_get_global_string (cx, "polkit"); -+ duk_push_string (cx, "_runAdminRules"); -+ -+ if (!push_action_and_details (cx, action_id, details, &error)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error converting action and details to JS object: %s", -+ error->message); -+ g_clear_error (&error); -+ goto out; -+ } -+ -+ if (!push_subject (cx, subject, user_for_subject, subject_is_local, subject_is_active, &error)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error converting subject to JS object: %s", -+ error->message); -+ g_clear_error (&error); -+ goto out; -+ } -+ -+ if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error evaluating admin rules: ", -+ duk_safe_to_string (cx, -1)); -+ goto out; -+ } -+ -+ ret_str = duk_require_string (cx, -1); -+ -+ ret_strs = g_strsplit (ret_str, ",", -1); -+ for (n = 0; ret_strs != NULL && ret_strs[n] != NULL; n++) -+ { -+ const gchar *identity_str = ret_strs[n]; -+ PolkitIdentity *identity; -+ -+ error = NULL; -+ identity = polkit_identity_from_string (identity_str, &error); -+ if (identity == NULL) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Identity `%s' is not valid, ignoring: %s", -+ identity_str, error->message); -+ g_clear_error (&error); -+ } -+ else -+ { -+ ret = g_list_prepend (ret, identity); -+ } -+ } -+ ret = g_list_reverse (ret); -+ -+ out: -+ g_strfreev (ret_strs); -+ /* fallback to root password auth */ -+ if (ret == NULL) -+ ret = g_list_prepend (ret, polkit_unix_user_new (0)); -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static PolkitImplicitAuthorization -+polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details, -+ PolkitImplicitAuthorization implicit) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); -+ PolkitImplicitAuthorization ret = implicit; -+ GError *error = NULL; -+ gchar *ret_str = NULL; -+ gboolean good = FALSE; -+ duk_context *cx = authority->priv->cx; -+ -+ duk_set_top (cx, 0); -+ duk_get_global_string (cx, "polkit"); -+ duk_push_string (cx, "_runRules"); -+ -+ if (!push_action_and_details (cx, action_id, details, &error)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error converting action and details to JS object: %s", -+ error->message); -+ g_clear_error (&error); -+ goto out; -+ } -+ -+ if (!push_subject (cx, subject, user_for_subject, subject_is_local, subject_is_active, &error)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error converting subject to JS object: %s", -+ error->message); -+ g_clear_error (&error); -+ goto out; -+ } -+ -+ if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error evaluating authorization rules: ", -+ duk_safe_to_string (cx, -1)); -+ goto out; -+ } -+ -+ if (duk_is_null(cx, -1)) { -+ good = TRUE; -+ goto out; -+ } -+ ret_str = g_strdup (duk_require_string (cx, -1)); -+ if (!polkit_implicit_authorization_from_string (ret_str, &ret)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Returned result `%s' is not valid", -+ ret_str); -+ goto out; -+ } -+ -+ good = TRUE; -+ -+ out: -+ if (!good) -+ ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED; -+ g_free (ret_str); -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static duk_ret_t -+js_polkit_log (duk_context *cx) -+{ -+ const char *str = duk_require_string (cx, 0); -+ fprintf (stderr, "%s\n", str); -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+static const gchar * -+get_signal_name (gint signal_number) -+{ -+ switch (signal_number) -+ { -+#define _HANDLE_SIG(sig) case sig: return #sig; -+ _HANDLE_SIG (SIGHUP); -+ _HANDLE_SIG (SIGINT); -+ _HANDLE_SIG (SIGQUIT); -+ _HANDLE_SIG (SIGILL); -+ _HANDLE_SIG (SIGABRT); -+ _HANDLE_SIG (SIGFPE); -+ _HANDLE_SIG (SIGKILL); -+ _HANDLE_SIG (SIGSEGV); -+ _HANDLE_SIG (SIGPIPE); -+ _HANDLE_SIG (SIGALRM); -+ _HANDLE_SIG (SIGTERM); -+ _HANDLE_SIG (SIGUSR1); -+ _HANDLE_SIG (SIGUSR2); -+ _HANDLE_SIG (SIGCHLD); -+ _HANDLE_SIG (SIGCONT); -+ _HANDLE_SIG (SIGSTOP); -+ _HANDLE_SIG (SIGTSTP); -+ _HANDLE_SIG (SIGTTIN); -+ _HANDLE_SIG (SIGTTOU); -+ _HANDLE_SIG (SIGBUS); -+#ifdef SIGPOLL -+ _HANDLE_SIG (SIGPOLL); -+#endif -+ _HANDLE_SIG (SIGPROF); -+ _HANDLE_SIG (SIGSYS); -+ _HANDLE_SIG (SIGTRAP); -+ _HANDLE_SIG (SIGURG); -+ _HANDLE_SIG (SIGVTALRM); -+ _HANDLE_SIG (SIGXCPU); -+ _HANDLE_SIG (SIGXFSZ); -+#undef _HANDLE_SIG -+ default: -+ break; -+ } -+ return "UNKNOWN_SIGNAL"; -+} -+ -+typedef struct -+{ -+ GMainLoop *loop; -+ GAsyncResult *res; -+} SpawnData; -+ -+static void -+spawn_cb (GObject *source_object, -+ GAsyncResult *res, -+ gpointer user_data) -+{ -+ SpawnData *data = user_data; -+ data->res = g_object_ref (res); -+ g_main_loop_quit (data->loop); -+} -+ -+static duk_ret_t -+js_polkit_spawn (duk_context *cx) -+{ -+#if (DUK_VERSION >= 20000) -+ duk_ret_t ret = DUK_RET_ERROR; -+#else -+ duk_ret_t ret = DUK_RET_INTERNAL_ERROR; -+#endif -+ gchar *standard_output = NULL; -+ gchar *standard_error = NULL; -+ gint exit_status; -+ GError *error = NULL; -+ guint32 array_len; -+ gchar **argv = NULL; -+ GMainContext *context = NULL; -+ GMainLoop *loop = NULL; -+ SpawnData data = {0}; -+ char *err_str = NULL; -+ guint n; -+ -+ if (!duk_is_array (cx, 0)) -+ goto out; -+ -+ array_len = duk_get_length (cx, 0); -+ -+ argv = g_new0 (gchar*, array_len + 1); -+ for (n = 0; n < array_len; n++) -+ { -+ duk_get_prop_index (cx, 0, n); -+ argv[n] = g_strdup (duk_to_string (cx, -1)); -+ duk_pop (cx); -+ } -+ -+ context = g_main_context_new (); -+ loop = g_main_loop_new (context, FALSE); -+ -+ g_main_context_push_thread_default (context); -+ -+ data.loop = loop; -+ utils_spawn ((const gchar *const *) argv, -+ 10, /* timeout_seconds */ -+ NULL, /* cancellable */ -+ spawn_cb, -+ &data); -+ -+ g_main_loop_run (loop); -+ -+ g_main_context_pop_thread_default (context); -+ -+ if (!utils_spawn_finish (data.res, -+ &exit_status, -+ &standard_output, -+ &standard_error, -+ &error)) -+ { -+ err_str = g_strdup_printf ("Error spawning helper: %s (%s, %d)", -+ error->message, g_quark_to_string (error->domain), error->code); -+ g_clear_error (&error); -+ goto out; -+ } -+ -+ if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0)) -+ { -+ GString *gstr; -+ gstr = g_string_new (NULL); -+ if (WIFEXITED (exit_status)) -+ { -+ g_string_append_printf (gstr, -+ "Helper exited with non-zero exit status %d", -+ WEXITSTATUS (exit_status)); -+ } -+ else if (WIFSIGNALED (exit_status)) -+ { -+ g_string_append_printf (gstr, -+ "Helper was signaled with signal %s (%d)", -+ get_signal_name (WTERMSIG (exit_status)), -+ WTERMSIG (exit_status)); -+ } -+ g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'", -+ standard_output, standard_error); -+ err_str = g_string_free (gstr, FALSE); -+ goto out; -+ } -+ -+ duk_push_string (cx, standard_output); -+ ret = 1; -+ -+ out: -+ g_strfreev (argv); -+ g_free (standard_output); -+ g_free (standard_error); -+ g_clear_object (&data.res); -+ if (loop != NULL) -+ g_main_loop_unref (loop); -+ if (context != NULL) -+ g_main_context_unref (context); -+ -+ if (err_str) -+ duk_error (cx, DUK_ERR_ERROR, err_str); -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+ -+static duk_ret_t -+js_polkit_user_is_in_netgroup (duk_context *cx) -+{ -+ const char *user; -+ const char *netgroup; -+ gboolean is_in_netgroup = FALSE; -+ -+ user = duk_require_string (cx, 0); -+ netgroup = duk_require_string (cx, 1); -+ -+ if (innetgr (netgroup, -+ NULL, /* host */ -+ user, -+ NULL)) /* domain */ -+ { -+ is_in_netgroup = TRUE; -+ } -+ -+ duk_push_boolean (cx, is_in_netgroup); -+ return 1; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -+ -+typedef struct -+{ -+ GSimpleAsyncResult *simple; /* borrowed reference */ -+ GMainContext *main_context; /* may be NULL */ -+ -+ GCancellable *cancellable; /* may be NULL */ -+ gulong cancellable_handler_id; -+ -+ GPid child_pid; -+ gint child_stdout_fd; -+ gint child_stderr_fd; -+ -+ GIOChannel *child_stdout_channel; -+ GIOChannel *child_stderr_channel; -+ -+ GSource *child_watch_source; -+ GSource *child_stdout_source; -+ GSource *child_stderr_source; -+ -+ guint timeout_seconds; -+ gboolean timed_out; -+ GSource *timeout_source; -+ -+ GString *child_stdout; -+ GString *child_stderr; -+ -+ gint exit_status; -+} UtilsSpawnData; -+ -+static void -+utils_child_watch_from_release_cb (GPid pid, -+ gint status, -+ gpointer user_data) -+{ -+} -+ -+static void -+utils_spawn_data_free (UtilsSpawnData *data) -+{ -+ if (data->timeout_source != NULL) -+ { -+ g_source_destroy (data->timeout_source); -+ data->timeout_source = NULL; -+ } -+ -+ /* Nuke the child, if necessary */ -+ if (data->child_watch_source != NULL) -+ { -+ g_source_destroy (data->child_watch_source); -+ data->child_watch_source = NULL; -+ } -+ -+ if (data->child_pid != 0) -+ { -+ GSource *source; -+ kill (data->child_pid, SIGTERM); -+ /* OK, we need to reap for the child ourselves - we don't want -+ * to use waitpid() because that might block the calling -+ * thread (the child might handle SIGTERM and use several -+ * seconds for cleanup/rollback). -+ * -+ * So we use GChildWatch instead. -+ * -+ * Avoid taking a references to ourselves. but note that we need -+ * to pass the GSource so we can nuke it once handled. -+ */ -+ source = g_child_watch_source_new (data->child_pid); -+ g_source_set_callback (source, -+ (GSourceFunc) utils_child_watch_from_release_cb, -+ source, -+ (GDestroyNotify) g_source_destroy); -+ g_source_attach (source, data->main_context); -+ g_source_unref (source); -+ data->child_pid = 0; -+ } -+ -+ if (data->child_stdout != NULL) -+ { -+ g_string_free (data->child_stdout, TRUE); -+ data->child_stdout = NULL; -+ } -+ -+ if (data->child_stderr != NULL) -+ { -+ g_string_free (data->child_stderr, TRUE); -+ data->child_stderr = NULL; -+ } -+ -+ if (data->child_stdout_channel != NULL) -+ { -+ g_io_channel_unref (data->child_stdout_channel); -+ data->child_stdout_channel = NULL; -+ } -+ if (data->child_stderr_channel != NULL) -+ { -+ g_io_channel_unref (data->child_stderr_channel); -+ data->child_stderr_channel = NULL; -+ } -+ -+ if (data->child_stdout_source != NULL) -+ { -+ g_source_destroy (data->child_stdout_source); -+ data->child_stdout_source = NULL; -+ } -+ if (data->child_stderr_source != NULL) -+ { -+ g_source_destroy (data->child_stderr_source); -+ data->child_stderr_source = NULL; -+ } -+ -+ if (data->child_stdout_fd != -1) -+ { -+ g_warn_if_fail (close (data->child_stdout_fd) == 0); -+ data->child_stdout_fd = -1; -+ } -+ if (data->child_stderr_fd != -1) -+ { -+ g_warn_if_fail (close (data->child_stderr_fd) == 0); -+ data->child_stderr_fd = -1; -+ } -+ -+ if (data->cancellable_handler_id > 0) -+ { -+ g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id); -+ data->cancellable_handler_id = 0; -+ } -+ -+ if (data->main_context != NULL) -+ g_main_context_unref (data->main_context); -+ -+ if (data->cancellable != NULL) -+ g_object_unref (data->cancellable); -+ -+ g_slice_free (UtilsSpawnData, data); -+} -+ -+/* called in the thread where @cancellable was cancelled */ -+static void -+utils_on_cancelled (GCancellable *cancellable, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = user_data; -+ GError *error; -+ -+ error = NULL; -+ g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error)); -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+} -+ -+static gboolean -+utils_read_child_stderr (GIOChannel *channel, -+ GIOCondition condition, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = user_data; -+ gchar buf[1024]; -+ gsize bytes_read; -+ -+ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -+ g_string_append_len (data->child_stderr, buf, bytes_read); -+ return TRUE; -+} -+ -+static gboolean -+utils_read_child_stdout (GIOChannel *channel, -+ GIOCondition condition, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = user_data; -+ gchar buf[1024]; -+ gsize bytes_read; -+ -+ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -+ g_string_append_len (data->child_stdout, buf, bytes_read); -+ return TRUE; -+} -+ -+static void -+utils_child_watch_cb (GPid pid, -+ gint status, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = user_data; -+ gchar *buf; -+ gsize buf_size; -+ -+ if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -+ { -+ g_string_append_len (data->child_stdout, buf, buf_size); -+ g_free (buf); -+ } -+ if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -+ { -+ g_string_append_len (data->child_stderr, buf, buf_size); -+ g_free (buf); -+ } -+ -+ data->exit_status = status; -+ -+ /* ok, child watch is history, make sure we don't free it in spawn_data_free() */ -+ data->child_pid = 0; -+ data->child_watch_source = NULL; -+ -+ /* we're done */ -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+} -+ -+static gboolean -+utils_timeout_cb (gpointer user_data) -+{ -+ UtilsSpawnData *data = user_data; -+ -+ data->timed_out = TRUE; -+ -+ /* ok, timeout is history, make sure we don't free it in spawn_data_free() */ -+ data->timeout_source = NULL; -+ -+ /* we're done */ -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ -+ return FALSE; /* remove source */ -+} -+ -+static void -+utils_spawn (const gchar *const *argv, -+ guint timeout_seconds, -+ GCancellable *cancellable, -+ GAsyncReadyCallback callback, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data; -+ GError *error; -+ -+ data = g_slice_new0 (UtilsSpawnData); -+ data->timeout_seconds = timeout_seconds; -+ data->simple = g_simple_async_result_new (NULL, -+ callback, -+ user_data, -+ utils_spawn); -+ data->main_context = g_main_context_get_thread_default (); -+ if (data->main_context != NULL) -+ g_main_context_ref (data->main_context); -+ -+ data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; -+ -+ data->child_stdout = g_string_new (NULL); -+ data->child_stderr = g_string_new (NULL); -+ data->child_stdout_fd = -1; -+ data->child_stderr_fd = -1; -+ -+ /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */ -+ g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free); -+ -+ error = NULL; -+ if (data->cancellable != NULL) -+ { -+ /* could already be cancelled */ -+ error = NULL; -+ if (g_cancellable_set_error_if_cancelled (data->cancellable, &error)) -+ { -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ goto out; -+ } -+ -+ data->cancellable_handler_id = g_cancellable_connect (data->cancellable, -+ G_CALLBACK (utils_on_cancelled), -+ data, -+ NULL); -+ } -+ -+ error = NULL; -+ if (!g_spawn_async_with_pipes (NULL, /* working directory */ -+ (gchar **) argv, -+ NULL, /* envp */ -+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, -+ NULL, /* child_setup */ -+ NULL, /* child_setup's user_data */ -+ &(data->child_pid), -+ NULL, /* gint *stdin_fd */ -+ &(data->child_stdout_fd), -+ &(data->child_stderr_fd), -+ &error)) -+ { -+ g_prefix_error (&error, "Error spawning: "); -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ goto out; -+ } -+ -+ if (timeout_seconds > 0) -+ { -+ data->timeout_source = g_timeout_source_new_seconds (timeout_seconds); -+ g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT); -+ g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL); -+ g_source_attach (data->timeout_source, data->main_context); -+ g_source_unref (data->timeout_source); -+ } -+ -+ data->child_watch_source = g_child_watch_source_new (data->child_pid); -+ g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL); -+ g_source_attach (data->child_watch_source, data->main_context); -+ g_source_unref (data->child_watch_source); -+ -+ data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd); -+ g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL); -+ data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN); -+ g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL); -+ g_source_attach (data->child_stdout_source, data->main_context); -+ g_source_unref (data->child_stdout_source); -+ -+ data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd); -+ g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL); -+ data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN); -+ g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL); -+ g_source_attach (data->child_stderr_source, data->main_context); -+ g_source_unref (data->child_stderr_source); -+ -+ out: -+ ; -+} -+ -+gboolean -+utils_spawn_finish (GAsyncResult *res, -+ gint *out_exit_status, -+ gchar **out_standard_output, -+ gchar **out_standard_error, -+ GError **error) -+{ -+ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); -+ UtilsSpawnData *data; -+ gboolean ret = FALSE; -+ -+ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE); -+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -+ -+ g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn); -+ -+ if (g_simple_async_result_propagate_error (simple, error)) -+ goto out; -+ -+ data = g_simple_async_result_get_op_res_gpointer (simple); -+ -+ if (data->timed_out) -+ { -+ g_set_error (error, -+ G_IO_ERROR, -+ G_IO_ERROR_TIMED_OUT, -+ "Timed out after %d seconds", -+ data->timeout_seconds); -+ goto out; -+ } -+ -+ if (out_exit_status != NULL) -+ *out_exit_status = data->exit_status; -+ -+ if (out_standard_output != NULL) -+ *out_standard_output = g_strdup (data->child_stdout->str); -+ -+ if (out_standard_error != NULL) -+ *out_standard_error = g_strdup (data->child_stderr->str); -+ -+ ret = TRUE; -+ -+ out: -+ return ret; -+} --- -GitLab - - -From d74aad8152a7c51999fffa9abe28e4306a052399 Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 13:15:17 +0800 -Subject: [PATCH 02/16] check netgroup.h header file - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index ae98453..543d6fd 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -26,7 +26,11 @@ - #include - #include - #include -+#ifdef HAVE_NETGROUP_H -+#include -+#else - #include -+#endif - #include - #include - #include --- -GitLab - - -From 69c761506cbe458807e4ae2742c9e05bc60dad3d Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 10:59:03 +0800 -Subject: [PATCH 03/16] check return value - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 543d6fd..a54ed5b 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -249,7 +249,11 @@ reload_scripts (PolkitBackendJsAuthority *authority) - duk_context *cx = authority->priv->cx; - - duk_set_top (cx, 0); -- duk_get_global_string (cx, "polkit"); -+ if (!duk_get_global_string (cx, "polkit")) { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error deleting old rules, not loading new ones"); -+ return; -+ } - duk_push_string (cx, "_deleteRules"); - - duk_call_prop (cx, 0, 0); --- -GitLab - - -From f1536c4899934fd3c8243fda2d084a472fe57d2e Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 11:22:39 +0800 -Subject: [PATCH 04/16] check return value - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index a54ed5b..1a7e6d3 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -656,7 +656,10 @@ push_action_and_details (duk_context *cx, - gchar **keys; - guint n; - -- duk_get_global_string (cx, "Action"); -+ if (!duk_get_global_string (cx, "Action")) { -+ return FALSE; -+ } -+ - duk_new (cx, 0); - - set_property_str (cx, "id", action_id); -@@ -699,7 +702,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA - duk_context *cx = authority->priv->cx; - - duk_set_top (cx, 0); -- duk_get_global_string (cx, "polkit"); -+ if (!duk_get_global_string (cx, "polkit")) { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error deleting old rules, not loading new ones"); -+ goto out; -+ } -+ - duk_push_string (cx, "_runAdminRules"); - - if (!push_action_and_details (cx, action_id, details, &error)) --- -GitLab - - -From ca15eecf5dc7755947515c1bfc651fd8770aaf8f Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 13:17:16 +0800 -Subject: [PATCH 05/16] check return value - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 1a7e6d3..3f1b32d 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -550,7 +550,10 @@ push_subject (duk_context *cx, - char *seat_str = NULL; - char *session_str = NULL; - -- duk_get_global_string (cx, "Subject"); -+ if (!duk_get_global_string (cx, "Subject")) { -+ return FALSE; -+ } -+ - duk_new (cx, 0); - - if (POLKIT_IS_UNIX_PROCESS (subject)) -@@ -789,8 +792,11 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu - gboolean good = FALSE; - duk_context *cx = authority->priv->cx; - -+ if (!duk_get_global_string (cx, "polkit")) { -+ goto out; -+ } -+ - duk_set_top (cx, 0); -- duk_get_global_string (cx, "polkit"); - duk_push_string (cx, "_runRules"); - - if (!push_action_and_details (cx, action_id, details, &error)) --- -GitLab - - -From 870348365cc0166e14f28e0d144ed552bba4d794 Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 13:18:13 +0800 -Subject: [PATCH 06/16] check return value - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 3f1b32d..6294ad9 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -843,7 +843,8 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu - out: - if (!good) - ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED; -- g_free (ret_str); -+ if (ret_str != NULL) -+ g_free (ret_str); - - return ret; - } --- -GitLab - - -From 81c916ff08fdcee3c7340c4b2d4632086b89666c Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 11:23:04 +0800 -Subject: [PATCH 07/16] fix typecase - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 6294ad9..d466c9d 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -1191,7 +1191,7 @@ static void - utils_on_cancelled (GCancellable *cancellable, - gpointer user_data) - { -- UtilsSpawnData *data = user_data; -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; - GError *error; - - error = NULL; -@@ -1206,7 +1206,7 @@ utils_read_child_stderr (GIOChannel *channel, - GIOCondition condition, - gpointer user_data) - { -- UtilsSpawnData *data = user_data; -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; - gchar buf[1024]; - gsize bytes_read; - -@@ -1220,7 +1220,7 @@ utils_read_child_stdout (GIOChannel *channel, - GIOCondition condition, - gpointer user_data) - { -- UtilsSpawnData *data = user_data; -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; - gchar buf[1024]; - gsize bytes_read; - -@@ -1234,7 +1234,7 @@ utils_child_watch_cb (GPid pid, - gint status, - gpointer user_data) - { -- UtilsSpawnData *data = user_data; -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; - gchar *buf; - gsize buf_size; - -@@ -1263,7 +1263,7 @@ utils_child_watch_cb (GPid pid, - static gboolean - utils_timeout_cb (gpointer user_data) - { -- UtilsSpawnData *data = user_data; -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; - - data->timed_out = TRUE; - --- -GitLab - - -From acb956bf52f0a78bf7aaf925876f96e97a146995 Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 18:04:27 +0800 -Subject: [PATCH 08/16] typecase - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index d466c9d..237b1ad 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -915,8 +915,8 @@ spawn_cb (GObject *source_object, - GAsyncResult *res, - gpointer user_data) - { -- SpawnData *data = user_data; -- data->res = g_object_ref (res); -+ SpawnData *data = (SpawnData *)user_data; -+ data->res = (GAsyncResult*)g_object_ref (res); - g_main_loop_quit (data->loop); - } - -@@ -1292,12 +1292,12 @@ utils_spawn (const gchar *const *argv, - data->simple = g_simple_async_result_new (NULL, - callback, - user_data, -- utils_spawn); -+ (gpointer*)utils_spawn); - data->main_context = g_main_context_get_thread_default (); - if (data->main_context != NULL) - g_main_context_ref (data->main_context); - -- data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; -+ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL; - - data->child_stdout = g_string_new (NULL); - data->child_stderr = g_string_new (NULL); -@@ -1397,7 +1397,7 @@ utils_spawn_finish (GAsyncResult *res, - if (g_simple_async_result_propagate_error (simple, error)) - goto out; - -- data = g_simple_async_result_get_op_res_gpointer (simple); -+ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple); - - if (data->timed_out) - { --- -GitLab - - -From be060e4d48aceb09af34868b555b6c73c7afdabb Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 13:53:23 +0800 -Subject: [PATCH 09/16] some change - -Signed-off-by: Gustavo Lima Chaves ---- - .../polkitbackendduktapeauthority.c | 26 +++++++++++-------- - 1 file changed, 15 insertions(+), 11 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 237b1ad..fad9017 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -207,18 +207,22 @@ load_scripts (PolkitBackendJsAuthority *authority) - - for (l = files; l != NULL; l = l->next) - { -- const gchar *filename = l->data; -- -+ const gchar *filename = (gchar *)l->data; - #if (DUK_VERSION >= 20000) -- gchar *contents; -- gsize length; -- GError *error = NULL; -- if (!g_file_get_contents (filename, &contents, &length, &error)){ -- g_warning("Error when file contents of %s: %s\n", filename, error->message); -- g_error_free (error); -- continue; -- } -- if (duk_peval_lstring_noresult(cx, contents,length) != 0) -+ GFile *file = g_file_new_for_path (filename); -+ char *contents; -+ gsize len; -+ if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Error compiling script %s", -+ filename); -+ g_object_unref (file); -+ continue; -+ } -+ -+ g_object_unref (file); -+ if (duk_peval_lstring_noresult(cx, contents,len) != 0) - #else - if (duk_peval_file_noresult (cx, filename) != 0) - #endif --- -GitLab - - -From 2ffb62048a5ebedfe3bb053feb7385c7270ede28 Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 15:25:45 +0800 -Subject: [PATCH 10/16] some change - -Signed-off-by: Gustavo Lima Chaves ---- - .../polkitbackendduktapeauthority.c | 24 +++++++++---------- - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index fad9017..6fac3be 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -125,6 +125,18 @@ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BAC - - /* ---------------------------------------------------------------------------------------------------- */ - -+static duk_ret_t js_polkit_log (duk_context *cx); -+static duk_ret_t js_polkit_spawn (duk_context *cx); -+static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx); -+ -+static const duk_function_list_entry js_polkit_functions[] = -+{ -+ { "log", js_polkit_log, 1 }, -+ { "spawn", js_polkit_spawn, 1 }, -+ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 }, -+ { NULL, NULL, 0 }, -+}; -+ - static void - polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) - { -@@ -347,18 +359,6 @@ setup_file_monitors (PolkitBackendJsAuthority *authority) - authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE); - } - --static duk_ret_t js_polkit_log (duk_context *cx); --static duk_ret_t js_polkit_spawn (duk_context *cx); --static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx); -- --static const duk_function_list_entry js_polkit_functions[] = --{ -- { "log", js_polkit_log, 1 }, -- { "spawn", js_polkit_spawn, 1 }, -- { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 }, -- { NULL, NULL, 0 }, --}; -- - static void - polkit_backend_js_authority_constructed (GObject *object) - { --- -GitLab - - -From edb70ef69eed3275f5654510d135e680eb46c85d Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 15:25:35 +0800 -Subject: [PATCH 11/16] remove WATCHDOG_TIMEOUT define - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 6fac3be..51e03fd 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -69,7 +69,6 @@ struct _PolkitBackendJsAuthorityPrivate - duk_context *cx; - }; - --#define WATCHDOG_TIMEOUT (15 * G_TIME_SPAN_SECOND) - - static void utils_spawn (const gchar *const *argv, - guint timeout_seconds, --- -GitLab - - -From 906ae404f29f15ef8c529b999bf091b5d18ed7ac Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 12:46:40 +0800 -Subject: [PATCH 12/16] add meson build system support - -Signed-off-by: Gustavo Lima Chaves ---- - meson.build | 11 ++++++++++- - meson_options.txt | 1 + - src/polkitbackend/meson.build | 10 ++++++++-- - 3 files changed, 19 insertions(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 858078d..4e44723 100644 ---- a/meson.build -+++ b/meson.build -@@ -133,7 +133,13 @@ expat_dep = dependency('expat') - assert(cc.has_header('expat.h', dependencies: expat_dep), 'Can\'t find expat.h. Please install expat.') - assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t find expat library. Please install expat.') - --mozjs_dep = dependency('mozjs-78') -+js_engine = get_option('js_engine') -+if js_engine == 'duktape' -+ js_dep = dependency('duktape') -+ libm_dep = cc.find_library('m') -+elif js_engine == 'mozjs' -+ js_dep = dependency('mozjs-78') -+endif - - dbus_dep = dependency('dbus-1', required: false) - dbus_policydir = pk_prefix / pk_datadir / 'dbus-1/system.d' -@@ -361,6 +367,9 @@ if enable_logind - output += ' systemdsystemunitdir: ' + systemd_systemdsystemunitdir + '\n' - endif - output += ' polkitd user: ' + polkitd_user + ' \n' -+output += ' Javascript engine: ' + js_engine + '\n' -+if enable_logind -+endif - output += ' PAM support: ' + enable_pam.to_string() + '\n\n' - if enable_pam - output += ' PAM file auth: ' + pam_conf['PAM_FILE_INCLUDE_AUTH'] + '\n' -diff --git a/meson_options.txt b/meson_options.txt -index 25e3e77..76aa311 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -16,3 +16,4 @@ option('introspection', type: 'boolean', value: true, description: 'Enable intro - - option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation') - option('man', type: 'boolean', value: false, description: 'build manual pages') -+option('js_engine', type: 'combo', choices: ['mozjs', 'duktape'], value: 'duktape', description: 'javascript engine') -diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build -index 64f0e4a..489897d 100644 ---- a/src/polkitbackend/meson.build -+++ b/src/polkitbackend/meson.build -@@ -5,7 +5,6 @@ sources = files( - 'polkitbackendactionpool.c', - 'polkitbackendauthority.c', - 'polkitbackendinteractiveauthority.c', -- 'polkitbackendjsauthority.cpp', - ) - - output = 'initjs.h' -@@ -21,7 +20,7 @@ sources += custom_target( - deps = [ - expat_dep, - libpolkit_gobject_dep, -- mozjs_dep, -+ js_dep, - ] - - c_flags = [ -@@ -31,6 +30,13 @@ c_flags = [ - '-DPACKAGE_SYSCONF_DIR="@0@"'.format(pk_prefix / pk_sysconfdir), - ] - -+if js_engine == 'duktape' -+ sources += files('polkitbackendduktapeauthority.c') -+ deps += libm_dep -+elif js_engine == 'mozjs' -+ sources += files('polkitbackendjsauthority.cpp') -+endif -+ - if enable_logind - sources += files('polkitbackendsessionmonitor-systemd.c') - --- -GitLab - - -From 1380b505c25be4aebe54b1b4223a570d64af83cc Mon Sep 17 00:00:00 2001 -From: Wu Xiaotian -Date: Sun, 22 Nov 2020 18:49:14 +0800 -Subject: [PATCH 13/16] fix run error - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/polkitbackendduktapeauthority.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 51e03fd..4b4f8fd 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -795,11 +795,11 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu - gboolean good = FALSE; - duk_context *cx = authority->priv->cx; - -+ duk_set_top (cx, 0); - if (!duk_get_global_string (cx, "polkit")) { - goto out; - } - -- duk_set_top (cx, 0); - duk_push_string (cx, "_runRules"); - - if (!push_action_and_details (cx, action_id, details, &error)) --- -GitLab - - -From 6856a704b70378948ef5f66e9b09555d97d4070b Mon Sep 17 00:00:00 2001 -From: Gustavo Lima Chaves -Date: Fri, 10 Sep 2021 15:17:58 -0700 -Subject: [PATCH 14/16] Deduplicate code for "Add duktape as JS engine backend" - effort/MR - -This leverages Wu Xiaotian (@yetist)'s original MR -(https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35), in -an effort to complete said work. - -This is the first of the requests from maintainers--to reduce -eliminate code duplication. - -The runaway-killer missing functionality will come in the sequence. - -Signed-off-by: Gustavo Lima Chaves ---- - src/polkitbackend/Makefile.am | 1 + - src/polkitbackend/meson.build | 1 + - src/polkitbackend/polkitbackendcommon.c | 530 +++++++++++++ - src/polkitbackend/polkitbackendcommon.h | 156 ++++ - .../polkitbackendduktapeauthority.c | 714 ++---------------- - .../polkitbackendjsauthority.cpp | 711 ++--------------- - 6 files changed, 790 insertions(+), 1323 deletions(-) - create mode 100644 src/polkitbackend/polkitbackendcommon.c - create mode 100644 src/polkitbackend/polkitbackendcommon.h - -diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am -index abcbc6f..6a8b4ae 100644 ---- a/src/polkitbackend/Makefile.am -+++ b/src/polkitbackend/Makefile.am -@@ -31,6 +31,7 @@ libpolkit_backend_1_la_SOURCES = \ - polkitbackend.h \ - polkitbackendtypes.h \ - polkitbackendprivate.h \ -+ polkitbackendcommon.h polkitbackendcommon.c \ - polkitbackendauthority.h polkitbackendauthority.c \ - polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \ - polkitbackendjsauthority.h \ -diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build -index 489897d..9ec01b2 100644 ---- a/src/polkitbackend/meson.build -+++ b/src/polkitbackend/meson.build -@@ -4,6 +4,7 @@ sources = files( - 'polkitbackendactionlookup.c', - 'polkitbackendactionpool.c', - 'polkitbackendauthority.c', -+ 'polkitbackendcommon.c', - 'polkitbackendinteractiveauthority.c', - ) - -diff --git a/src/polkitbackend/polkitbackendcommon.c b/src/polkitbackend/polkitbackendcommon.c -new file mode 100644 -index 0000000..6783dff ---- /dev/null -+++ b/src/polkitbackend/polkitbackendcommon.c -@@ -0,0 +1,530 @@ -+/* -+ * Copyright (C) 2008 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General -+ * Public License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, -+ * Boston, MA 02111-1307, USA. -+ * -+ * Author: David Zeuthen -+ */ -+ -+#include "polkitbackendcommon.h" -+ -+static void -+utils_child_watch_from_release_cb (GPid pid, -+ gint status, -+ gpointer user_data) -+{ -+} -+ -+static void -+utils_spawn_data_free (UtilsSpawnData *data) -+{ -+ if (data->timeout_source != NULL) -+ { -+ g_source_destroy (data->timeout_source); -+ data->timeout_source = NULL; -+ } -+ -+ /* Nuke the child, if necessary */ -+ if (data->child_watch_source != NULL) -+ { -+ g_source_destroy (data->child_watch_source); -+ data->child_watch_source = NULL; -+ } -+ -+ if (data->child_pid != 0) -+ { -+ GSource *source; -+ kill (data->child_pid, SIGTERM); -+ /* OK, we need to reap for the child ourselves - we don't want -+ * to use waitpid() because that might block the calling -+ * thread (the child might handle SIGTERM and use several -+ * seconds for cleanup/rollback). -+ * -+ * So we use GChildWatch instead. -+ * -+ * Avoid taking a references to ourselves. but note that we need -+ * to pass the GSource so we can nuke it once handled. -+ */ -+ source = g_child_watch_source_new (data->child_pid); -+ g_source_set_callback (source, -+ (GSourceFunc) utils_child_watch_from_release_cb, -+ source, -+ (GDestroyNotify) g_source_destroy); -+ g_source_attach (source, data->main_context); -+ g_source_unref (source); -+ data->child_pid = 0; -+ } -+ -+ if (data->child_stdout != NULL) -+ { -+ g_string_free (data->child_stdout, TRUE); -+ data->child_stdout = NULL; -+ } -+ -+ if (data->child_stderr != NULL) -+ { -+ g_string_free (data->child_stderr, TRUE); -+ data->child_stderr = NULL; -+ } -+ -+ if (data->child_stdout_channel != NULL) -+ { -+ g_io_channel_unref (data->child_stdout_channel); -+ data->child_stdout_channel = NULL; -+ } -+ if (data->child_stderr_channel != NULL) -+ { -+ g_io_channel_unref (data->child_stderr_channel); -+ data->child_stderr_channel = NULL; -+ } -+ -+ if (data->child_stdout_source != NULL) -+ { -+ g_source_destroy (data->child_stdout_source); -+ data->child_stdout_source = NULL; -+ } -+ if (data->child_stderr_source != NULL) -+ { -+ g_source_destroy (data->child_stderr_source); -+ data->child_stderr_source = NULL; -+ } -+ -+ if (data->child_stdout_fd != -1) -+ { -+ g_warn_if_fail (close (data->child_stdout_fd) == 0); -+ data->child_stdout_fd = -1; -+ } -+ if (data->child_stderr_fd != -1) -+ { -+ g_warn_if_fail (close (data->child_stderr_fd) == 0); -+ data->child_stderr_fd = -1; -+ } -+ -+ if (data->cancellable_handler_id > 0) -+ { -+ g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id); -+ data->cancellable_handler_id = 0; -+ } -+ -+ if (data->main_context != NULL) -+ g_main_context_unref (data->main_context); -+ -+ if (data->cancellable != NULL) -+ g_object_unref (data->cancellable); -+ -+ g_slice_free (UtilsSpawnData, data); -+} -+ -+/* called in the thread where @cancellable was cancelled */ -+static void -+utils_on_cancelled (GCancellable *cancellable, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; -+ GError *error; -+ -+ error = NULL; -+ g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error)); -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+} -+ -+static gboolean -+utils_timeout_cb (gpointer user_data) -+{ -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; -+ -+ data->timed_out = TRUE; -+ -+ /* ok, timeout is history, make sure we don't free it in spawn_data_free() */ -+ data->timeout_source = NULL; -+ -+ /* we're done */ -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ -+ return FALSE; /* remove source */ -+} -+ -+static void -+utils_child_watch_cb (GPid pid, -+ gint status, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; -+ gchar *buf; -+ gsize buf_size; -+ -+ if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -+ { -+ g_string_append_len (data->child_stdout, buf, buf_size); -+ g_free (buf); -+ } -+ if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -+ { -+ g_string_append_len (data->child_stderr, buf, buf_size); -+ g_free (buf); -+ } -+ -+ data->exit_status = status; -+ -+ /* ok, child watch is history, make sure we don't free it in spawn_data_free() */ -+ data->child_pid = 0; -+ data->child_watch_source = NULL; -+ -+ /* we're done */ -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+} -+ -+static gboolean -+utils_read_child_stderr (GIOChannel *channel, -+ GIOCondition condition, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; -+ gchar buf[1024]; -+ gsize bytes_read; -+ -+ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -+ g_string_append_len (data->child_stderr, buf, bytes_read); -+ return TRUE; -+} -+ -+static gboolean -+utils_read_child_stdout (GIOChannel *channel, -+ GIOCondition condition, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data = (UtilsSpawnData *)user_data; -+ gchar buf[1024]; -+ gsize bytes_read; -+ -+ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -+ g_string_append_len (data->child_stdout, buf, bytes_read); -+ return TRUE; -+} -+ -+void -+polkit_backend_common_spawn (const gchar *const *argv, -+ guint timeout_seconds, -+ GCancellable *cancellable, -+ GAsyncReadyCallback callback, -+ gpointer user_data) -+{ -+ UtilsSpawnData *data; -+ GError *error; -+ -+ data = g_slice_new0 (UtilsSpawnData); -+ data->timeout_seconds = timeout_seconds; -+ data->simple = g_simple_async_result_new (NULL, -+ callback, -+ user_data, -+ (gpointer*)polkit_backend_common_spawn); -+ data->main_context = g_main_context_get_thread_default (); -+ if (data->main_context != NULL) -+ g_main_context_ref (data->main_context); -+ -+ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL; -+ -+ data->child_stdout = g_string_new (NULL); -+ data->child_stderr = g_string_new (NULL); -+ data->child_stdout_fd = -1; -+ data->child_stderr_fd = -1; -+ -+ /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */ -+ g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free); -+ -+ error = NULL; -+ if (data->cancellable != NULL) -+ { -+ /* could already be cancelled */ -+ error = NULL; -+ if (g_cancellable_set_error_if_cancelled (data->cancellable, &error)) -+ { -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ goto out; -+ } -+ -+ data->cancellable_handler_id = g_cancellable_connect (data->cancellable, -+ G_CALLBACK (utils_on_cancelled), -+ data, -+ NULL); -+ } -+ -+ error = NULL; -+ if (!g_spawn_async_with_pipes (NULL, /* working directory */ -+ (gchar **) argv, -+ NULL, /* envp */ -+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, -+ NULL, /* child_setup */ -+ NULL, /* child_setup's user_data */ -+ &(data->child_pid), -+ NULL, /* gint *stdin_fd */ -+ &(data->child_stdout_fd), -+ &(data->child_stderr_fd), -+ &error)) -+ { -+ g_prefix_error (&error, "Error spawning: "); -+ g_simple_async_result_take_error (data->simple, error); -+ g_simple_async_result_complete_in_idle (data->simple); -+ g_object_unref (data->simple); -+ goto out; -+ } -+ -+ if (timeout_seconds > 0) -+ { -+ data->timeout_source = g_timeout_source_new_seconds (timeout_seconds); -+ g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT); -+ g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL); -+ g_source_attach (data->timeout_source, data->main_context); -+ g_source_unref (data->timeout_source); -+ } -+ -+ data->child_watch_source = g_child_watch_source_new (data->child_pid); -+ g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL); -+ g_source_attach (data->child_watch_source, data->main_context); -+ g_source_unref (data->child_watch_source); -+ -+ data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd); -+ g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL); -+ data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN); -+ g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL); -+ g_source_attach (data->child_stdout_source, data->main_context); -+ g_source_unref (data->child_stdout_source); -+ -+ data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd); -+ g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL); -+ data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN); -+ g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL); -+ g_source_attach (data->child_stderr_source, data->main_context); -+ g_source_unref (data->child_stderr_source); -+ -+ out: -+ ; -+} -+ -+void -+polkit_backend_common_on_dir_monitor_changed (GFileMonitor *monitor, -+ GFile *file, -+ GFile *other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data) -+{ -+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data); -+ -+ /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution? -+ * Because when editing a file with emacs we get 4-8 events.. -+ */ -+ -+ if (file != NULL) -+ { -+ gchar *name; -+ -+ name = g_file_get_basename (file); -+ -+ /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */ -+ if (!g_str_has_prefix (name, ".") && -+ !g_str_has_prefix (name, "#") && -+ g_str_has_suffix (name, ".rules") && -+ (event_type == G_FILE_MONITOR_EVENT_CREATED || -+ event_type == G_FILE_MONITOR_EVENT_DELETED || -+ event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "Reloading rules"); -+ polkit_backend_common_reload_scripts (authority); -+ } -+ g_free (name); -+ } -+} -+ -+gboolean -+polkit_backend_common_spawn_finish (GAsyncResult *res, -+ gint *out_exit_status, -+ gchar **out_standard_output, -+ gchar **out_standard_error, -+ GError **error) -+{ -+ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); -+ UtilsSpawnData *data; -+ gboolean ret = FALSE; -+ -+ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE); -+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -+ -+ g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_backend_common_spawn); -+ -+ if (g_simple_async_result_propagate_error (simple, error)) -+ goto out; -+ -+ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple); -+ -+ if (data->timed_out) -+ { -+ g_set_error (error, -+ G_IO_ERROR, -+ G_IO_ERROR_TIMED_OUT, -+ "Timed out after %d seconds", -+ data->timeout_seconds); -+ goto out; -+ } -+ -+ if (out_exit_status != NULL) -+ *out_exit_status = data->exit_status; -+ -+ if (out_standard_output != NULL) -+ *out_standard_output = g_strdup (data->child_stdout->str); -+ -+ if (out_standard_error != NULL) -+ *out_standard_error = g_strdup (data->child_stderr->str); -+ -+ ret = TRUE; -+ -+ out: -+ return ret; -+} -+ -+static const gchar * -+polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority) -+{ -+ return "js"; -+} -+ -+static const gchar * -+polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority) -+{ -+ return PACKAGE_VERSION; -+} -+ -+static PolkitAuthorityFeatures -+polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority) -+{ -+ return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION; -+} -+ -+void -+polkit_backend_common_js_authority_class_init_common (PolkitBackendJsAuthorityClass *klass) -+{ -+ GObjectClass *gobject_class; -+ PolkitBackendAuthorityClass *authority_class; -+ PolkitBackendInteractiveAuthorityClass *interactive_authority_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ gobject_class->finalize = polkit_backend_common_js_authority_finalize; -+ gobject_class->set_property = polkit_backend_common_js_authority_set_property; -+ gobject_class->constructed = polkit_backend_common_js_authority_constructed; -+ -+ authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass); -+ authority_class->get_name = polkit_backend_js_authority_get_name; -+ authority_class->get_version = polkit_backend_js_authority_get_version; -+ authority_class->get_features = polkit_backend_js_authority_get_features; -+ -+ interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass); -+ interactive_authority_class->get_admin_identities = polkit_backend_common_js_authority_get_admin_auth_identities; -+ interactive_authority_class->check_authorization_sync = polkit_backend_common_js_authority_check_authorization_sync; -+ -+ g_object_class_install_property (gobject_class, -+ PROP_RULES_DIRS, -+ g_param_spec_boxed ("rules-dirs", -+ NULL, -+ NULL, -+ G_TYPE_STRV, -+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)); -+} -+ -+gint -+polkit_backend_common_rules_file_name_cmp (const gchar *a, -+ const gchar *b) -+{ -+ gint ret; -+ const gchar *a_base; -+ const gchar *b_base; -+ -+ a_base = strrchr (a, '/'); -+ b_base = strrchr (b, '/'); -+ -+ g_assert (a_base != NULL); -+ g_assert (b_base != NULL); -+ a_base += 1; -+ b_base += 1; -+ -+ ret = g_strcmp0 (a_base, b_base); -+ if (ret == 0) -+ { -+ /* /etc wins over /usr */ -+ ret = g_strcmp0 (a, b); -+ g_assert (ret != 0); -+ } -+ -+ return ret; -+} -+ -+const gchar * -+polkit_backend_common_get_signal_name (gint signal_number) -+{ -+ switch (signal_number) -+ { -+#define _HANDLE_SIG(sig) case sig: return #sig; -+ _HANDLE_SIG (SIGHUP); -+ _HANDLE_SIG (SIGINT); -+ _HANDLE_SIG (SIGQUIT); -+ _HANDLE_SIG (SIGILL); -+ _HANDLE_SIG (SIGABRT); -+ _HANDLE_SIG (SIGFPE); -+ _HANDLE_SIG (SIGKILL); -+ _HANDLE_SIG (SIGSEGV); -+ _HANDLE_SIG (SIGPIPE); -+ _HANDLE_SIG (SIGALRM); -+ _HANDLE_SIG (SIGTERM); -+ _HANDLE_SIG (SIGUSR1); -+ _HANDLE_SIG (SIGUSR2); -+ _HANDLE_SIG (SIGCHLD); -+ _HANDLE_SIG (SIGCONT); -+ _HANDLE_SIG (SIGSTOP); -+ _HANDLE_SIG (SIGTSTP); -+ _HANDLE_SIG (SIGTTIN); -+ _HANDLE_SIG (SIGTTOU); -+ _HANDLE_SIG (SIGBUS); -+#ifdef SIGPOLL -+ _HANDLE_SIG (SIGPOLL); -+#endif -+ _HANDLE_SIG (SIGPROF); -+ _HANDLE_SIG (SIGSYS); -+ _HANDLE_SIG (SIGTRAP); -+ _HANDLE_SIG (SIGURG); -+ _HANDLE_SIG (SIGVTALRM); -+ _HANDLE_SIG (SIGXCPU); -+ _HANDLE_SIG (SIGXFSZ); -+#undef _HANDLE_SIG -+ default: -+ break; -+ } -+ return "UNKNOWN_SIGNAL"; -+} -+ -+void -+polkit_backend_common_spawn_cb (GObject *source_object, -+ GAsyncResult *res, -+ gpointer user_data) -+{ -+ SpawnData *data = (SpawnData *)user_data; -+ data->res = (GAsyncResult*)g_object_ref (res); -+ g_main_loop_quit (data->loop); -+} -diff --git a/src/polkitbackend/polkitbackendcommon.h b/src/polkitbackend/polkitbackendcommon.h -new file mode 100644 -index 0000000..6d0d267 ---- /dev/null -+++ b/src/polkitbackend/polkitbackendcommon.h -@@ -0,0 +1,156 @@ -+/* -+ * Copyright (C) 2008 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General -+ * Public License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, -+ * Boston, MA 02111-1307, USA. -+ * -+ * Author: David Zeuthen -+ */ -+ -+#if !defined (_POLKIT_BACKEND_COMPILATION) && !defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H) -+#error "Only can be included directly, this file may disappear or change contents." -+#endif -+ -+#ifndef __POLKIT_BACKEND_COMMON_H -+#define __POLKIT_BACKEND_COMMON_H -+ -+#include "config.h" -+#include -+#include -+#include -+#include -+#ifdef HAVE_NETGROUP_H -+#include -+#else -+#include -+#endif -+#include -+#include -+#include -+#include //here, all things glib via glib.h (including -> gspawn.h) -+ -+#include -+#include "polkitbackendjsauthority.h" -+ -+#include -+ -+#ifdef HAVE_LIBSYSTEMD -+#include -+#endif /* HAVE_LIBSYSTEMD */ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+enum -+{ -+ PROP_0, -+ PROP_RULES_DIRS, -+}; -+ -+typedef struct -+{ -+ GSimpleAsyncResult *simple; /* borrowed reference */ -+ GMainContext *main_context; /* may be NULL */ -+ -+ GCancellable *cancellable; /* may be NULL */ -+ gulong cancellable_handler_id; -+ -+ GPid child_pid; -+ gint child_stdout_fd; -+ gint child_stderr_fd; -+ -+ GIOChannel *child_stdout_channel; -+ GIOChannel *child_stderr_channel; -+ -+ GSource *child_watch_source; -+ GSource *child_stdout_source; -+ GSource *child_stderr_source; -+ -+ guint timeout_seconds; -+ gboolean timed_out; -+ GSource *timeout_source; -+ -+ GString *child_stdout; -+ GString *child_stderr; -+ -+ gint exit_status; -+} UtilsSpawnData; -+ -+typedef struct -+{ -+ GMainLoop *loop; -+ GAsyncResult *res; -+} SpawnData; -+ -+void polkit_backend_common_spawn (const gchar *const *argv, -+ guint timeout_seconds, -+ GCancellable *cancellable, -+ GAsyncReadyCallback callback, -+ gpointer user_data); -+void polkit_backend_common_spawn_cb (GObject *source_object, -+ GAsyncResult *res, -+ gpointer user_data); -+gboolean polkit_backend_common_spawn_finish (GAsyncResult *res, -+ gint *out_exit_status, -+ gchar **out_standard_output, -+ gchar **out_standard_error, -+ GError **error); -+ -+void polkit_backend_common_on_dir_monitor_changed (GFileMonitor *monitor, -+ GFile *file, -+ GFile *other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data); -+ -+void polkit_backend_common_js_authority_class_init_common (PolkitBackendJsAuthorityClass *klass); -+ -+gint polkit_backend_common_rules_file_name_cmp (const gchar *a, -+ const gchar *b); -+ -+const gchar *polkit_backend_common_get_signal_name (gint signal_number); -+ -+/* To be provided by each JS backend, from here onwards ---------------------------------------------- */ -+ -+void polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority); -+void polkit_backend_common_js_authority_finalize (GObject *object); -+void polkit_backend_common_js_authority_constructed (GObject *object); -+GList *polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details); -+void polkit_backend_common_js_authority_set_property (GObject *object, -+ guint property_id, -+ const GValue *value, -+ GParamSpec *pspec); -+PolkitImplicitAuthorization polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details, -+ PolkitImplicitAuthorization implicit); -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __POLKIT_BACKEND_COMMON_H */ -+ -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index 4b4f8fd..a2b4420 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -21,32 +21,12 @@ - * Author: David Zeuthen - */ - --#include "config.h" --#include --#include --#include --#include --#ifdef HAVE_NETGROUP_H --#include --#else --#include --#endif --#include --#include --#include --#include -- --#include --#include "polkitbackendjsauthority.h" -- --#include -+#include "polkitbackendcommon.h" - --#ifdef HAVE_LIBSYSTEMD --#include --#endif /* HAVE_LIBSYSTEMD */ -+#include "duktape.h" - -+/* Built source and not too big to worry about deduplication */ - #include "initjs.h" /* init.js */ --#include "duktape.h" - - /** - * SECTION:polkitbackendjsauthority -@@ -54,10 +34,9 @@ - * @short_description: JS Authority - * @stability: Unstable - * -- * An implementation of #PolkitBackendAuthority that reads and -- * evalates Javascript files and supports interaction with -- * authentication agents (virtue of being based on -- * #PolkitBackendInteractiveAuthority). -+ * An (Duktape-based) implementation of #PolkitBackendAuthority that reads and -+ * evaluates Javascript files and supports interaction with authentication -+ * agents (virtue of being based on #PolkitBackendInteractiveAuthority). - */ - - /* ---------------------------------------------------------------------------------------------------- */ -@@ -66,64 +45,16 @@ struct _PolkitBackendJsAuthorityPrivate - { - gchar **rules_dirs; - GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */ -- duk_context *cx; --}; -- -- --static void utils_spawn (const gchar *const *argv, -- guint timeout_seconds, -- GCancellable *cancellable, -- GAsyncReadyCallback callback, -- gpointer user_data); -- --gboolean utils_spawn_finish (GAsyncResult *res, -- gint *out_exit_status, -- gchar **out_standard_output, -- gchar **out_standard_error, -- GError **error); - --static void on_dir_monitor_changed (GFileMonitor *monitor, -- GFile *file, -- GFile *other_file, -- GFileMonitorEvent event_type, -- gpointer user_data); -- --/* ---------------------------------------------------------------------------------------------------- */ -- --enum --{ -- PROP_0, -- PROP_RULES_DIRS, -+ duk_context *cx; - }; - - /* ---------------------------------------------------------------------------------------------------- */ - --static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details); -- --static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync ( -- PolkitBackendInteractiveAuthority *authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details, -- PolkitImplicitAuthorization implicit); -- - G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY); - - /* ---------------------------------------------------------------------------------------------------- */ - --/* ---------------------------------------------------------------------------------------------------- */ -- - static duk_ret_t js_polkit_log (duk_context *cx); - static duk_ret_t js_polkit_spawn (duk_context *cx); - static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx); -@@ -144,33 +75,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) - PolkitBackendJsAuthorityPrivate); - } - --static gint --rules_file_name_cmp (const gchar *a, -- const gchar *b) --{ -- gint ret; -- const gchar *a_base; -- const gchar *b_base; -- -- a_base = strrchr (a, '/'); -- b_base = strrchr (b, '/'); -- -- g_assert (a_base != NULL); -- g_assert (b_base != NULL); -- a_base += 1; -- b_base += 1; -- -- ret = g_strcmp0 (a_base, b_base); -- if (ret == 0) -- { -- /* /etc wins over /usr */ -- ret = g_strcmp0 (a, b); -- g_assert (ret != 0); -- } -- -- return ret; --} -- - static void - load_scripts (PolkitBackendJsAuthority *authority) - { -@@ -214,7 +118,7 @@ load_scripts (PolkitBackendJsAuthority *authority) - } - } - -- files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp); -+ files = g_list_sort (files, (GCompareFunc) polkit_backend_common_rules_file_name_cmp); - - for (l = files; l != NULL; l = l->next) - { -@@ -258,8 +162,8 @@ load_scripts (PolkitBackendJsAuthority *authority) - g_list_free_full (files, g_free); - } - --static void --reload_scripts (PolkitBackendJsAuthority *authority) -+void -+polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority) - { - duk_context *cx = authority->priv->cx; - -@@ -282,42 +186,6 @@ reload_scripts (PolkitBackendJsAuthority *authority) - g_signal_emit_by_name (authority, "changed"); - } - --static void --on_dir_monitor_changed (GFileMonitor *monitor, -- GFile *file, -- GFile *other_file, -- GFileMonitorEvent event_type, -- gpointer user_data) --{ -- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data); -- -- /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution? -- * Because when editing a file with emacs we get 4-8 events.. -- */ -- -- if (file != NULL) -- { -- gchar *name; -- -- name = g_file_get_basename (file); -- -- /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */ -- if (!g_str_has_prefix (name, ".") && -- !g_str_has_prefix (name, "#") && -- g_str_has_suffix (name, ".rules") && -- (event_type == G_FILE_MONITOR_EVENT_CREATED || -- event_type == G_FILE_MONITOR_EVENT_DELETED || -- event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)) -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Reloading rules"); -- reload_scripts (authority); -- } -- g_free (name); -- } --} -- -- - static void - setup_file_monitors (PolkitBackendJsAuthority *authority) - { -@@ -349,7 +217,7 @@ setup_file_monitors (PolkitBackendJsAuthority *authority) - { - g_signal_connect (monitor, - "changed", -- G_CALLBACK (on_dir_monitor_changed), -+ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed), - authority); - g_ptr_array_add (p, monitor); - } -@@ -358,8 +226,8 @@ setup_file_monitors (PolkitBackendJsAuthority *authority) - authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE); - } - --static void --polkit_backend_js_authority_constructed (GObject *object) -+void -+polkit_backend_common_js_authority_constructed (GObject *object) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - duk_context *cx; -@@ -395,8 +263,8 @@ polkit_backend_js_authority_constructed (GObject *object) - g_assert_not_reached (); - } - --static void --polkit_backend_js_authority_finalize (GObject *object) -+void -+polkit_backend_common_js_authority_finalize (GObject *object) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - guint n; -@@ -405,7 +273,7 @@ polkit_backend_js_authority_finalize (GObject *object) - { - GFileMonitor *monitor = authority->priv->dir_monitors[n]; - g_signal_handlers_disconnect_by_func (monitor, -- G_CALLBACK (on_dir_monitor_changed), -+ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed), - authority); - g_object_unref (monitor); - } -@@ -417,11 +285,11 @@ polkit_backend_js_authority_finalize (GObject *object) - G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object); - } - --static void --polkit_backend_js_authority_set_property (GObject *object, -- guint property_id, -- const GValue *value, -- GParamSpec *pspec) -+void -+polkit_backend_common_js_authority_set_property (GObject *object, -+ guint property_id, -+ const GValue *value, -+ GParamSpec *pspec) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - -@@ -438,55 +306,10 @@ polkit_backend_js_authority_set_property (GObject *object, - } - } - --static const gchar * --polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority) --{ -- return "js"; --} -- --static const gchar * --polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority) --{ -- return PACKAGE_VERSION; --} -- --static PolkitAuthorityFeatures --polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority) --{ -- return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION; --} -- - static void - polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass) - { -- GObjectClass *gobject_class; -- PolkitBackendAuthorityClass *authority_class; -- PolkitBackendInteractiveAuthorityClass *interactive_authority_class; -- -- -- gobject_class = G_OBJECT_CLASS (klass); -- gobject_class->finalize = polkit_backend_js_authority_finalize; -- gobject_class->set_property = polkit_backend_js_authority_set_property; -- gobject_class->constructed = polkit_backend_js_authority_constructed; -- -- authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass); -- authority_class->get_name = polkit_backend_js_authority_get_name; -- authority_class->get_version = polkit_backend_js_authority_get_version; -- authority_class->get_features = polkit_backend_js_authority_get_features; -- -- interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass); -- interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities; -- interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync; -- -- g_object_class_install_property (gobject_class, -- PROP_RULES_DIRS, -- g_param_spec_boxed ("rules-dirs", -- NULL, -- NULL, -- G_TYPE_STRV, -- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)); -- -- -+ polkit_backend_common_js_authority_class_init_common (klass); - g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate)); - } - -@@ -689,15 +512,15 @@ push_action_and_details (duk_context *cx, - - /* ---------------------------------------------------------------------------------------------------- */ - --static GList * --polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details) -+GList * -+polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); - GList *ret = NULL; -@@ -777,16 +600,16 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA - - /* ---------------------------------------------------------------------------------------------------- */ - --static PolkitImplicitAuthorization --polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details, -- PolkitImplicitAuthorization implicit) -+PolkitImplicitAuthorization -+polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details, -+ PolkitImplicitAuthorization implicit) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); - PolkitImplicitAuthorization ret = implicit; -@@ -864,65 +687,6 @@ js_polkit_log (duk_context *cx) - - /* ---------------------------------------------------------------------------------------------------- */ - --static const gchar * --get_signal_name (gint signal_number) --{ -- switch (signal_number) -- { --#define _HANDLE_SIG(sig) case sig: return #sig; -- _HANDLE_SIG (SIGHUP); -- _HANDLE_SIG (SIGINT); -- _HANDLE_SIG (SIGQUIT); -- _HANDLE_SIG (SIGILL); -- _HANDLE_SIG (SIGABRT); -- _HANDLE_SIG (SIGFPE); -- _HANDLE_SIG (SIGKILL); -- _HANDLE_SIG (SIGSEGV); -- _HANDLE_SIG (SIGPIPE); -- _HANDLE_SIG (SIGALRM); -- _HANDLE_SIG (SIGTERM); -- _HANDLE_SIG (SIGUSR1); -- _HANDLE_SIG (SIGUSR2); -- _HANDLE_SIG (SIGCHLD); -- _HANDLE_SIG (SIGCONT); -- _HANDLE_SIG (SIGSTOP); -- _HANDLE_SIG (SIGTSTP); -- _HANDLE_SIG (SIGTTIN); -- _HANDLE_SIG (SIGTTOU); -- _HANDLE_SIG (SIGBUS); --#ifdef SIGPOLL -- _HANDLE_SIG (SIGPOLL); --#endif -- _HANDLE_SIG (SIGPROF); -- _HANDLE_SIG (SIGSYS); -- _HANDLE_SIG (SIGTRAP); -- _HANDLE_SIG (SIGURG); -- _HANDLE_SIG (SIGVTALRM); -- _HANDLE_SIG (SIGXCPU); -- _HANDLE_SIG (SIGXFSZ); --#undef _HANDLE_SIG -- default: -- break; -- } -- return "UNKNOWN_SIGNAL"; --} -- --typedef struct --{ -- GMainLoop *loop; -- GAsyncResult *res; --} SpawnData; -- --static void --spawn_cb (GObject *source_object, -- GAsyncResult *res, -- gpointer user_data) --{ -- SpawnData *data = (SpawnData *)user_data; -- data->res = (GAsyncResult*)g_object_ref (res); -- g_main_loop_quit (data->loop); --} -- - static duk_ret_t - js_polkit_spawn (duk_context *cx) - { -@@ -962,21 +726,21 @@ js_polkit_spawn (duk_context *cx) - g_main_context_push_thread_default (context); - - data.loop = loop; -- utils_spawn ((const gchar *const *) argv, -- 10, /* timeout_seconds */ -- NULL, /* cancellable */ -- spawn_cb, -- &data); -+ polkit_backend_common_spawn ((const gchar *const *) argv, -+ 10, /* timeout_seconds */ -+ NULL, /* cancellable */ -+ polkit_backend_common_spawn_cb, -+ &data); - - g_main_loop_run (loop); - - g_main_context_pop_thread_default (context); - -- if (!utils_spawn_finish (data.res, -- &exit_status, -- &standard_output, -- &standard_error, -- &error)) -+ if (!polkit_backend_common_spawn_finish (data.res, -+ &exit_status, -+ &standard_output, -+ &standard_error, -+ &error)) - { - err_str = g_strdup_printf ("Error spawning helper: %s (%s, %d)", - error->message, g_quark_to_string (error->domain), error->code); -@@ -998,7 +762,7 @@ js_polkit_spawn (duk_context *cx) - { - g_string_append_printf (gstr, - "Helper was signaled with signal %s (%d)", -- get_signal_name (WTERMSIG (exit_status)), -+ polkit_backend_common_get_signal_name (WTERMSIG (exit_status)), - WTERMSIG (exit_status)); - } - g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'", -@@ -1052,377 +816,3 @@ js_polkit_user_is_in_netgroup (duk_context *cx) - } - - /* ---------------------------------------------------------------------------------------------------- */ -- --typedef struct --{ -- GSimpleAsyncResult *simple; /* borrowed reference */ -- GMainContext *main_context; /* may be NULL */ -- -- GCancellable *cancellable; /* may be NULL */ -- gulong cancellable_handler_id; -- -- GPid child_pid; -- gint child_stdout_fd; -- gint child_stderr_fd; -- -- GIOChannel *child_stdout_channel; -- GIOChannel *child_stderr_channel; -- -- GSource *child_watch_source; -- GSource *child_stdout_source; -- GSource *child_stderr_source; -- -- guint timeout_seconds; -- gboolean timed_out; -- GSource *timeout_source; -- -- GString *child_stdout; -- GString *child_stderr; -- -- gint exit_status; --} UtilsSpawnData; -- --static void --utils_child_watch_from_release_cb (GPid pid, -- gint status, -- gpointer user_data) --{ --} -- --static void --utils_spawn_data_free (UtilsSpawnData *data) --{ -- if (data->timeout_source != NULL) -- { -- g_source_destroy (data->timeout_source); -- data->timeout_source = NULL; -- } -- -- /* Nuke the child, if necessary */ -- if (data->child_watch_source != NULL) -- { -- g_source_destroy (data->child_watch_source); -- data->child_watch_source = NULL; -- } -- -- if (data->child_pid != 0) -- { -- GSource *source; -- kill (data->child_pid, SIGTERM); -- /* OK, we need to reap for the child ourselves - we don't want -- * to use waitpid() because that might block the calling -- * thread (the child might handle SIGTERM and use several -- * seconds for cleanup/rollback). -- * -- * So we use GChildWatch instead. -- * -- * Avoid taking a references to ourselves. but note that we need -- * to pass the GSource so we can nuke it once handled. -- */ -- source = g_child_watch_source_new (data->child_pid); -- g_source_set_callback (source, -- (GSourceFunc) utils_child_watch_from_release_cb, -- source, -- (GDestroyNotify) g_source_destroy); -- g_source_attach (source, data->main_context); -- g_source_unref (source); -- data->child_pid = 0; -- } -- -- if (data->child_stdout != NULL) -- { -- g_string_free (data->child_stdout, TRUE); -- data->child_stdout = NULL; -- } -- -- if (data->child_stderr != NULL) -- { -- g_string_free (data->child_stderr, TRUE); -- data->child_stderr = NULL; -- } -- -- if (data->child_stdout_channel != NULL) -- { -- g_io_channel_unref (data->child_stdout_channel); -- data->child_stdout_channel = NULL; -- } -- if (data->child_stderr_channel != NULL) -- { -- g_io_channel_unref (data->child_stderr_channel); -- data->child_stderr_channel = NULL; -- } -- -- if (data->child_stdout_source != NULL) -- { -- g_source_destroy (data->child_stdout_source); -- data->child_stdout_source = NULL; -- } -- if (data->child_stderr_source != NULL) -- { -- g_source_destroy (data->child_stderr_source); -- data->child_stderr_source = NULL; -- } -- -- if (data->child_stdout_fd != -1) -- { -- g_warn_if_fail (close (data->child_stdout_fd) == 0); -- data->child_stdout_fd = -1; -- } -- if (data->child_stderr_fd != -1) -- { -- g_warn_if_fail (close (data->child_stderr_fd) == 0); -- data->child_stderr_fd = -1; -- } -- -- if (data->cancellable_handler_id > 0) -- { -- g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id); -- data->cancellable_handler_id = 0; -- } -- -- if (data->main_context != NULL) -- g_main_context_unref (data->main_context); -- -- if (data->cancellable != NULL) -- g_object_unref (data->cancellable); -- -- g_slice_free (UtilsSpawnData, data); --} -- --/* called in the thread where @cancellable was cancelled */ --static void --utils_on_cancelled (GCancellable *cancellable, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- GError *error; -- -- error = NULL; -- g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error)); -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); --} -- --static gboolean --utils_read_child_stderr (GIOChannel *channel, -- GIOCondition condition, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar buf[1024]; -- gsize bytes_read; -- -- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -- g_string_append_len (data->child_stderr, buf, bytes_read); -- return TRUE; --} -- --static gboolean --utils_read_child_stdout (GIOChannel *channel, -- GIOCondition condition, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar buf[1024]; -- gsize bytes_read; -- -- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -- g_string_append_len (data->child_stdout, buf, bytes_read); -- return TRUE; --} -- --static void --utils_child_watch_cb (GPid pid, -- gint status, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar *buf; -- gsize buf_size; -- -- if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -- { -- g_string_append_len (data->child_stdout, buf, buf_size); -- g_free (buf); -- } -- if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -- { -- g_string_append_len (data->child_stderr, buf, buf_size); -- g_free (buf); -- } -- -- data->exit_status = status; -- -- /* ok, child watch is history, make sure we don't free it in spawn_data_free() */ -- data->child_pid = 0; -- data->child_watch_source = NULL; -- -- /* we're done */ -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); --} -- --static gboolean --utils_timeout_cb (gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- -- data->timed_out = TRUE; -- -- /* ok, timeout is history, make sure we don't free it in spawn_data_free() */ -- data->timeout_source = NULL; -- -- /* we're done */ -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- -- return FALSE; /* remove source */ --} -- --static void --utils_spawn (const gchar *const *argv, -- guint timeout_seconds, -- GCancellable *cancellable, -- GAsyncReadyCallback callback, -- gpointer user_data) --{ -- UtilsSpawnData *data; -- GError *error; -- -- data = g_slice_new0 (UtilsSpawnData); -- data->timeout_seconds = timeout_seconds; -- data->simple = g_simple_async_result_new (NULL, -- callback, -- user_data, -- (gpointer*)utils_spawn); -- data->main_context = g_main_context_get_thread_default (); -- if (data->main_context != NULL) -- g_main_context_ref (data->main_context); -- -- data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL; -- -- data->child_stdout = g_string_new (NULL); -- data->child_stderr = g_string_new (NULL); -- data->child_stdout_fd = -1; -- data->child_stderr_fd = -1; -- -- /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */ -- g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free); -- -- error = NULL; -- if (data->cancellable != NULL) -- { -- /* could already be cancelled */ -- error = NULL; -- if (g_cancellable_set_error_if_cancelled (data->cancellable, &error)) -- { -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- goto out; -- } -- -- data->cancellable_handler_id = g_cancellable_connect (data->cancellable, -- G_CALLBACK (utils_on_cancelled), -- data, -- NULL); -- } -- -- error = NULL; -- if (!g_spawn_async_with_pipes (NULL, /* working directory */ -- (gchar **) argv, -- NULL, /* envp */ -- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, -- NULL, /* child_setup */ -- NULL, /* child_setup's user_data */ -- &(data->child_pid), -- NULL, /* gint *stdin_fd */ -- &(data->child_stdout_fd), -- &(data->child_stderr_fd), -- &error)) -- { -- g_prefix_error (&error, "Error spawning: "); -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- goto out; -- } -- -- if (timeout_seconds > 0) -- { -- data->timeout_source = g_timeout_source_new_seconds (timeout_seconds); -- g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT); -- g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL); -- g_source_attach (data->timeout_source, data->main_context); -- g_source_unref (data->timeout_source); -- } -- -- data->child_watch_source = g_child_watch_source_new (data->child_pid); -- g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL); -- g_source_attach (data->child_watch_source, data->main_context); -- g_source_unref (data->child_watch_source); -- -- data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd); -- g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL); -- data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN); -- g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL); -- g_source_attach (data->child_stdout_source, data->main_context); -- g_source_unref (data->child_stdout_source); -- -- data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd); -- g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL); -- data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN); -- g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL); -- g_source_attach (data->child_stderr_source, data->main_context); -- g_source_unref (data->child_stderr_source); -- -- out: -- ; --} -- --gboolean --utils_spawn_finish (GAsyncResult *res, -- gint *out_exit_status, -- gchar **out_standard_output, -- gchar **out_standard_error, -- GError **error) --{ -- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); -- UtilsSpawnData *data; -- gboolean ret = FALSE; -- -- g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE); -- g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -- -- g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn); -- -- if (g_simple_async_result_propagate_error (simple, error)) -- goto out; -- -- data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple); -- -- if (data->timed_out) -- { -- g_set_error (error, -- G_IO_ERROR, -- G_IO_ERROR_TIMED_OUT, -- "Timed out after %d seconds", -- data->timeout_seconds); -- goto out; -- } -- -- if (out_exit_status != NULL) -- *out_exit_status = data->exit_status; -- -- if (out_standard_output != NULL) -- *out_standard_output = g_strdup (data->child_stdout->str); -- -- if (out_standard_error != NULL) -- *out_standard_error = g_strdup (data->child_stderr->str); -- -- ret = TRUE; -- -- out: -- return ret; --} -diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp -index ca17108..e28091d 100644 ---- a/src/polkitbackend/polkitbackendjsauthority.cpp -+++ b/src/polkitbackend/polkitbackendjsauthority.cpp -@@ -19,29 +19,7 @@ - * Author: David Zeuthen - */ - --#include "config.h" --#include --#include --#include --#include --#ifdef HAVE_NETGROUP_H --#include --#else --#include --#endif --#include --#include --#include --#include -- --#include --#include "polkitbackendjsauthority.h" -- --#include -- --#ifdef HAVE_LIBSYSTEMD --#include --#endif /* HAVE_LIBSYSTEMD */ -+#include "polkitbackendcommon.h" - - #include - #include -@@ -52,6 +30,7 @@ - #include - #include - -+/* Built source and not too big to worry about deduplication */ - #include "initjs.h" /* init.js */ - - #ifdef JSGC_USE_EXACT_ROOTING -@@ -67,10 +46,9 @@ - * @short_description: JS Authority - * @stability: Unstable - * -- * An implementation of #PolkitBackendAuthority that reads and -- * evalates Javascript files and supports interaction with -- * authentication agents (virtue of being based on -- * #PolkitBackendInteractiveAuthority). -+ * An (SpiderMonkey-based) implementation of #PolkitBackendAuthority that reads -+ * and evaluates Javascript files and supports interaction with authentication -+ * agents (virtue of being based on #PolkitBackendInteractiveAuthority). - */ - - /* ---------------------------------------------------------------------------------------------------- */ -@@ -100,57 +78,11 @@ static bool execute_script_with_runaway_killer (PolkitBackendJsAuthority *author - JS::HandleScript script, - JS::MutableHandleValue rval); - --static void utils_spawn (const gchar *const *argv, -- guint timeout_seconds, -- GCancellable *cancellable, -- GAsyncReadyCallback callback, -- gpointer user_data); -- --gboolean utils_spawn_finish (GAsyncResult *res, -- gint *out_exit_status, -- gchar **out_standard_output, -- gchar **out_standard_error, -- GError **error); -- --static void on_dir_monitor_changed (GFileMonitor *monitor, -- GFile *file, -- GFile *other_file, -- GFileMonitorEvent event_type, -- gpointer user_data); -- --/* ---------------------------------------------------------------------------------------------------- */ -- --enum --{ -- PROP_0, -- PROP_RULES_DIRS, --}; -- - /* ---------------------------------------------------------------------------------------------------- */ - - static gpointer runaway_killer_thread_func (gpointer user_data); - static void runaway_killer_terminate (PolkitBackendJsAuthority *authority); - --static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details); -- --static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync ( -- PolkitBackendInteractiveAuthority *authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details, -- PolkitImplicitAuthorization implicit); -- - G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY); - - /* ---------------------------------------------------------------------------------------------------- */ -@@ -229,33 +161,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) - PolkitBackendJsAuthorityPrivate); - } - --static gint --rules_file_name_cmp (const gchar *a, -- const gchar *b) --{ -- gint ret; -- const gchar *a_base; -- const gchar *b_base; -- -- a_base = strrchr (a, '/'); -- b_base = strrchr (b, '/'); -- -- g_assert (a_base != NULL); -- g_assert (b_base != NULL); -- a_base += 1; -- b_base += 1; -- -- ret = g_strcmp0 (a_base, b_base); -- if (ret == 0) -- { -- /* /etc wins over /usr */ -- ret = g_strcmp0 (a, b); -- g_assert (ret != 0); -- } -- -- return ret; --} -- - /* authority->priv->cx must be within a request */ - static void - load_scripts (PolkitBackendJsAuthority *authority) -@@ -299,7 +204,7 @@ load_scripts (PolkitBackendJsAuthority *authority) - } - } - -- files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp); -+ files = g_list_sort (files, (GCompareFunc) polkit_backend_common_rules_file_name_cmp); - - for (l = files; l != NULL; l = l->next) - { -@@ -365,8 +270,8 @@ load_scripts (PolkitBackendJsAuthority *authority) - g_list_free_full (files, g_free); - } - --static void --reload_scripts (PolkitBackendJsAuthority *authority) -+void -+polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority) - { - JS::RootedValueArray<1> args(authority->priv->cx); - JS::RootedValue rval(authority->priv->cx); -@@ -395,42 +300,6 @@ reload_scripts (PolkitBackendJsAuthority *authority) - g_signal_emit_by_name (authority, "changed"); - } - --static void --on_dir_monitor_changed (GFileMonitor *monitor, -- GFile *file, -- GFile *other_file, -- GFileMonitorEvent event_type, -- gpointer user_data) --{ -- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data); -- -- /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution? -- * Because when editing a file with emacs we get 4-8 events.. -- */ -- -- if (file != NULL) -- { -- gchar *name; -- -- name = g_file_get_basename (file); -- -- /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */ -- if (!g_str_has_prefix (name, ".") && -- !g_str_has_prefix (name, "#") && -- g_str_has_suffix (name, ".rules") && -- (event_type == G_FILE_MONITOR_EVENT_CREATED || -- event_type == G_FILE_MONITOR_EVENT_DELETED || -- event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)) -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Reloading rules"); -- reload_scripts (authority); -- } -- g_free (name); -- } --} -- -- - static void - setup_file_monitors (PolkitBackendJsAuthority *authority) - { -@@ -462,7 +331,7 @@ setup_file_monitors (PolkitBackendJsAuthority *authority) - { - g_signal_connect (monitor, - "changed", -- G_CALLBACK (on_dir_monitor_changed), -+ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed), - authority); - g_ptr_array_add (p, monitor); - } -@@ -471,8 +340,8 @@ setup_file_monitors (PolkitBackendJsAuthority *authority) - authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE); - } - --static void --polkit_backend_js_authority_constructed (GObject *object) -+void -+polkit_backend_common_js_authority_constructed (GObject *object) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - -@@ -561,8 +430,8 @@ polkit_backend_js_authority_constructed (GObject *object) - g_assert_not_reached (); - } - --static void --polkit_backend_js_authority_finalize (GObject *object) -+void -+polkit_backend_common_js_authority_finalize (GObject *object) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - guint n; -@@ -577,7 +446,7 @@ polkit_backend_js_authority_finalize (GObject *object) - { - GFileMonitor *monitor = authority->priv->dir_monitors[n]; - g_signal_handlers_disconnect_by_func (monitor, -- (gpointer*)G_CALLBACK (on_dir_monitor_changed), -+ (gpointer*)G_CALLBACK (polkit_backend_common_on_dir_monitor_changed), - authority); - g_object_unref (monitor); - } -@@ -594,11 +463,11 @@ polkit_backend_js_authority_finalize (GObject *object) - G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object); - } - --static void --polkit_backend_js_authority_set_property (GObject *object, -- guint property_id, -- const GValue *value, -- GParamSpec *pspec) -+void -+polkit_backend_common_js_authority_set_property (GObject *object, -+ guint property_id, -+ const GValue *value, -+ GParamSpec *pspec) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - -@@ -615,57 +484,12 @@ polkit_backend_js_authority_set_property (GObject *object, - } - } - --static const gchar * --polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority) --{ -- return "js"; --} -- --static const gchar * --polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority) --{ -- return PACKAGE_VERSION; --} -- --static PolkitAuthorityFeatures --polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority) --{ -- return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION; --} -- - static void - polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass) - { -- GObjectClass *gobject_class; -- PolkitBackendAuthorityClass *authority_class; -- PolkitBackendInteractiveAuthorityClass *interactive_authority_class; -- -- -- gobject_class = G_OBJECT_CLASS (klass); -- gobject_class->finalize = polkit_backend_js_authority_finalize; -- gobject_class->set_property = polkit_backend_js_authority_set_property; -- gobject_class->constructed = polkit_backend_js_authority_constructed; -- -- authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass); -- authority_class->get_name = polkit_backend_js_authority_get_name; -- authority_class->get_version = polkit_backend_js_authority_get_version; -- authority_class->get_features = polkit_backend_js_authority_get_features; -- -- interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass); -- interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities; -- interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync; -- -- g_object_class_install_property (gobject_class, -- PROP_RULES_DIRS, -- g_param_spec_boxed ("rules-dirs", -- NULL, -- NULL, -- G_TYPE_STRV, -- GParamFlags(G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE))); -- -+ polkit_backend_common_js_authority_class_init_common (klass); - - g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate)); -- - JS_Init (); - } - -@@ -1099,15 +923,15 @@ call_js_function_with_runaway_killer (PolkitBackendJsAuthority *authority, - - /* ---------------------------------------------------------------------------------------------------- */ - --static GList * --polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details) -+GList * -+polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); - GList *ret = NULL; -@@ -1202,16 +1026,16 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA - - /* ---------------------------------------------------------------------------------------------------- */ - --static PolkitImplicitAuthorization --polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -- PolkitSubject *caller, -- PolkitSubject *subject, -- PolkitIdentity *user_for_subject, -- gboolean subject_is_local, -- gboolean subject_is_active, -- const gchar *action_id, -- PolkitDetails *details, -- PolkitImplicitAuthorization implicit) -+PolkitImplicitAuthorization -+polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority, -+ PolkitSubject *caller, -+ PolkitSubject *subject, -+ PolkitIdentity *user_for_subject, -+ gboolean subject_is_local, -+ gboolean subject_is_active, -+ const gchar *action_id, -+ PolkitDetails *details, -+ PolkitImplicitAuthorization implicit) - { - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); - PolkitImplicitAuthorization ret = implicit; -@@ -1324,65 +1148,6 @@ js_polkit_log (JSContext *cx, - - /* ---------------------------------------------------------------------------------------------------- */ - --static const gchar * --get_signal_name (gint signal_number) --{ -- switch (signal_number) -- { --#define _HANDLE_SIG(sig) case sig: return #sig; -- _HANDLE_SIG (SIGHUP); -- _HANDLE_SIG (SIGINT); -- _HANDLE_SIG (SIGQUIT); -- _HANDLE_SIG (SIGILL); -- _HANDLE_SIG (SIGABRT); -- _HANDLE_SIG (SIGFPE); -- _HANDLE_SIG (SIGKILL); -- _HANDLE_SIG (SIGSEGV); -- _HANDLE_SIG (SIGPIPE); -- _HANDLE_SIG (SIGALRM); -- _HANDLE_SIG (SIGTERM); -- _HANDLE_SIG (SIGUSR1); -- _HANDLE_SIG (SIGUSR2); -- _HANDLE_SIG (SIGCHLD); -- _HANDLE_SIG (SIGCONT); -- _HANDLE_SIG (SIGSTOP); -- _HANDLE_SIG (SIGTSTP); -- _HANDLE_SIG (SIGTTIN); -- _HANDLE_SIG (SIGTTOU); -- _HANDLE_SIG (SIGBUS); --#ifdef SIGPOLL -- _HANDLE_SIG (SIGPOLL); --#endif -- _HANDLE_SIG (SIGPROF); -- _HANDLE_SIG (SIGSYS); -- _HANDLE_SIG (SIGTRAP); -- _HANDLE_SIG (SIGURG); -- _HANDLE_SIG (SIGVTALRM); -- _HANDLE_SIG (SIGXCPU); -- _HANDLE_SIG (SIGXFSZ); --#undef _HANDLE_SIG -- default: -- break; -- } -- return "UNKNOWN_SIGNAL"; --} -- --typedef struct --{ -- GMainLoop *loop; -- GAsyncResult *res; --} SpawnData; -- --static void --spawn_cb (GObject *source_object, -- GAsyncResult *res, -- gpointer user_data) --{ -- SpawnData *data = (SpawnData *)user_data; -- data->res = (GAsyncResult*)g_object_ref (res); -- g_main_loop_quit (data->loop); --} -- - static bool - js_polkit_spawn (JSContext *cx, - unsigned js_argc, -@@ -1440,21 +1205,21 @@ js_polkit_spawn (JSContext *cx, - g_main_context_push_thread_default (context); - - data.loop = loop; -- utils_spawn ((const gchar *const *) argv, -- 10, /* timeout_seconds */ -- NULL, /* cancellable */ -- spawn_cb, -- &data); -+ polkit_backend_common_spawn ((const gchar *const *) argv, -+ 10, /* timeout_seconds */ -+ NULL, /* cancellable */ -+ polkit_backend_common_spawn_cb, -+ &data); - - g_main_loop_run (loop); - - g_main_context_pop_thread_default (context); - -- if (!utils_spawn_finish (data.res, -- &exit_status, -- &standard_output, -- &standard_error, -- &error)) -+ if (!polkit_backend_common_spawn_finish (data.res, -+ &exit_status, -+ &standard_output, -+ &standard_error, -+ &error)) - { - JS_ReportErrorUTF8 (cx, - "Error spawning helper: %s (%s, %d)", -@@ -1477,7 +1242,7 @@ js_polkit_spawn (JSContext *cx, - { - g_string_append_printf (gstr, - "Helper was signaled with signal %s (%d)", -- get_signal_name (WTERMSIG (exit_status)), -+ polkit_backend_common_get_signal_name (WTERMSIG (exit_status)), - WTERMSIG (exit_status)); - } - g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'", -@@ -1542,381 +1307,5 @@ js_polkit_user_is_in_netgroup (JSContext *cx, - return ret; - } - -- -- - /* ---------------------------------------------------------------------------------------------------- */ - --typedef struct --{ -- GSimpleAsyncResult *simple; /* borrowed reference */ -- GMainContext *main_context; /* may be NULL */ -- -- GCancellable *cancellable; /* may be NULL */ -- gulong cancellable_handler_id; -- -- GPid child_pid; -- gint child_stdout_fd; -- gint child_stderr_fd; -- -- GIOChannel *child_stdout_channel; -- GIOChannel *child_stderr_channel; -- -- GSource *child_watch_source; -- GSource *child_stdout_source; -- GSource *child_stderr_source; -- -- guint timeout_seconds; -- gboolean timed_out; -- GSource *timeout_source; -- -- GString *child_stdout; -- GString *child_stderr; -- -- gint exit_status; --} UtilsSpawnData; -- --static void --utils_child_watch_from_release_cb (GPid pid, -- gint status, -- gpointer user_data) --{ --} -- --static void --utils_spawn_data_free (UtilsSpawnData *data) --{ -- if (data->timeout_source != NULL) -- { -- g_source_destroy (data->timeout_source); -- data->timeout_source = NULL; -- } -- -- /* Nuke the child, if necessary */ -- if (data->child_watch_source != NULL) -- { -- g_source_destroy (data->child_watch_source); -- data->child_watch_source = NULL; -- } -- -- if (data->child_pid != 0) -- { -- GSource *source; -- kill (data->child_pid, SIGTERM); -- /* OK, we need to reap for the child ourselves - we don't want -- * to use waitpid() because that might block the calling -- * thread (the child might handle SIGTERM and use several -- * seconds for cleanup/rollback). -- * -- * So we use GChildWatch instead. -- * -- * Avoid taking a references to ourselves. but note that we need -- * to pass the GSource so we can nuke it once handled. -- */ -- source = g_child_watch_source_new (data->child_pid); -- g_source_set_callback (source, -- (GSourceFunc) utils_child_watch_from_release_cb, -- source, -- (GDestroyNotify) g_source_destroy); -- /* attach source to the global default main context */ -- g_source_attach (source, NULL); -- g_source_unref (source); -- data->child_pid = 0; -- } -- -- if (data->child_stdout != NULL) -- { -- g_string_free (data->child_stdout, TRUE); -- data->child_stdout = NULL; -- } -- -- if (data->child_stderr != NULL) -- { -- g_string_free (data->child_stderr, TRUE); -- data->child_stderr = NULL; -- } -- -- if (data->child_stdout_channel != NULL) -- { -- g_io_channel_unref (data->child_stdout_channel); -- data->child_stdout_channel = NULL; -- } -- if (data->child_stderr_channel != NULL) -- { -- g_io_channel_unref (data->child_stderr_channel); -- data->child_stderr_channel = NULL; -- } -- -- if (data->child_stdout_source != NULL) -- { -- g_source_destroy (data->child_stdout_source); -- data->child_stdout_source = NULL; -- } -- if (data->child_stderr_source != NULL) -- { -- g_source_destroy (data->child_stderr_source); -- data->child_stderr_source = NULL; -- } -- -- if (data->child_stdout_fd != -1) -- { -- g_warn_if_fail (close (data->child_stdout_fd) == 0); -- data->child_stdout_fd = -1; -- } -- if (data->child_stderr_fd != -1) -- { -- g_warn_if_fail (close (data->child_stderr_fd) == 0); -- data->child_stderr_fd = -1; -- } -- -- if (data->cancellable_handler_id > 0) -- { -- g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id); -- data->cancellable_handler_id = 0; -- } -- -- if (data->main_context != NULL) -- g_main_context_unref (data->main_context); -- -- if (data->cancellable != NULL) -- g_object_unref (data->cancellable); -- -- g_slice_free (UtilsSpawnData, data); --} -- --/* called in the thread where @cancellable was cancelled */ --static void --utils_on_cancelled (GCancellable *cancellable, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- GError *error; -- -- error = NULL; -- g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error)); -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); --} -- --static gboolean --utils_read_child_stderr (GIOChannel *channel, -- GIOCondition condition, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar buf[1024]; -- gsize bytes_read; -- -- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -- g_string_append_len (data->child_stderr, buf, bytes_read); -- return TRUE; --} -- --static gboolean --utils_read_child_stdout (GIOChannel *channel, -- GIOCondition condition, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar buf[1024]; -- gsize bytes_read; -- -- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL); -- g_string_append_len (data->child_stdout, buf, bytes_read); -- return TRUE; --} -- --static void --utils_child_watch_cb (GPid pid, -- gint status, -- gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- gchar *buf; -- gsize buf_size; -- -- if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -- { -- g_string_append_len (data->child_stdout, buf, buf_size); -- g_free (buf); -- } -- if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) -- { -- g_string_append_len (data->child_stderr, buf, buf_size); -- g_free (buf); -- } -- -- data->exit_status = status; -- -- /* ok, child watch is history, make sure we don't free it in spawn_data_free() */ -- data->child_pid = 0; -- data->child_watch_source = NULL; -- -- /* we're done */ -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); --} -- --static gboolean --utils_timeout_cb (gpointer user_data) --{ -- UtilsSpawnData *data = (UtilsSpawnData *)user_data; -- -- data->timed_out = TRUE; -- -- /* ok, timeout is history, make sure we don't free it in spawn_data_free() */ -- data->timeout_source = NULL; -- -- /* we're done */ -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- -- return FALSE; /* remove source */ --} -- --static void --utils_spawn (const gchar *const *argv, -- guint timeout_seconds, -- GCancellable *cancellable, -- GAsyncReadyCallback callback, -- gpointer user_data) --{ -- UtilsSpawnData *data; -- GError *error; -- -- data = g_slice_new0 (UtilsSpawnData); -- data->timeout_seconds = timeout_seconds; -- data->simple = g_simple_async_result_new (NULL, -- callback, -- user_data, -- (gpointer*)utils_spawn); -- data->main_context = g_main_context_get_thread_default (); -- if (data->main_context != NULL) -- g_main_context_ref (data->main_context); -- -- data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL; -- -- data->child_stdout = g_string_new (NULL); -- data->child_stderr = g_string_new (NULL); -- data->child_stdout_fd = -1; -- data->child_stderr_fd = -1; -- -- /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */ -- g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free); -- -- error = NULL; -- if (data->cancellable != NULL) -- { -- /* could already be cancelled */ -- error = NULL; -- if (g_cancellable_set_error_if_cancelled (data->cancellable, &error)) -- { -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- goto out; -- } -- -- data->cancellable_handler_id = g_cancellable_connect (data->cancellable, -- G_CALLBACK (utils_on_cancelled), -- data, -- NULL); -- } -- -- error = NULL; -- if (!g_spawn_async_with_pipes (NULL, /* working directory */ -- (gchar **) argv, -- NULL, /* envp */ -- GSpawnFlags(G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD), -- NULL, /* child_setup */ -- NULL, /* child_setup's user_data */ -- &(data->child_pid), -- NULL, /* gint *stdin_fd */ -- &(data->child_stdout_fd), -- &(data->child_stderr_fd), -- &error)) -- { -- g_prefix_error (&error, "Error spawning: "); -- g_simple_async_result_take_error (data->simple, error); -- g_simple_async_result_complete_in_idle (data->simple); -- g_object_unref (data->simple); -- goto out; -- } -- -- if (timeout_seconds > 0) -- { -- data->timeout_source = g_timeout_source_new_seconds (timeout_seconds); -- g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT); -- g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL); -- g_source_attach (data->timeout_source, data->main_context); -- g_source_unref (data->timeout_source); -- } -- -- data->child_watch_source = g_child_watch_source_new (data->child_pid); -- g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL); -- g_source_attach (data->child_watch_source, data->main_context); -- g_source_unref (data->child_watch_source); -- -- data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd); -- g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL); -- data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN); -- g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL); -- g_source_attach (data->child_stdout_source, data->main_context); -- g_source_unref (data->child_stdout_source); -- -- data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd); -- g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL); -- data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN); -- g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL); -- g_source_attach (data->child_stderr_source, data->main_context); -- g_source_unref (data->child_stderr_source); -- -- out: -- ; --} -- --gboolean --utils_spawn_finish (GAsyncResult *res, -- gint *out_exit_status, -- gchar **out_standard_output, -- gchar **out_standard_error, -- GError **error) --{ -- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); -- UtilsSpawnData *data; -- gboolean ret = FALSE; -- -- g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE); -- g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -- -- g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn); -- -- if (g_simple_async_result_propagate_error (simple, error)) -- goto out; -- -- data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple); -- -- if (data->timed_out) -- { -- g_set_error (error, -- G_IO_ERROR, -- G_IO_ERROR_TIMED_OUT, -- "Timed out after %d seconds", -- data->timeout_seconds); -- goto out; -- } -- -- if (out_exit_status != NULL) -- *out_exit_status = data->exit_status; -- -- if (out_standard_output != NULL) -- *out_standard_output = g_strdup (data->child_stdout->str); -- -- if (out_standard_error != NULL) -- *out_standard_error = g_strdup (data->child_stderr->str); -- -- ret = TRUE; -- -- out: -- return ret; --} --- -GitLab - - -From 4858128107be9c3ab11828ee8f35c5e26efd36ce Mon Sep 17 00:00:00 2001 -From: Gustavo Lima Chaves -Date: Tue, 14 Sep 2021 14:38:15 -0700 -Subject: [PATCH 15/16] Gitlab CI: add duktape pkgconfig dependency - -Make way for the CI to be able to build with duktape too - -Signed-off-by: Gustavo Lima Chaves ---- - .gitlab-ci.yml | 1 + - 1 file changed, 1 insertion(+) - -GitLab - - -From cd5d6da837fce95f8831a355dad88c83347c7337 Mon Sep 17 00:00:00 2001 -From: Gustavo Lima Chaves -Date: Mon, 20 Sep 2021 17:17:26 -0700 -Subject: [PATCH 16/16] duktape: implement runaway scripts killer timeout - -This was missing on Duktape's JS backend proposal, now in. As -discussed in -https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35 and -verified by the commit author, Duktape has no interrupt injection -mechanism (it has no thread-safe API entry whatsoever, even). Using -DUK_USE_EXEC_TIMEOUT_CHECK is also not feasible, because: - - i) It must be enabled at build time and shared object builds of the - lib on distros go with the default options, something we cannot - change/control - - ii) That does not account for non-ECMAScript explicit execution - contexts, like regex execution, native C calls, etc. - -It has been agreed, on that thread, that pthread_cond_timedwait()-ing -and having proper Duktape evaluation/execution calls take place in a -separate thread, to be killed after the runaway script killer's -accorded timeout value, a reasonable approach. We have considered -using glib wrappers for direct pthread usage, but that way would make -it impossible to issue -pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, ...) and we want to -be paranoid in that regard. - -On Duktape, we don't get to err from the JS context (to be captured by -the offending script), but to be forcibly killed on timeout scenarios, -leading to null returns, thus polkit negation, by definition. It's a -reasonable design/compromise. - -A fatal error handler routine, for the Duktape context, has also been -added, using the polkit_backend_authority_log() logging infra to -better assist users on what went wrong. - -Finally, the script evaluation routine has been made to use -duk_peval_lstring() (previously using _noresult variant), so to able -to present the user with proper error messages, should any occur. - -The original runaway script killer test has been adjusted to please -both JS backends. - -Signed-off-by: Gustavo Lima Chaves ---- - meson.build | 1 + - src/polkitbackend/meson.build | 1 + - src/polkitbackend/polkitbackendcommon.h | 2 + - .../polkitbackendduktapeauthority.c | 236 ++++++++++++++---- - .../polkitbackendjsauthority.cpp | 10 +- - .../etc/polkit-1/rules.d/10-testing.rules | 6 +- - .../test-polkitbackendjsauthority.c | 2 +- - 7 files changed, 209 insertions(+), 49 deletions(-) - -diff --git a/meson.build b/meson.build -index 4e44723..46956e3 100644 ---- a/meson.build -+++ b/meson.build -@@ -137,6 +137,7 @@ js_engine = get_option('js_engine') - if js_engine == 'duktape' - js_dep = dependency('duktape') - libm_dep = cc.find_library('m') -+ libpthread_dep = cc.find_library('pthread') - elif js_engine == 'mozjs' - js_dep = dependency('mozjs-78') - endif -diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build -index 9ec01b2..4dfea39 100644 ---- a/src/polkitbackend/meson.build -+++ b/src/polkitbackend/meson.build -@@ -34,6 +34,7 @@ c_flags = [ - if js_engine == 'duktape' - sources += files('polkitbackendduktapeauthority.c') - deps += libm_dep -+ deps += libpthread_dep - elif js_engine == 'mozjs' - sources += files('polkitbackendjsauthority.cpp') - endif -diff --git a/src/polkitbackend/polkitbackendcommon.h b/src/polkitbackend/polkitbackendcommon.h -index 6d0d267..dd700fc 100644 ---- a/src/polkitbackend/polkitbackendcommon.h -+++ b/src/polkitbackend/polkitbackendcommon.h -@@ -50,6 +50,8 @@ - #include - #endif /* HAVE_LIBSYSTEMD */ - -+#define RUNAWAY_KILLER_TIMEOUT (15) -+ - #ifdef __cplusplus - extern "C" { - #endif -diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c -index a2b4420..80f1976 100644 ---- a/src/polkitbackend/polkitbackendduktapeauthority.c -+++ b/src/polkitbackend/polkitbackendduktapeauthority.c -@@ -47,8 +47,20 @@ struct _PolkitBackendJsAuthorityPrivate - GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */ - - duk_context *cx; -+ -+ pthread_t runaway_killer_thread; -+}; -+ -+enum -+{ -+ RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET, -+ RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS, -+ RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE, - }; - -+static gboolean execute_script_with_runaway_killer(PolkitBackendJsAuthority *authority, -+ const gchar *filename); -+ - /* ---------------------------------------------------------------------------------------------------- */ - - G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY); -@@ -67,6 +79,15 @@ static const duk_function_list_entry js_polkit_functions[] = - { NULL, NULL, 0 }, - }; - -+static void report_error (void *udata, -+ const char *msg) -+{ -+ PolkitBackendJsAuthority *authority = udata; -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -+ "fatal Duktape JS backend error: %s", -+ (msg ? msg : "no message")); -+} -+ - static void - polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) - { -@@ -78,7 +99,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) - static void - load_scripts (PolkitBackendJsAuthority *authority) - { -- duk_context *cx = authority->priv->cx; - GList *files = NULL; - GList *l; - guint num_scripts = 0; -@@ -123,36 +143,9 @@ load_scripts (PolkitBackendJsAuthority *authority) - for (l = files; l != NULL; l = l->next) - { - const gchar *filename = (gchar *)l->data; --#if (DUK_VERSION >= 20000) -- GFile *file = g_file_new_for_path (filename); -- char *contents; -- gsize len; -- if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL)) -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Error compiling script %s", -- filename); -- g_object_unref (file); -- continue; -- } - -- g_object_unref (file); -- if (duk_peval_lstring_noresult(cx, contents,len) != 0) --#else -- if (duk_peval_file_noresult (cx, filename) != 0) --#endif -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Error compiling script %s: %s", -- filename, duk_safe_to_string (authority->priv->cx, -1)); --#if (DUK_VERSION >= 20000) -- g_free (contents); --#endif -+ if (!execute_script_with_runaway_killer(authority, filename)) - continue; -- } --#if (DUK_VERSION >= 20000) -- g_free (contents); --#endif - num_scripts++; - } - -@@ -232,7 +225,7 @@ polkit_backend_common_js_authority_constructed (GObject *object) - PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); - duk_context *cx; - -- cx = duk_create_heap (NULL, NULL, NULL, authority, NULL); -+ cx = duk_create_heap (NULL, NULL, NULL, authority, report_error); - if (cx == NULL) - goto fail; - -@@ -243,6 +236,9 @@ polkit_backend_common_js_authority_constructed (GObject *object) - duk_put_function_list (cx, -1, js_polkit_functions); - duk_put_prop_string (cx, -2, "polkit"); - -+ /* load polkit objects/functions into JS context (e.g. addRule(), -+ * _deleteRules(), _runRules() et al) -+ */ - duk_eval_string (cx, init_js); - - if (authority->priv->rules_dirs == NULL) -@@ -510,6 +506,167 @@ push_action_and_details (duk_context *cx, - - /* ---------------------------------------------------------------------------------------------------- */ - -+typedef struct { -+ PolkitBackendJsAuthority *authority; -+ const gchar *filename; -+ pthread_cond_t cond; -+ pthread_mutex_t mutex; -+ gint ret; -+} RunawayKillerCtx; -+ -+static gpointer -+runaway_killer_thread_execute_js (gpointer user_data) -+{ -+ RunawayKillerCtx *ctx = user_data; -+ duk_context *cx = ctx->authority->priv->cx; -+ -+ int oldtype; -+ -+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); -+ -+#if (DUK_VERSION >= 20000) -+ GFile *file = g_file_new_for_path(ctx->filename); -+ char *contents; -+ gsize len; -+ -+ if (!g_file_load_contents(file, NULL, &contents, &len, NULL, NULL)) { -+ polkit_backend_authority_log(POLKIT_BACKEND_AUTHORITY(ctx->authority), -+ "Error compiling script %s", ctx->filename); -+ g_object_unref(file); -+ goto err; -+ } -+ -+ g_object_unref(file); -+ -+ /* evaluate the script, trying to print context in any syntax errors -+ found */ -+ if (duk_peval_lstring(cx, contents, len) != 0) -+#else -+ if (duk_peval_file(cx, ctx->filename) != 0) -+#endif -+ { -+ polkit_backend_authority_log(POLKIT_BACKEND_AUTHORITY(ctx->authority), -+ "Error compiling script %s: %s", ctx->filename, -+ duk_safe_to_string(cx, -1)); -+ duk_pop(cx); -+ goto free_err; -+ } -+#if (DUK_VERSION >= 20000) -+ g_free(contents); -+#endif -+ -+ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS; -+ goto end; -+ -+free_err: -+#if (DUK_VERSION >= 20000) -+ g_free(contents); -+#endif -+err: -+ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE; -+end: -+ pthread_cond_signal(&ctx->cond); -+ return NULL; -+} -+ -+static gpointer -+runaway_killer_thread_call_js (gpointer user_data) -+{ -+ RunawayKillerCtx *ctx = user_data; -+ duk_context *cx = ctx->authority->priv->cx; -+ int oldtype; -+ -+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); -+ -+ if (duk_pcall_prop (cx, 0, 2) != DUK_EXEC_SUCCESS) -+ { -+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (ctx->authority), -+ "Error evaluating admin rules: ", -+ duk_safe_to_string (cx, -1)); -+ goto err; -+ } -+ -+ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS; -+ goto end; -+ -+err: -+ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE; -+end: -+ pthread_cond_signal(&ctx->cond); -+ return NULL; -+} -+ -+/* Blocking for at most for RUNAWAY_KILLER_TIMEOUT */ -+static gboolean -+execute_script_with_runaway_killer(PolkitBackendJsAuthority *authority, -+ const gchar *filename) -+{ -+ gint64 end_time; -+ gboolean cancel = FALSE; -+ RunawayKillerCtx ctx = {.authority = authority, .filename = filename, -+ .ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET, -+ .mutex = PTHREAD_MUTEX_INITIALIZER, -+ .cond = PTHREAD_COND_INITIALIZER}; -+ struct timespec abs_time; -+ -+ pthread_mutex_lock(&ctx.mutex); -+ -+ clock_gettime(CLOCK_REALTIME, &abs_time); -+ abs_time.tv_sec += RUNAWAY_KILLER_TIMEOUT; -+ -+ pthread_create(&authority->priv->runaway_killer_thread, NULL, runaway_killer_thread_execute_js, &ctx); -+ -+ while (ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET) /* loop to treat spurious wakeups */ -+ if (pthread_cond_timedwait(&ctx.cond, &ctx.mutex, &abs_time) == ETIMEDOUT) { -+ cancel = TRUE; -+ break; -+ } -+ -+ pthread_mutex_unlock(&ctx.mutex); -+ -+ if (cancel) -+ pthread_cancel (authority->priv->runaway_killer_thread); -+ pthread_join (authority->priv->runaway_killer_thread, NULL); -+ -+ return ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS; -+} -+ -+/* Calls already stacked function and args. Blocking for at most for -+ * RUNAWAY_KILLER_TIMEOUT -+ */ -+static gboolean -+call_js_function_with_runaway_killer(PolkitBackendJsAuthority *authority) -+{ -+ gint64 end_time; -+ gboolean cancel = FALSE; -+ RunawayKillerCtx ctx = {.authority = authority, -+ .ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET, -+ .mutex = PTHREAD_MUTEX_INITIALIZER, -+ .cond = PTHREAD_COND_INITIALIZER}; -+ struct timespec abs_time; -+ -+ pthread_mutex_lock(&ctx.mutex); -+ -+ clock_gettime(CLOCK_REALTIME, &abs_time); -+ abs_time.tv_sec += RUNAWAY_KILLER_TIMEOUT; -+ -+ pthread_create(&authority->priv->runaway_killer_thread, NULL, runaway_killer_thread_call_js, &ctx); -+ -+ while (ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET) /* loop to treat spurious wakeups */ -+ if (pthread_cond_timedwait(&ctx.cond, &ctx.mutex, &abs_time) == ETIMEDOUT) { -+ cancel = TRUE; -+ break; -+ } -+ -+ pthread_mutex_unlock(&ctx.mutex); -+ -+ if (cancel) -+ pthread_cancel (authority->priv->runaway_killer_thread); -+ pthread_join (authority->priv->runaway_killer_thread, NULL); -+ -+ return ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS; -+} -+ - /* ---------------------------------------------------------------------------------------------------- */ - - GList * -@@ -557,13 +714,8 @@ polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInter - goto out; - } - -- if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE) -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Error evaluating admin rules: ", -- duk_safe_to_string (cx, -1)); -- goto out; -- } -+ if (!call_js_function_with_runaway_killer (authority)) -+ goto out; - - ret_str = duk_require_string (cx, -1); - -@@ -643,15 +795,11 @@ polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendIntera - goto out; - } - -- if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE) -- { -- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -- "Error evaluating authorization rules: ", -- duk_safe_to_string (cx, -1)); -- goto out; -- } -+ if (!call_js_function_with_runaway_killer (authority)) -+ goto out; - - if (duk_is_null(cx, -1)) { -+ /* this fine, means there was no match, use implicit authorizations */ - good = TRUE; - goto out; - } -diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp -index e28091d..11e91c0 100644 ---- a/src/polkitbackend/polkitbackendjsauthority.cpp -+++ b/src/polkitbackend/polkitbackendjsauthority.cpp -@@ -829,11 +829,14 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority) - { - g_assert (authority->priv->rkt_source == NULL); - -- /* set-up timer for runaway scripts, will be executed in runaway_killer_thread */ -+ /* set-up timer for runaway scripts, will be executed in -+ runaway_killer_thread, that is one, permanent thread running a glib -+ mainloop (rkt_loop) whose context (rkt_context) has a timeout source -+ (rkt_source) */ - g_mutex_lock (&authority->priv->rkt_timeout_pending_mutex); - authority->priv->rkt_timeout_pending = FALSE; - g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); -- authority->priv->rkt_source = g_timeout_source_new_seconds (15); -+ authority->priv->rkt_source = g_timeout_source_new_seconds (RUNAWAY_KILLER_TIMEOUT); - g_source_set_callback (authority->priv->rkt_source, rkt_on_timeout, authority, NULL); - g_source_attach (authority->priv->rkt_source, authority->priv->rkt_context); - -@@ -893,6 +896,9 @@ execute_script_with_runaway_killer (PolkitBackendJsAuthority *authority, - { - bool ret; - -+ // tries to JS_ExecuteScript(), may hang for > RUNAWAY_KILLER_TIMEOUT, -+ // runaway_killer_thread makes sure the call returns, due to exception -+ // injection - runaway_killer_setup (authority); - ret = JS_ExecuteScript (authority->priv->cx, - script, -diff --git a/test/data/etc/polkit-1/rules.d/10-testing.rules b/test/data/etc/polkit-1/rules.d/10-testing.rules -index 98bf062..e346b5d 100644 ---- a/test/data/etc/polkit-1/rules.d/10-testing.rules -+++ b/test/data/etc/polkit-1/rules.d/10-testing.rules -@@ -189,8 +189,10 @@ polkit.addRule(function(action, subject) { - ; - } catch (error) { - if (error == "Terminating runaway script") -- return polkit.Result.YES; -- return polkit.Result.NO; -+ // Inverted logic to accomodate Duktape's model as well, which -+ // will always fail with negation, on timeouts -+ return polkit.Result.NO; -+ return polkit.Result.YES; - } - } - }); -diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c -index f97e0e0..2103b17 100644 ---- a/test/polkitbackend/test-polkitbackendjsauthority.c -+++ b/test/polkitbackend/test-polkitbackendjsauthority.c -@@ -328,7 +328,7 @@ static const RulesTestCase rules_test_cases[] = { - "net.company.run_away_script", - "unix-user:root", - NULL, -- POLKIT_IMPLICIT_AUTHORIZATION_AUTHORIZED, -+ POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED, - }, - - { --- -GitLab - diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index 38e7f36c2a..18d299bbd1 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2021 Morgan Smith ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ +;;; Copyright © 2022 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,14 +30,16 @@ (define-module (gnu packages polkit) #:use-module ((guix licenses) #:select (lgpl2.0+)) #:use-module (guix packages) + #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix memoization) #:use-module (guix utils) #:use-module (guix build utils) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) + #:use-module (guix build-system meson) #:use-module (gnu packages) - #:use-module (gnu packages autotools) + #:use-module (gnu packages gettext) #:use-module (gnu packages freedesktop) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) @@ -54,7 +57,7 @@ (define-module (gnu packages polkit) (define-public polkit-mozjs (package (name "polkit") - (version "0.120") + (version "121") (source (origin (method url-fetch) (uri (string-append @@ -62,22 +65,15 @@ (define-public polkit-mozjs name "-" version ".tar.gz")) (sha256 (base32 - "00zfg9b9ivkcj2jcf5b92cpvvyljz8cmfwj86lkvy5rihnd5jypf")) - (patches (search-patches "polkit-configure-elogind.patch" - "polkit-CVE-2021-4034.patch")) + "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx")) (modules '((guix build utils))) (snippet '(begin - (use-modules (guix build utils)) - ;; Disable broken test. - (substitute* "test/Makefile.in" - (("SUBDIRS = mocklibc . polkit polkitbackend") - "SUBDIRS = mocklibc . polkit")) ;; Disable a test that requires Python, D-Bus and a few ;; libraries and fails with "ERROR: timed out waiting for bus ;; process to terminate". - (substitute* "test/polkitbackend/Makefile.am" - (("TEST_PROGS \\+= polkitbackendjsauthoritytest-wrapper.py") + (substitute* "test/meson.build" + (("subdir\\('polkitbackend'\\)") "")) ;; Guix System's polkit ;; service stores actions under /etc/polkit-1/actions. @@ -88,58 +84,39 @@ (define-public polkit-mozjs (substitute* "src/polkitagent/polkitagentsession.c" (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"") "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) - (build-system gnu-build-system) + (build-system meson-build-system) (inputs - (list expat linux-pam elogind mozjs-78 nspr)) + (list elogind + expat + linux-pam + mozjs-91 + nspr)) (propagated-inputs - (list glib)) ; required by polkit-gobject-1.pc + (list glib)) ;required by polkit-gobject-1.pc (native-inputs (list pkg-config - `(,glib "bin") ;for glib-mkenums - intltool + gettext-minimal + perl + `(,glib "bin") ;for glib-mkenums gobject-introspection - libxslt ;for man page generation - docbook-xsl)) ;for man page generation + libxml2 ;for man page generation + libxslt ;for man page generation + docbook-xsl)) ;for man page generation (arguments - `(#:configure-flags '("--sysconfdir=/etc" - "--enable-man-pages" - ;; Prevent ‘configure: error: cannot check for - ;; file existence when cross compiling’. - ,@(if (%current-target-system) - '("--with-os-type=unknown") - '())) - #:phases - (modify-phases %standard-phases - (add-after - 'unpack 'fix-introspection-install-dir - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (substitute* (find-files "." "Makefile.in") - (("@INTROSPECTION_GIRDIR@") - (string-append out "/share/gir-1.0/")) - (("@INTROSPECTION_TYPELIBDIR@") - (string-append out "/lib/girepository-1.0/")))))) - (add-after 'unpack 'fix-manpage-generation - (lambda* (#:key inputs native-inputs #:allow-other-keys) - (let ((xsldoc (string-append - (assoc-ref (or native-inputs inputs) "docbook-xsl") - "/xml/xsl/docbook-xsl-" - ,(package-version docbook-xsl)))) - (substitute* '("docs/man/Makefile.am" "docs/man/Makefile.in") - (("http://docbook.sourceforge.net/release/xsl/current") - xsldoc))))) - (replace - 'install - (lambda* (#:key outputs (make-flags '()) #:allow-other-keys) - ;; Override sysconfdir during "make install", to avoid attempting - ;; to install in /etc, and to instead install the skeletons in the - ;; output directory. - (let ((out (assoc-ref outputs "out"))) - (apply invoke "make" "install" - (string-append "sysconfdir=" out "/etc") - (string-append "polkit_actiondir=" - out "/share/polkit-1/actions") - make-flags))))))) + (list #:configure-flags + #~'("-Dman=true" + "-Dtests=true" + "-Djs_engine=mozjs" + ;; Work around broken gobject-introspection detection when + ;; cross-compiling. The build system probes for the _target_ + ;; gobject-introspection, but if we change it to native, Meson + ;; fails with: + ;; ERROR: Pkg-config binary for machine MachineChoice.BUILD + ;; not found, giving up. + ;; Just disable introspection for now. + #$@(if (%current-target-system) + '("-Dintrospection=false") + '())))) (home-page "https://www.freedesktop.org/wiki/Software/polkit/") (synopsis "Authorization API for privilege management") (description "Polkit is an application-level toolkit for defining and @@ -155,25 +132,10 @@ (define-public polkit-duktape (let ((base polkit-mozjs)) (package/inherit base (name "polkit-duktape") - (source - (origin - (inherit (package-source base)) - (patches - (append - (search-patches "polkit-use-duktape.patch") - (origin-patches (package-source base)))))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:configure-flags flags) - `(cons "--with-duktape" ,flags)) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'force-gnu-build-system-bootstrap - (lambda _ - (delete-file "configure"))))))) - (native-inputs - (modify-inputs (package-native-inputs base) - (prepend autoconf automake libtool))) + #~(delete "-Djs_engine=mozjs" #$flags)))) (inputs (modify-inputs (package-inputs base) (replace "mozjs" duktape)))))) -- cgit v1.2.3 From 575a03ab3997edee08d20867228e886043d5240f Mon Sep 17 00:00:00 2001 From: Brendan Tildesley Date: Tue, 1 Feb 2022 18:34:57 +1100 Subject: gnu: KDE Frameworks: Update all packages to 5.92.0 * gnu/packages/kde-frameworks.scm (extra-cmake-modules, attica, bluez-qt, breeze-icons, kapidox, karchive, kcalendarcore, kcodecs, kconfig, kcoreaddons, kdbusaddons, kdnssd, kguiaddons, kholidays, ki18n, kidletime, kirigami, kitemmodels, kitemviews, kplotting, ksyntaxhighlighting, kwayland, kwidgetsaddons, kwindowsystem, modemmanager-qt, networkmanager-qt, oxygen-icons, prison, qqc2-desktop-style, solid, sonnet, threadweaver, kactivities, kauth, kcompletion, kcontacts, kcrash, kdoctools, kfilemetadata, kimageformats, kjobwidgets, knotifications, kpackage, kpty, kunitconversion, syndication, baloo, kactivities-stats, kbookmarks, kcmutils, kconfigwidgets, kdeclarative, kded, kdesignerplugin, kdesu, kdewebkit, kemoticons, kglobalaccel, kiconthemes, kinit, kio, knewstuff, knotifyconfig, kparts, kpeople, krunner, kservice, ktexteditor, ktextwidgets, kwallet, kxmlgui, kxmlrpcclient, plasma-framework, purpose, kde-frameworkintegration, kdelibs4support, khtml, kjs, kjsembed, kmediaplayer, kross, kdav): Update to 5.92.0. (extra-cmake-modules)[arguments]: Disable failing test. Don't run check phase after install. (bluez): [arguments]: Enable tests. (breeze-icons): [native-inputs]: Remove uneeded dependency libxml2, Add python-lxml, python. (kapidox): Use python-build-system. [native-inputs]: Remove extraneous input. kcalendarcore: [arguments]: Enable as many tests as possible. (kconfig): [native-inputs]: Remove no longer needed inputs. [arguments]: Disable failing test. (kcoreaddons): [arguments]: Remove old hack, disable broken tests. (ki18n): [arguments]: Disable failing tests. (kguiaddons): [inputs]: Add new dependencies qtwayland, wayland. (kwidgetsaddons): [arguments]: Disable another failing test. (kwayland): [inputs]: Add plasma-wayland-protocols. [arguments]: Enable working tests. (knotifications): [native-inputs]: add libcanberra, libdbusmenu-qt, qtdeclarative-5. [arguments]: Respect tests? (sonnet): [inputs]: Add qtdeclarative-5. (kxmlgui): [inputs]: Add kguiaddons. (kxmlrpcclient): [source]: Update url. (plasma-framework): [arguments]: Enable all tests that work. [native-inputs]: Add kdoctools. (kpackage): [arguments]: Use substitution instead of patch. (kio): [inputs]: Add new dependencies. [native-inputs]: Add kdoctools. [arguments]: Enable all tests that work. (kdeclarative): [inputs]: Remove extraenous inputs. [propagated-inputs]: Propagate qtdeclarative, since it always seems to be needed. [native-inputs]: Add dbus to skip failing test. [arguments]: Replace check due to failing test. (solid): [arguments]: Respect tests?. (kdbusaddons): [arguments]: Respect tests?. Fix patch by replacing it with a substitution instead. (kholidays): [arguments]: Enable working test. (ksyntaxhighlighting): [arguments]: Don't patch file that doesn't exist any more. (kwindowsystem): [arguments]: Respect tests?. (modemmanager-qt): [arguments]: Respect tests?. (kauth): [arguments]: Respect tests?. (kfilemetadata): [arguments]: A different test fails now. (kunitconversion): [arguments]: Disable tests. (baloo): [arguments]: Enable tests. Respect tests?. (kconfigwidgets): Move qttools to native-inputs. (kded): [inputs]: Remove unneeded kinit input. [native-inputs]: Add kdoctools. (kdesignerplugin): [inputs]: Remove extraneous inputs. [native-inputs]: Add kdoctools. (kglobalaccel): [inputs]: Remove extraneous inputs. (kinit): [native-inputs]: Add kdoctools. (knewstuff): [inputs]: Add kpackage. (krunner): [arguments]: Disable failing tests. (kservice): [arguments]: Enable all tests that work. [native-inputs]: Add kdoctools. (ktexteditor): [arguments]: Enable all tests that work. (kwallet): [native-inputs]: Add kdoctools. (purpose): [arguments]: Remove unneeded hack. (kdelibs4support): Move qttools to native-inputs. [native-inputs]: Add kdoctools. (kcontacts): [inputs]: Add iso-codes since the tests look for some .json files from it. [arguments]: Disable failing tests. (networkmanager-qt): [arguments]: Respect tests?. * gnu/local.mk: Delete references to deleted patches: kdbusaddons-kinit-file-name.patch kinit-kdeinit-libpath.patch kpackage-allow-external-paths.patch kpackage-fix-KF5PackageMacros.cmake.patch plasma-framework-fix-KF5PlasmaMacros.cmake.patch * gnu/packages/patches/kdbusaddons-kinit-file-name.patch: Delete file. * gnu/packages/patches/kinit-kdeinit-libpath.patch: Delete file. * gnu/packages/patches/kpackage-allow-external-paths.patch: Delete file. * gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch: Delete file. * gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch: Delete file. * gnu/packages/patches/kinit-kdeinit-extra_libs.patch: Fix patch. Signed-off-by: Marius Bakke --- gnu/local.mk | 5 - gnu/packages/kde-frameworks.scm | 875 ++++++++++----------- .../patches/kdbusaddons-kinit-file-name.patch | 15 - .../patches/kinit-kdeinit-extra_libs.patch | 21 - gnu/packages/patches/kinit-kdeinit-libpath.patch | 37 - gnu/packages/patches/kio-search-smbd-on-PATH.patch | 46 +- .../patches/kpackage-allow-external-paths.patch | 13 - .../kpackage-fix-KF5PackageMacros.cmake.patch | 25 - ...lasma-framework-fix-KF5PlasmaMacros.cmake.patch | 25 - 9 files changed, 455 insertions(+), 607 deletions(-) delete mode 100644 gnu/packages/patches/kdbusaddons-kinit-file-name.patch delete mode 100644 gnu/packages/patches/kinit-kdeinit-libpath.patch delete mode 100644 gnu/packages/patches/kpackage-allow-external-paths.patch delete mode 100644 gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch delete mode 100644 gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 211a13c3b1..b20d16b8a6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1354,7 +1354,6 @@ dist_patch_DATA = \ %D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch \ %D%/packages/patches/julia-tracker-16-compat.patch \ %D%/packages/patches/julia-allow-parallel-build.patch \ - %D%/packages/patches/kdbusaddons-kinit-file-name.patch \ %D%/packages/patches/libffi-3.3-powerpc-fixes.patch \ %D%/packages/patches/libffi-float128-powerpc64le.patch \ %D%/packages/patches/libobjc2-unbundle-robin-map.patch \ @@ -1371,14 +1370,11 @@ dist_patch_DATA = \ %D%/packages/patches/kiki-missing-includes.patch \ %D%/packages/patches/kiki-portability-64bit.patch \ %D%/packages/patches/kinit-kdeinit-extra_libs.patch \ - %D%/packages/patches/kinit-kdeinit-libpath.patch \ %D%/packages/patches/kio-search-smbd-on-PATH.patch \ %D%/packages/patches/kismet-unbundle-boost.patch \ %D%/packages/patches/kmail-Fix-missing-link-libraries.patch \ %D%/packages/patches/kmod-module-directory.patch \ %D%/packages/patches/kmscon-runtime-keymap-switch.patch \ - %D%/packages/patches/kpackage-allow-external-paths.patch \ - %D%/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch \ %D%/packages/patches/kmplayer-aarch64.patch \ %D%/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch \ %D%/packages/patches/kobodeluxe-paths.patch \ @@ -1609,7 +1605,6 @@ dist_patch_DATA = \ %D%/packages/patches/pciutils-hurd-configure.patch \ %D%/packages/patches/pciutils-hurd-fix.patch \ %D%/packages/patches/pjproject-install-libpjsua2.patch \ - %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \ %D%/packages/patches/pokerth-boost.patch \ %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch \ %D%/packages/patches/pthreadpool-system-libraries.patch \ diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm index 738013fdba..26c21d168d 100644 --- a/gnu/packages/kde-frameworks.scm +++ b/gnu/packages/kde-frameworks.scm @@ -28,6 +28,7 @@ (define-module (gnu packages kde-frameworks) #:use-module (guix build-system cmake) + #:use-module (guix build-system python) #:use-module (guix build-system qt) #:use-module (guix build-system trivial) #:use-module (guix download) @@ -61,8 +62,10 @@ (define-module (gnu packages kde-frameworks) #:use-module (gnu packages graphviz) #:use-module (gnu packages gstreamer) #:use-module (gnu packages image) + #:use-module (gnu packages iso-codes) #:use-module (gnu packages kerberos) #:use-module (gnu packages kde-plasma) + #:use-module (gnu packages libcanberra) #:use-module (gnu packages libreoffice) #:use-module (gnu packages linux) #:use-module (gnu packages mp3) @@ -88,7 +91,7 @@ (define-module (gnu packages kde-frameworks) (define-public extra-cmake-modules (package (name "extra-cmake-modules") - (version "5.91.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -97,7 +100,7 @@ (define-public extra-cmake-modules name "-" version ".tar.xz")) (sha256 (base32 - "0k65rvxh926ya6qahzk2ns7g1fya1429648mlx7iipxa61g8h5wp")))) + "1vq3sd4qfr4hjcgqyfpykcz5wyagbfvrd4p24pdki1zjqn5j76pq")))) (build-system cmake-build-system) (native-inputs ;; Add test dependency, except on armhf where building it is too @@ -251,7 +254,7 @@ (define-public phonon-backend-gstreamer (define-public attica (package (name "attica") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -260,7 +263,7 @@ (define-public attica name "-" version ".tar.xz")) (sha256 (base32 - "1njw1sifykyqldb5idaywdzi3xg7a6bvzkrvazwmyixd0npq12dx")))) + "0cy9dd8kazfkhas87bxjj5smmzay3gvkjwsmy6gvkfxc6rvpqr5z")))) (build-system cmake-build-system) (arguments `(#:phases @@ -291,7 +294,7 @@ (define-public attica (define-public bluez-qt (package (name "bluez-qt") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -300,7 +303,7 @@ (define-public bluez-qt name "-" version ".tar.xz")) (sha256 (base32 - "1kqhps4qyvqm0qmk7fb3w41bib898amipchf8csdzacw4bzpri9k")))) + "1dlasb39kqrcql6hq0sl74ax3n5bdcy3pkhvc9vwpf9dxn1j93gm")))) (build-system cmake-build-system) (native-inputs (list dbus extra-cmake-modules)) @@ -313,7 +316,13 @@ (define-public bluez-qt "-DUDEV_RULES_INSTALL_DIR=" #$output "/lib/udev/rules.d")) ;; TODO: Make tests pass: DBUS_FATAL_WARNINGS=0 still yields 7/8 tests ;; failing. When running after install, tests hang. - #:tests? #f)) + #:phases + '(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "QML wrapper for BlueZ") (description "bluez-qt is a Qt-style library for accessing the bluez @@ -323,7 +332,7 @@ (define-public bluez-qt (define-public breeze-icons (package (name "breeze-icons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -332,12 +341,15 @@ (define-public breeze-icons name "-" version ".tar.xz")) (sha256 (base32 - "0lqglrjgjb4ralgmr7lb9k7acmn8q4jm18s4p3gbgd9iswyqgsbm")))) + "0rj30r52ca6njx00gmmni4k70yn8873ihxfbc66lklwzk1irdq29")))) (build-system cmake-build-system) (native-inputs - (list extra-cmake-modules fdupes libxml2)) + (list extra-cmake-modules fdupes + python python-lxml)) ;; For 24x24 icon generation (inputs (list qtbase-5)) + (arguments ;; fails because duplicate icons exist. TODO: try fix this. + `(#:tests? #f)) (home-page "https://community.kde.org/Frameworks") (synopsis "Default KDE Plasma 5 icon theme") (description "Breeze provides a freedesktop.org compatible icon theme. @@ -350,7 +362,7 @@ (define-public breeze-icons (define-public kapidox (package (name "kapidox") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -359,12 +371,12 @@ (define-public kapidox name "-" version ".tar.xz")) (sha256 (base32 - "1irl25pf60frzrmm1ksgjq6y8kn3rd5snliq69l4c42yznl9qv1j")))) - (build-system cmake-build-system) + "0vd5k4wmmawbhyy3cxj0gjidf4haghwbsbly9yr3zg3qb3g02ljg")))) + (build-system python-build-system) (arguments - `(#:tests? #f)) ; has no test target - (native-inputs - (list extra-cmake-modules)) + `(#:tests? #f ; has no test target + #:phases (modify-phases %standard-phases + (delete 'sanity-check)))) ;its insane. (propagated-inputs ;; kapidox is a python programm ;; TODO: check if doxygen has to be installed, the readme does not @@ -390,7 +402,7 @@ (define-public kapidox (define-public karchive (package (name "karchive") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -399,12 +411,14 @@ (define-public karchive name "-" version ".tar.xz")) (sha256 (base32 - "0z8asn357pdbv4g9g0x18p72wskca1qanxljyix7wzc5rsi63wzm")))) + "1blzm6vf8kpflam4671r1y4svrsb79bglln7aia7baqh7a6a4xjh")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) + ;; pkg-config ;; For zstd (inputs (list bzip2 qtbase-5 xz zlib)) + ;; `(,zstd "lib") ;; FIXME: Tests fail with zstd (home-page "https://community.kde.org/Frameworks") (synopsis "Qt 5 addon providing access to numerous types of archives") (description "KArchive provides classes for easy reading, creation and @@ -421,7 +435,7 @@ (define-public karchive (define-public kcalendarcore (package (name "kcalendarcore") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -430,7 +444,7 @@ (define-public kcalendarcore name "-" version ".tar.xz")) (sha256 (base32 - "1y1f8gc1g9yn9kgmn53f1zvkizasfs667dfin3fyci657r5qwpw2")))) + "0fhbas8i7i08z4x32yq49admiz8vk4h9vwgkh7qy14lbzf6ydwkg")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules perl tzdata-for-tests)) @@ -439,30 +453,20 @@ (define-public kcalendarcore (arguments `(#:phases (modify-phases %standard-phases - (add-before 'configure 'disable-failing-libical3-tests - (lambda _ - ;; testicaltimezones fails with some time-zone issue - (substitute* "autotests/CMakeLists.txt" - (("macro_unit_tests\\(testicaltimezones\\)" line) - (string-append "## " line)) - (("target_link_libraries\\(testicaltimezones " line) - (string-append "## " line))) - (for-each - delete-file - (list - ;; test cases are generated for each .ics file. These fail: - "autotests/data/Compat-libical3/AppleICal_1.5.ics" - "autotests/data/Compat-libical3/Evolution_2.8.2_timezone_test.ics" - "autotests/data/Compat-libical3/KOrganizer_3.1a.ics" - "autotests/data/Compat-libical3/MSExchange.ics" - "autotests/data/Compat-libical3/Mozilla_1.0.ics")) - #t)) - (add-before 'check 'set-timezone - (lambda* (#:key inputs #:allow-other-keys) + (add-before 'check 'check-setup + (lambda* (#:key inputs #:allow-other-keys) ;;; XXX: failing test + (setenv "QT_QPA_PLATFORM" "offscreen") (setenv "TZ" "Europe/Prague") (setenv "TZDIR" (search-input-directory inputs - "share/zoneinfo"))))))) + "share/zoneinfo")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; Its already been fixed upstream; remove in 5.93. + ;; c0428a284444b995d320046c04ef5377d51e4c5c + (invoke "ctest" "-E" "testdateserialization")) + #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Library for interfacing with calendars") (description "This library provides access to and handling of calendar @@ -478,7 +482,7 @@ (define-public kcalendarcore (define-public kcodecs (package (name "kcodecs") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -487,7 +491,7 @@ (define-public kcodecs name "-" version ".tar.xz")) (sha256 (base32 - "0y9n2a5n18pasdmrp0xb84hla9l27yj2x3k4p1c041sd9nkwixpk")))) + "0xfjc0diljx081as3b500awybay9l3sfl59792h5z3clafjbgrfn")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules gperf qttools-5)) @@ -512,7 +516,7 @@ (define-public kcodecs (define-public kconfig (package (name "kconfig") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -521,7 +525,7 @@ (define-public kconfig name "-" version ".tar.xz")) (sha256 (base32 - "1s3h4hfpw7c0894cifj66bj1yhx8g94ckvl71jm7qqsb5x5h6y9n")))) + "08q57f3wxj22d485s0ph53p44yrkjb376817470a0s43p10vc0bq")))) (build-system cmake-build-system) (native-inputs (list dbus extra-cmake-modules inetutils qttools-5 @@ -531,15 +535,14 @@ (define-public kconfig (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - (setenv "TMPDIR" (getcwd)) - #t)) (replace 'check - (lambda _ - (setenv "QT_QPA_PLATFORM" "offscreen") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? ;; kconfigcore-kconfigtest fails inconsistently!! + (setenv "HOME" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + (invoke "ctest" "-E" "(kconfigcore-kconfigtest|\ +kconfiggui-kstandardshortcutwatchertest)")) + #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Kconfiguration settings framework for Qt") (description "KConfig provides an advanced configuration system. @@ -574,7 +577,7 @@ (define-public kconfig (define-public kcoreaddons (package (name "kcoreaddons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -583,39 +586,23 @@ (define-public kcoreaddons name "-" version ".tar.xz")) (sha256 (base32 - "10a7zys3limsawl7lk9ggymk3msk2bp0y8hp0jmsvk3l405pd1ps")))) + "0rv63byrxwf9zdpx347rxybpk2j9yyjqm323j60vb8ja6a7p2pyz")))) (build-system cmake-build-system) (native-inputs - (list extra-cmake-modules qttools-5 shared-mime-info + (list extra-cmake-modules qttools-5 shared-mime-info)) ;; TODO: FAM: File alteration notification http://oss.sgi.com/projects/fam - xorg-server-for-tests)) ; for the tests (inputs (list qtbase-5)) (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'blacklist-failing-test - (lambda _ - ;; Blacklist failing tests. - (with-output-to-file "autotests/BLACKLIST" - (lambda _ - ;; FIXME: Make it pass. Test failure caused by stout/stderr - ;; being interleaved. - (display "[test_channels]\n*\n") - ;; This fails with ENOSPC because of too many inotify watches. - (display "[benchNotifyWatcher]\n*\n"))) - #t)) - ;; See upstream commit ee424e9b62368485bba4193053cabb553a1d268e - (add-after 'unpack 'fix-broken-test - (lambda _ - (substitute* "autotests/kdirwatch_unittest.cpp" - (("QVERIFY\\(waitForRecreationSignal\\(watch, existingFile\\)\\);" m) - (string-append m "\nwaitUntilNewSecond();"))) - #t)) - (add-before 'check 'check-setup - (lambda _ + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) (setenv "HOME" (getcwd)) (setenv "TMPDIR" (getcwd)) + (when tests? ;; kdirwatch test fails inconsistently. kprocesstest fails. + (invoke "ctest" "-E" "(kdirwatch_qfswatch_unittest|kprocesstest|\ +kdirwatch_stat_unittest)")) #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Qt addon library with a collection of non-GUI utilities") @@ -629,7 +616,7 @@ (define-public kcoreaddons (define-public kdbusaddons (package (name "kdbusaddons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -638,27 +625,29 @@ (define-public kdbusaddons name "-" version ".tar.xz")) (sha256 (base32 - "1vz2hg5p8wvfk0pi8v25zqzcn8yj7ykakxjyipmadvi02c1h8gic")) - (patches (search-patches "kdbusaddons-kinit-file-name.patch")))) + "0m5fd396xi3dhc45zwxjrrxr2bhlrc8g8m7n17jq1ylzqhyg60vw")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules dbus qttools-5)) (inputs - (list qtbase-5 qtx11extras kinit-bootstrap)) ;; kinit-bootstrap: kinit package which does not depend on kdbusaddons. + (list qtbase-5 qtx11extras kinit-bootstrap)) + ;; kinit-bootstrap: kinit package which does not depend on kdbusaddons. (arguments `(#:phases (modify-phases %standard-phases - (add-before - 'configure 'patch-source + (add-before 'configure 'patch-source (lambda* (#:key inputs #:allow-other-keys) ;; look for the kdeinit5 executable in kinit's store directory, ;; instead of the current application's directory: (substitute* "src/kdeinitinterface.cpp" - (("@SUBSTITUTEME@") (assoc-ref inputs "kinit"))))) + (("<< QCoreApplication::applicationDirPath..") + (string-append + "<< QString::fromUtf8(\"" (assoc-ref inputs "kinit") "/bin\")" ))))) (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Convenience classes for DBus") (description "KDBusAddons provides convenience classes on top of QtDBus, @@ -670,7 +659,7 @@ (define-public kdbusaddons (define-public kdnssd (package (name "kdnssd") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -679,7 +668,7 @@ (define-public kdnssd name "-" version ".tar.xz")) (sha256 (base32 - "0wadknnf472rqg2xnqzs5v23qzqfr336wj6d96yg2ayqm0chbppy")))) + "1m24v36pphy591z1xp90i0yxv70c62iinvy4gspdi15bz94sydjz")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -725,7 +714,7 @@ (define-public kgraphviewer (define-public kguiaddons (package (name "kguiaddons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -734,7 +723,7 @@ (define-public kguiaddons name "-" version ".tar.xz")) (sha256 (base32 - "1yndjdhb9zzlhh74xccpys38balm5dma56sx6bwwfrga1phq0g5l")))) + "0pyzgyrglvz2m11b82rycs9fbmzpfgzabnjkvsq00agjcnjparqg")))) (build-system qt-build-system) ;; TODO: Build packages for the Python bindings. Ideally this will be ;; done for all versions of python guix supports. Requires python, @@ -743,7 +732,7 @@ (define-public kguiaddons (native-inputs (list extra-cmake-modules pkg-config)) (inputs - (list qtbase-5 qtx11extras)) + (list qtbase-5 qtwayland qtx11extras wayland)) (home-page "https://community.kde.org/Frameworks") (synopsis "Utilities for graphical user interfaces") (description "The KDE GUI addons provide utilities for graphical user @@ -753,7 +742,7 @@ (define-public kguiaddons (define-public kholidays (package (name "kholidays") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -761,18 +750,8 @@ (define-public kholidays (version-major+minor version) "/" name "-" version ".tar.xz")) (sha256 - (base32 "1rifx51yk24sk578h08s1bwpqb61rnyyks33zpl82lcdnl1ljp26")))) + (base32 "042bdg46hkpg66vdp9gk13wck5yhks8s6i9qz9xzh2mikz285lqf")))) (build-system cmake-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - ;; blacklist a failing test function TODO: make it pass - (with-output-to-file "autotests/BLACKLIST" - (lambda _ - (display "[testDefaultRegions]\n*\n"))) - #t))))) (native-inputs (list extra-cmake-modules qttools-5)) (inputs @@ -786,7 +765,7 @@ (define-public kholidays (define-public ki18n (package (name "ki18n") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -795,21 +774,22 @@ (define-public ki18n name "-" version ".tar.xz")) (sha256 (base32 - "1f952488492sm904i1iwgjp2gc7z07312mlshw4ckh2801y0qclc")))) + "0xsp77iaxf72i0ri3pb6x5rrdz3cv8rxcaqcrynisvsmx7l35005")))) (build-system cmake-build-system) (propagated-inputs (list gettext-minimal python)) (native-inputs (list extra-cmake-modules)) (inputs - (list qtbase-5 qtdeclarative-5 qtscript)) + (list qtbase-5 qtdeclarative-5 qtscript iso-codes)) (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - #t))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (invoke "ctest" "-E" "(kcountrytest|kcountrysubdivisiontest)"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "KDE Gettext-based UI text internationalization") (description "KI18n provides functionality for internationalizing user @@ -826,7 +806,7 @@ (define-public ki18n (define-public kidletime (package (name "kidletime") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -835,7 +815,7 @@ (define-public kidletime name "-" version ".tar.xz")) (sha256 (base32 - "0vbxs80a8kh2xbxclx8zwl7acynsasa7i0cs171fxr26d0dmmhm5")))) + "1mw0jarqv2ypxwgf4qaxqlw0sijw0is36sasrfz8grbykwi18bz1")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) @@ -855,7 +835,7 @@ (define-public kirigami ;; plasma-framework which is tier 3. (package (name "kirigami") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -864,7 +844,7 @@ (define-public kirigami "kirigami2-" version ".tar.xz")) (sha256 (base32 - "0akkyif6n9l7hw4cj6nkf1zwgnd7vqi1gyiqmn588rspgl91zf1w")))) + "0p1x40p38pr9rvzwil57asgsaa95qpjqi9npwv4pgibhxacgznha")))) (properties `((upstream-name . "kirigami2"))) (build-system cmake-build-system) (native-inputs @@ -890,7 +870,7 @@ (define-public kirigami (define-public kitemmodels (package (name "kitemmodels") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -899,7 +879,7 @@ (define-public kitemmodels name "-" version ".tar.xz")) (sha256 (base32 - "0x7y5shg2pp490hvmkz81b8j01cha9j1001q34m7pnyf0n3zknzc")))) + "16z8m11cyrapf6m56gmpjmvcgan7s50si8rl1cbbid02src7yp76")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -940,7 +920,7 @@ (define-public kitemmodels (define-public kitemviews (package (name "kitemviews") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -949,7 +929,7 @@ (define-public kitemviews name "-" version ".tar.xz")) (sha256 (base32 - "04vlmkvc3y5h7cpb6kdv9gha5axxkimhqh44mdg2ncyn4sas6j68")))) + "1ml6i1km22xsprldkzmngfh9xs5vdhlfvc6f7aq5hx9q5114v2q5")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -965,7 +945,7 @@ (define-public kitemviews (define-public kplotting (package (name "kplotting") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -974,7 +954,7 @@ (define-public kplotting name "-" version ".tar.xz")) (sha256 (base32 - "1wj4n2a8iz9ml1y0012xkpsx3dfp5gl2dn80sifrzvkxjxrhwach")))) + "1l8y0xlwjyv1l4g0mag4bgf906jc654ygky1bribzay4wki66pf9")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -992,7 +972,7 @@ (define-public kplotting (define-public ksyntaxhighlighting (package (name "ksyntaxhighlighting") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1001,7 +981,7 @@ (define-public ksyntaxhighlighting "syntax-highlighting-" version ".tar.xz")) (sha256 (base32 - "12jn7lqsp86329spai7n1n8i65nwhxh8gp33wkq543h7w3i2a3jb")))) + "03p5qzf13nbf54gzad3q1q6i33iggz3ik0ydr9szhj92kfppwd4r")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules perl qttools-5 @@ -1016,9 +996,6 @@ (define-public ksyntaxhighlighting (lambda _ ;; revert the patch-shebang phase on scripts which are ;; in fact test data - (substitute* '("autotests/input/test.bash" - "autotests/folding/test.bash.fold") - (((which "bash")) "/bin/bash")) (substitute* '("autotests/input/highlight.sh" "autotests/folding/highlight.sh.fold") (((which "sh")) " /bin/sh")) ;; space in front! @@ -1063,7 +1040,7 @@ (define-public plasma-wayland-protocols (define-public kwayland (package (name "kwayland") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1072,20 +1049,21 @@ (define-public kwayland name "-" version ".tar.xz")) (sha256 (base32 - "0hrpbfzixjpnfy9q5x66q1fff0p7n80rrs127zzdv68pyi6456ry")))) + "15fizsbdl6psmi24fvpfk9dvh61q07irzavpkl961qp4zg79gq4m")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) (inputs - (list qtbase-5 qtwayland wayland wayland-protocols)) + (list qtbase-5 plasma-wayland-protocols qtwayland wayland wayland-protocols)) (arguments - `(#:tests? #f ; FIXME tests require weston to run - ; weston requires wayland flags in mesa - #:phases + `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "XDG_RUNTIME_DIR" "/tmp") + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (setenv "XDG_RUNTIME_DIR" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + (when tests? ;; One test fails. + (invoke "ctest" "-E" "kwayland-testWaylandRegistry")) #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Qt-style API to interact with the wayland client and server") @@ -1100,7 +1078,7 @@ (define-public kwayland (define-public kwidgetsaddons (package (name "kwidgetsaddons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1109,7 +1087,7 @@ (define-public kwidgetsaddons name "-" version ".tar.xz")) (sha256 (base32 - "03l37lh219np7pqfa56r2v7n5s5xg4rjq005qng4b5izd95ri56j")))) + "0b0z24j162j39zfycl5al69xcqgdsr96p7ii3prm1mbyda6mbqyh")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5 xorg-server-for-tests)) @@ -1118,12 +1096,12 @@ (define-public kwidgetsaddons (arguments `(#:phases (modify-phases %standard-phases - (add-after 'unpack 'adjust-tests - (lambda _ - ;; It is unclear why this test suddenly started failing. - (substitute* "autotests/kcolumnresizertest.cpp" - ((".*QCOMPARE.*") "")) - #t))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "XDG_CACHE_HOME" "/tmp/xdg-cache") + (invoke "ctest" "-E" "(ksqueezedtextlabelautotest|\ +kwidgetsaddons-kcolumnresizertest)"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Large set of desktop widgets") (description "Provided are action classes that can be added to toolbars or @@ -1135,7 +1113,7 @@ (define-public kwidgetsaddons (define-public kwindowsystem (package (name "kwindowsystem") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1144,7 +1122,7 @@ (define-public kwindowsystem name "-" version ".tar.xz")) (sha256 (base32 - "0a68cj0bsl5a9sxfd969khznycrn9p6grp2b08hqacxqdknzs0wh")))) + "103xvhzlggi05k16s9kssy7g5a74k9yildj1a4igqwi39wmvvnyw")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules @@ -1171,16 +1149,18 @@ (define-public kwindowsystem (display "[testClientMachine]\n*\n"))) ;; requires network #t)) (replace 'check - (lambda _ + (lambda* (#:key tests? #:allow-other-keys) ;; The test suite requires a running window anager - (setenv "XDG_RUNTIME_DIR" "/tmp") - (system "Xvfb :1 -ac -screen 0 640x480x24 &") - (setenv "DISPLAY" ":1") - (sleep 5) ;; Give Xvfb a few moments to get on it's feet - (system "openbox &") - (setenv "CTEST_OUTPUT_ON_FAILURE" "1") - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (when tests? + (setenv "XDG_RUNTIME_DIR" "/tmp") + (system "Xvfb :1 -ac -screen 0 640x480x24 &") + (setenv "DISPLAY" ":1") + (sleep 5) ;; Give Xvfb a few moments to get on it's feet + (system "openbox &") + (setenv "CTEST_OUTPUT_ON_FAILURE" "1") + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest" "-E" + "kwindowsystem-kwindowsystemplatformwaylandtest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "KDE access to the windowing system") (description "KWindowSystem provides information about and allows @@ -1198,7 +1178,7 @@ (define-public kwindowsystem (define-public modemmanager-qt (package (name "modemmanager-qt") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1207,7 +1187,7 @@ (define-public modemmanager-qt name "-" version ".tar.xz")) (sha256 (base32 - "0ydq1l823jgp0yrrpqi1zdk5dsg65ydk1x082qwsa9a0vzs0np3x")))) + "162qzq1aqv2l3bi0r01xrfan20r1zhaaqih4dqbaj7vqibsb9l3y")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules dbus pkg-config)) @@ -1220,9 +1200,11 @@ (define-public modemmanager-qt `(#:phases (modify-phases %standard-phases (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest")) + #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Qt wrapper for ModemManager DBus API") (description "ModemManagerQt provides access to all ModemManager features @@ -1234,7 +1216,7 @@ (define-public modemmanager-qt (define-public networkmanager-qt (package (name "networkmanager-qt") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1243,7 +1225,7 @@ (define-public networkmanager-qt name "-" version ".tar.xz")) (sha256 (base32 - "1h2kdw5vs7mn3n7bvqwm36a48ra9iap6384kanz14zjbankj04c1")))) + "0r7s3fw9fk3pkrzrl1bxsmkf1qbgv3p0jrsskp28f3561vncipai")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules dbus pkg-config)) @@ -1257,9 +1239,10 @@ (define-public networkmanager-qt `(#:phases (modify-phases %standard-phases (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Qt wrapper for NetworkManager DBus API") (description "NetworkManagerQt provides access to all NetworkManager @@ -1271,7 +1254,7 @@ (define-public networkmanager-qt (define-public oxygen-icons (package (name "oxygen-icons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1280,7 +1263,7 @@ (define-public oxygen-icons name "5" "-" version ".tar.xz")) (sha256 (base32 - "1rjsnz0g7zyzgii26sk370adb6jcyvr2lm8qi23fvqimifngqm2c")))) + "1wcy8bv4d6jns7vaisbvjc8nxriw9vkiz7j4za5ry7wnvlzv126a")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules fdupes)) @@ -1295,7 +1278,7 @@ (define-public oxygen-icons (define-public prison (package (name "prison") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -1303,7 +1286,7 @@ (define-public prison (version-major+minor version) "/" name "-" version ".tar.xz")) (sha256 - (base32 "1qflivvb593d2npc218xkdn3w5zvl7x8v1b52ydnggsxzbgkqvb4")))) + (base32 "07p47q8sva82hglfzp145a1sajlal8b3qshhkicc9rkbsngywvvy")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -1318,14 +1301,14 @@ (define-public prison (define-public pulseaudio-qt (package (name "pulseaudio-qt") - (version "1.2") + (version "1.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/pulseaudio-qt" "/pulseaudio-qt-" version ".tar.xz")) (sha256 (base32 - "1i0ql68kxv9jxs24rsd3s7jhjid3f2fq56fj4wbp16zb4wd14099")))) + "1i4yb0v1mmhih8c2i61hybg6q60qys3pc5wbjb7a0vwl1mihgsxw")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) @@ -1345,7 +1328,7 @@ (define-public pulseaudio-qt (define-public qqc2-desktop-style (package (name "qqc2-desktop-style") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1354,7 +1337,7 @@ (define-public qqc2-desktop-style name "-" version ".tar.xz")) (sha256 (base32 - "1n47cl082zqdw6ykil04rw6bws4fn1m8wfx4vxv1aqj9warbdks3")))) + "1b5xr71lan7ixvd1nfxy9wj21h4wwidsaxa192sha1d8p49hhlwp")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) @@ -1378,7 +1361,7 @@ (define-public qqc2-desktop-style (define-public solid (package (name "solid") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1387,15 +1370,16 @@ (define-public solid name "-" version ".tar.xz")) (sha256 (base32 - "0alng7ciw6xji0s2zrk8dsx1p0p9shrrfzl8wnkwygc5chnhysz7")))) + "172sid8l1znzxxz0hi5m19yy4vg7l1nbghvzjvh18ssbmxcwh9l9")))) (build-system cmake-build-system) (arguments `(#:phases (modify-phases %standard-phases (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest"))))))) (native-inputs (list bison dbus extra-cmake-modules flex qttools-5)) (inputs @@ -1411,7 +1395,7 @@ (define-public solid (define-public sonnet (package (name "sonnet") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1420,13 +1404,14 @@ (define-public sonnet name "-" version ".tar.xz")) (sha256 (base32 - "0b88h5fw1n8zyrg0vq3lj2jbjjyh0mk64lj6ab3643kxzqxbn30w")))) + "08jps1hy0qvk62wnzn50qi8iaay7xav3hbcj55sk70mm7pd1vz1i")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules pkg-config qttools-5)) (inputs (list hunspell ;; TODO: hspell (for Hebrew), Voikko (for Finish) + qtdeclarative-5 qtbase-5)) (home-page "https://community.kde.org/Frameworks") (synopsis "Multi-language spell checker") @@ -1438,7 +1423,7 @@ (define-public sonnet (define-public threadweaver (package (name "threadweaver") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1447,7 +1432,7 @@ (define-public threadweaver name "-" version ".tar.xz")) (sha256 (base32 - "0y1q0wy073lf11g4jrp4bdw4kpj4ibqfscsxj6zlh8ban9zlf389")))) + "008in2wbl6zr404m9hbqdvy3d4r06mmb3jrr13myldwljqywzc28")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -1468,7 +1453,7 @@ (define-public threadweaver (define-public kactivities (package (name "kactivities") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1477,7 +1462,7 @@ (define-public kactivities name "-" version ".tar.xz")) (sha256 (base32 - "1whsp0f87lrcn61s9rfhy0aj68hm6zgfa38mq6frlkcjksi0z1vn")))) + "1kfvg23gdl4k6azs6700j8i8ncl8c7rrc70w1i2xhphz27ybc1pw")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1513,7 +1498,7 @@ (define-public kactivities (define-public kauth (package (name "kauth") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1522,7 +1507,7 @@ (define-public kauth name "-" version ".tar.xz")) (sha256 (base32 - "0nmdz7ra3hpg0air4lfkzilv7cwx3zxs29k7sh8l3i1fs3qpjwxm")))) + "0a27z9xr5ccxfcxmx93vs4hgxc388nsd9ac906mdh475ivv4p0j4")))) (build-system cmake-build-system) (native-inputs (list dbus extra-cmake-modules qttools-5)) @@ -1543,9 +1528,10 @@ (define-public kauth (("@KAUTH_HELPER_INSTALL_ABSOLUTE_DIR@") "${KDE_INSTALL_LIBEXECDIR}")))) (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Execute actions as privileged user") (description "KAuth provides a convenient, system-integrated way to offload @@ -1556,7 +1542,7 @@ (define-public kauth (define-public kcompletion (package (name "kcompletion") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1565,7 +1551,7 @@ (define-public kcompletion name "-" version ".tar.xz")) (sha256 (base32 - "1pjgya8wi28jx63hcdi9v5f5487gzbkw2j1iganhd7bhcb8s7zpy")))) + "1svwvj9jxkgcddfdila10ggdmsabs22vnhf9k7isp2zfdif55w88")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -1581,7 +1567,7 @@ (define-public kcompletion (define-public kcontacts (package (name "kcontacts") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1590,7 +1576,7 @@ (define-public kcontacts name "-" version ".tar.xz")) (sha256 (base32 - "182ma11z3kqxq3cwy7kwprfqkb9bcmn44w7k9vixbid4pv5wa0lb")))) + "1kik4pvy8snvj6rsc9pfbcpc8rrcn0k4pjj1h9m221zma1p00xhj")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules xorg-server)) ; for the tests @@ -1598,18 +1584,28 @@ (define-public kcontacts (list qtbase-5)) (propagated-inputs (list ;; As required by KF5ContactsConfig.cmake. - kcodecs kconfig kcoreaddons ki18n)) + iso-codes kcodecs kconfig kcoreaddons qtdeclarative-5 ki18n)) (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'start-xorg-server - (lambda* (#:key inputs #:allow-other-keys) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) ;; The test suite requires a running X server. ;; Xvfb doesn't have proper glx support and needs a pixeldepth ;; of 24 bit to avoid "libGL error: failed to load driver: swrast" ;; "Could not initialize GLX" - (system "Xvfb :1 -screen 0 640x480x24 &") - (setenv "DISPLAY" ":1") + (when tests? + (setenv "HOME" (getcwd)) + (system "Xvfb :1 -screen 0 640x480x24 &") + (setenv "DISPLAY" ":1") + ;; testrounddrip fail inconsistently. + ;; addresstest produces wrong value: + ;;Actual (address.formattedAddress(QStringLiteral("Jim Knopf"))): + ;;"Jim Knopf\nLummerlandstr. 1\n12345 Lummerstadt\n\nGERMANY" + ;;Expected (result) : + ;;"Jim Knopf\nLummerlandstr. 1\n12345 Lummerstadt\n\nGERMANIA" + (invoke "ctest" "-E" + "(kcontacts-addresstest|kcontacts-emailtest|kcontacts-phonenumbertest|kcontacts-secrecytest|kcontacts-geotest|kcontacts-keytest|kcontacts-testroundtrip|kcontacts-impptest|kcontacts-birthdaytest|kcontacts-addresseetest)")) #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "API for contacts/address book data following the vCard standard") @@ -1622,7 +1618,7 @@ (define-public kcontacts (define-public kcrash (package (name "kcrash") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1631,7 +1627,7 @@ (define-public kcrash name "-" version ".tar.xz")) (sha256 (base32 - "11sy9hrjpvybqi53qjrnncy9mzifrb3vqxi2d12ldjzqyqd8pirp")))) + "1ir64mlv49vh3vz81r22q3sx0fichiwjr8qw5jf5vx96a1dn1icv")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1646,7 +1642,7 @@ (define-public kcrash (define-public kdoctools (package (name "kdoctools") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1655,7 +1651,7 @@ (define-public kdoctools name "-" version ".tar.xz")) (sha256 (base32 - "0g0k83np2xaxk05spf14h5fvzy0n7kbcwx1sa9wjh570f6jx87am")))) + "0w08fa8rl0dhp59lv6xcvypahl6pxda6cr0vv0f0xv0xp6wax8w6")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -1703,7 +1699,7 @@ (define-public kdoctools (define-public kfilemetadata (package (name "kfilemetadata") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1712,25 +1708,22 @@ (define-public kfilemetadata name "-" version ".tar.xz")) (sha256 (base32 - "18n1a5857090a1c1rxzd07sxs652gl6wr3n99sp8rxmvkghn9zsj")))) + "1khmx9kd1jhd6j7rmfww3vmyjz2pg36mpsdn0bc77kwl21ax696n")))) (build-system cmake-build-system) (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'disable-failing-test - (lambda _ - ;; Blacklist a failing test-function. FIXME: Make it pass. - ;; UserMetaDataWriterTest fails with getxattr("…/writertest.txt") - ;; -> EOPNOTSUPP (Operation not supported) - (with-output-to-file "autotests/BLACKLIST" - (lambda _ - (display "[testMimetype]\n*\n") - (display "[test]\n*\n"))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; FIXME: Test can't find audio/x-speex mimeinfo + ;; (but it can find audio/x-speex+ogg). + (invoke "ctest" "-E" + "(usermetadatawritertest|embeddedimagedatatest|taglibextractortest)")) #t))))) (native-inputs `(("extra-cmake-modules" ,extra-cmake-modules) - ("pkg-config" ,pkg-config) - ("python-2" ,python-2))) + ("pkg-config" ,pkg-config))) (inputs (list attr ;; TODO: EPub http://sourceforge.net/projects/ebook-tools @@ -1757,7 +1750,7 @@ (define-public kfilemetadata (define-public kimageformats (package (name "kimageformats") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1766,7 +1759,7 @@ (define-public kimageformats name "-" version ".tar.xz")) (sha256 (base32 - "0pk4b725wapzdxv1mm6ddqcl6z8ffcpr32i5vrhrin8awi5gx13s")))) + "0sd3xhqh3zgy4jq8fc1llqjrxizylbsz58njz2dxqjas2a4rj16f")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) @@ -1810,7 +1803,7 @@ (define-public kimageformats (define-public kjobwidgets (package (name "kjobwidgets") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1819,7 +1812,7 @@ (define-public kjobwidgets name "-" version ".tar.xz")) (sha256 (base32 - "13kdczzyyh17hf6vlhh4li5bn4yq5bab5xa8mm63r9rynxihgclf")))) + "09l5zgr5mn29v410ng5rccdg2bki9r6cb8y2lrijzgfxfxpvj96z")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -1834,7 +1827,7 @@ (define-public kjobwidgets (define-public knotifications (package (name "knotifications") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1843,7 +1836,7 @@ (define-public knotifications name "-" version ".tar.xz")) (sha256 (base32 - "01bn23xw2n53h9nl99lm3cjnqs8s66bmwkzf6fkpg9rzkykizbyc")))) + "1dwlx8w810l0cvy72mj52saf4x7i9p3xpqpjx4chy54n7mg0jklc")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules dbus qttools-5)) @@ -1852,23 +1845,23 @@ (define-public knotifications kconfig kcoreaddons kwindowsystem + libcanberra + libdbusmenu-qt phonon + qtdeclarative-5 qtbase-5 qtspeech - ;; TODO: Think about adding dbusmenu-qt5 from - ;; https://launchpad.net/libdbusmenu-qt qtx11extras)) (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - #t)) (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest")) + #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Desktop notifications") (description "KNotification is used to notify the user of an event. It @@ -1878,7 +1871,7 @@ (define-public knotifications (define-public kpackage (package (name "kpackage") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1887,11 +1880,7 @@ (define-public kpackage name "-" version ".tar.xz")) (sha256 (base32 - "03rp7p7i8ihz5wg58gjs638jk7xbszknfiy2j3r979snc57g95mv")) - ;; Default to: external paths/symlinks can be followed by a - ;; package - (patches (search-patches "kpackage-allow-external-paths.patch" - "kpackage-fix-KF5PackageMacros.cmake.patch")))) + "1av6v0629a8yi0wpl7xgyd0gsn5gi228abdlvbk4dzrx9vxpa7rn")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -1907,9 +1896,10 @@ (define-public kpackage (modify-phases %standard-phases (add-after 'unpack 'patch (lambda _ + (substitute* "src/kpackage/package.cpp" + (("externalPaths.false.") "externalPaths(true)")) ;; Make QDirIterator follow symlinks - (substitute* '("src/kpackage/packageloader.cpp" - "src/kpackage/private/packagejobthread.cpp") + (substitute* '("src/kpackage/packageloader.cpp") (("^\\s*(const QDirIterator::IteratorFlags flags = QDirIterator::Subdirectories)(;)" _ a b) (string-append a " | QDirIterator::FollowSymlinks" b)) (("^\\s*(QDirIterator it\\(.*, QDirIterator::Subdirectories)(\\);)" _ a b) @@ -1940,7 +1930,7 @@ (define-public kpackage (define-public kpty (package (name "kpty") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1949,7 +1939,7 @@ (define-public kpty name "-" version ".tar.xz")) (sha256 (base32 - "1hp6iilr2asf2269linfazjv4yjg7rsi8wydxx53yyr99r0bgmah")))) + "0lp0bqlg1i0a5vl6gvvkngbsha8ab38z6b3sjvpmk83vixgsq7fb")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -1976,7 +1966,7 @@ (define-public kpty (define-public kunitconversion (package (name "kunitconversion") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -1985,18 +1975,9 @@ (define-public kunitconversion name "-" version ".tar.xz")) (sha256 (base32 - "0sp4gfzpf40cdi0xnff9sn7b75z88j0589svz4rv77q5m137cgnn")))) + "17ph75rg3y652ii0yxm9s8xrbpjs9pdfsrsajm220mi9ng2b9qj7")))) (build-system cmake-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'disable-a-failing-test-case - (lambda _ - ;; FIXME: Re-enable this test-case. It was committed with the - ;; message: "tsan says it's clean, apart from issues in Qt - ;; (reported upstream)" - (substitute* "autotests/convertertest.cpp" - (("const int numThreads = 2") "const int numThreads = 0"))))))) + (arguments `(#:tests? #f)) ;; Requires network. (native-inputs (list extra-cmake-modules)) (inputs @@ -2012,7 +1993,7 @@ (define-public kunitconversion (define-public syndication (package (name "syndication") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2021,7 +2002,7 @@ (define-public syndication name "-" version ".tar.xz")) (sha256 (base32 - "1n3x8s1z4kd30xirfr07hi87vwhk4rilb5kslcjcgp5n9c0imcpv")))) + "0ijxpnsygwzzybic5lp8gfq57y84vrp3bq7vdbjh3h0345vvk6hw")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -2044,7 +2025,7 @@ (define-public syndication (define-public baloo (package (name "baloo") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2053,7 +2034,7 @@ (define-public baloo name "-" version ".tar.xz")) (sha256 (base32 - "1cf5pp9hn3pqypwyzh63ksasap3n7qz6n3y2xgb83ss3fra90pjf")))) + "0xd4a0p22gjm523ymlyd5nfgp8z3ayb0nq6a04h5py507mc70d98")))) (build-system cmake-build-system) (propagated-inputs (list kcoreaddons kfilemetadata)) @@ -2080,17 +2061,6 @@ (define-public baloo (arguments `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") - (with-output-to-file "bin/BLACKLIST" - (lambda _ - ;; Blacklist some failing tests. FIXME: Make them pass. - (display "[testRenameFile]\n*\n") - (display "[testMoveFile]\n*\n"))) - #t)) (add-after 'unpack 'remove-failing-test (lambda _ ;; FIXME: kinotifytest broke in 5.70.0 with commit 73183acf00 and @@ -2103,9 +2073,12 @@ (define-public baloo (string-append all " AND NOT TRUE"))) #t)) (replace 'check - (lambda _ - (setenv "DBUS_FATAL_WARNINGS" "0") - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "DBUS_FATAL_WARNINGS" "0") + (setenv "HOME" (getcwd)) + (invoke "dbus-launch" "ctest")) + #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "File searching and indexing") (description "Baloo provides file searching and indexing. It does so by @@ -2116,7 +2089,7 @@ (define-public baloo (define-public kactivities-stats (package (name "kactivities-stats") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2125,7 +2098,7 @@ (define-public kactivities-stats name "-" version ".tar.xz")) (sha256 (base32 - "1cnfdnxkw9hwbqdzdygp2vzwxqwqhxyipzwdcgar0clgnf7zi7wx")))) + "0lgp7zxgjmjm02x4mydlv6ivmlxqjkklav5vfwgjgf6v1qp161i2")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -2142,7 +2115,7 @@ (define-public kactivities-stats (define-public kbookmarks (package (name "kbookmarks") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2151,7 +2124,7 @@ (define-public kbookmarks name "-" version ".tar.xz")) (sha256 (base32 - "1i5vcyvyc9whmflbcg2kc562ch93yscfic1c1n9z347g26jmgras")))) + "0hym3558xnp3h7q8kf1ljcy65r3g37mcmqb1ll3nxd912rv4wl4r")))) (build-system cmake-build-system) (propagated-inputs (list kwidgetsaddons)) @@ -2184,7 +2157,7 @@ (define-public kbookmarks (define-public kcmutils (package (name "kcmutils") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2193,7 +2166,7 @@ (define-public kcmutils name "-" version ".tar.xz")) (sha256 (base32 - "08f4yr546brl1dppp0khvsw9ihmh9a7rp505913pdhi0sklaiimz")))) + "0fldpkhq4ysma4m6qylr7kqvxw0rb11x5abz5921bhl5zicfcjfx")))) (build-system cmake-build-system) (propagated-inputs (list kconfigwidgets kservice)) @@ -2212,6 +2185,10 @@ (define-public kcmutils ;; print plugin name when loading fails (("^\\s*(qWarning\\(\\) << \"Error loading) (plugin:\")( << loader\\.errorString\\(\\);)" _ a b c) (string-append a " KCM plugin\" << mod.service()->library() << \":\"" c))) + #t)) + (add-before 'check 'check-setup + (lambda _ + (setenv "QT_QPA_PLATFORM" "offscreen") #t))))) (inputs (list kauth @@ -2237,7 +2214,7 @@ (define-public kcmutils (define-public kconfigwidgets (package (name "kconfigwidgets") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2246,12 +2223,12 @@ (define-public kconfigwidgets name "-" version ".tar.xz")) (sha256 (base32 - "195dw7nyr3fp78y3vfnyjh0hwgwk46f80wdcm8dck5rkscl3v9xz")))) + "0ji799xd45lpnd70a9bizicfz2bsmlxq6r0fqgn0ghwsbp9ywna2")))) (build-system qt-build-system) (propagated-inputs (list kauth kcodecs kconfig kwidgetsaddons)) (native-inputs - (list extra-cmake-modules kdoctools)) + (list extra-cmake-modules kdoctools qttools)) (inputs (list kcoreaddons kguiaddons @@ -2268,6 +2245,13 @@ (define-public kconfigwidgets ;; make QDirIterator follow symlinks (("^\\s*(QDirIterator it\\(.*, QDirIterator::Subdirectories)(\\);)" _ a b) (string-append a " | QDirIterator::FollowSymlinks" b))) + (substitute* "CMakeLists.txt" + (("5\\.90\\.0") "5.92.0")) + #t)) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "ctest" "-E" "kstandardactiontest")) #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Widgets for configuration dialogs") @@ -2280,7 +2264,7 @@ (define-public kconfigwidgets (define-public kdeclarative (package (name "kdeclarative") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2289,30 +2273,25 @@ (define-public kdeclarative name "-" version ".tar.xz")) (sha256 (base32 - "1vq9pkrb0zsphi2sfx7cyy1kb6pklzjkmqdf5202z8vydlkc4549")))) + "1cymh8clcajk9cl6r443cpqk6vmp4x12ngc6wgp08z53zrvlv5py")))) (build-system cmake-build-system) (propagated-inputs - (list kconfig kpackage)) + (list kconfig kpackage qtdeclarative)) (native-inputs - (list extra-cmake-modules pkg-config xorg-server-for-tests)) + (list dbus extra-cmake-modules pkg-config xorg-server-for-tests)) (inputs (list kauth - kbookmarks - kcodecs - kcompletion - kconfigwidgets kcoreaddons kglobalaccel kguiaddons kiconthemes kio - kitemviews ki18n kjobwidgets + knotifications kservice kwidgetsaddons kwindowsystem - kxmlgui libepoxy qtbase-5 qtdeclarative-5 @@ -2325,8 +2304,17 @@ (define-public kdeclarative ;; The test suite requires a running X server, setting ;; QT_QPA_PLATFORM=offscreen does not suffice. (system "Xvfb :1 -screen 0 640x480x24 &") - (setenv "DISPLAY" ":1") - #t))))) + (setenv "DISPLAY" ":1"))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "XDG_RUNTIME_DIR" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest" + "-E" ; FIXME: test fails. + "fullmodelaccesstest"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Integration of QML and KDE work spaces") (description "KDeclarative provides integration of QML and KDE work spaces. @@ -2339,7 +2327,7 @@ (define-public kdeclarative (define-public kded (package (name "kded") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2348,17 +2336,16 @@ (define-public kded name "-" version ".tar.xz")) (sha256 (base32 - "0zqd33vy4ny7g9as3bhd75qi1chz1nlqq133pgw8kjanvghwwnk9")))) + "0v0fak84nw4lb4qc1irb9sn5nh5k7qrhnfav5smn3cvchldm6dc3")))) (build-system cmake-build-system) (native-inputs - (list extra-cmake-modules)) + (list extra-cmake-modules kdoctools)) (inputs (list kconfig kcoreaddons kcrash kdbusaddons kdoctools - kinit kservice qtbase-5)) (home-page "https://community.kde.org/Frameworks") @@ -2372,7 +2359,7 @@ (define-public kded (define-public kdesignerplugin (package (name "kdesignerplugin") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2381,28 +2368,15 @@ (define-public kdesignerplugin name "-" version ".tar.xz")) (sha256 (base32 - "0dr6gcag2yzx8fvxis4x403jrcisywds95cywmiyz3pb5727cak2")))) + "0kial8k6qr39871v103952d0qcs0hm25y6k0vdg4y8ns8nrmjs06")))) (build-system qt-build-system) (native-inputs - (list extra-cmake-modules qttools-5)) + (list extra-cmake-modules kdoctools qttools-5)) (inputs (list kconfig kcoreaddons kdoctools - qtbase-5 - ;; optional: - kcompletion - kconfigwidgets - kiconthemes - kitemviews - kio - kplotting - ktextwidgets - kdewebkit - kwidgetsaddons - kxmlgui - qtwebkit - sonnet)) + qtbase-5)) (home-page "https://community.kde.org/Frameworks") (synopsis "Integrating KDE frameworks widgets with Qt Designer") (description "This framework provides plugins for Qt Designer that allow it @@ -2414,7 +2388,7 @@ (define-public kdesignerplugin (define-public kdesu (package (name "kdesu") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2423,7 +2397,7 @@ (define-public kdesu name "-" version ".tar.xz")) (sha256 (base32 - "17k29g7jwgqj5xdmr509438b9sq65zx8khdr4viybjf5xpi0cf5m")))) + "1yjyz4v0gn7ys7zy4ymn47zggxxmgd37big005c6g85dm63xr1s6")))) (build-system cmake-build-system) (propagated-inputs (list kpty)) @@ -2441,7 +2415,7 @@ (define-public kdesu (define-public kdewebkit (package (name "kdewebkit") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2450,7 +2424,7 @@ (define-public kdewebkit name "-" version ".tar.xz")) (sha256 (base32 - "0y9ja3znkvzdbjfs91dwr4cmvl9fk97zpz2lkf0f9zhm2nw6q008")))) + "1dni134qbs5yff7zgk4n3sfjwblzarblg16rj35l59l6mly7f2jd")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -2473,7 +2447,7 @@ (define-public kdewebkit (define-public kemoticons (package (name "kemoticons") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2482,7 +2456,7 @@ (define-public kemoticons name "-" version ".tar.xz")) (sha256 (base32 - "11v1srn3nii4j7cn4f19qvdw96pczwxhanzxlg4a9gf8kmnp5gxr")))) + "01wzy3mwfz4sqpq8i1hfbbymajp55axryiaqkfr9r2n1844y7kzx")))) (build-system cmake-build-system) (propagated-inputs (list kservice)) @@ -2510,7 +2484,7 @@ (define-public kemoticons (define-public kglobalaccel (package (name "kglobalaccel") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2519,7 +2493,7 @@ (define-public kglobalaccel name "-" version ".tar.xz")) (sha256 (base32 - "0hmqigc8myiwwh7m6y2cm4vn0d3kmrhia179hyb84vpvvn3lm93z")))) + "0lhlb274pvv7rpkcsccqbv81bh8iklanp29g0k28wrv3kckiwyxy")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules pkg-config qttools-5)) @@ -2528,9 +2502,7 @@ (define-public kglobalaccel kcrash kcoreaddons kdbusaddons - kservice kwindowsystem - libxcb qtbase-5 qtx11extras xcb-util-keysyms)) @@ -2544,7 +2516,7 @@ (define-public kglobalaccel (define-public kiconthemes (package (name "kiconthemes") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2553,7 +2525,7 @@ (define-public kiconthemes name "-" version ".tar.xz")) (sha256 (base32 - "09bqpf3drqyfc81vgab9bsh1wm5qbzdwqjlczhax38660nnvh0r9")))) + "08yb6f980p620dfklfiyp83lcsqw4dds9qwzd6xpn2mzz07p2a11")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules qttools-5 shared-mime-info)) @@ -2590,7 +2562,7 @@ (define-public kiconthemes (define-public kinit (package (name "kinit") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2599,11 +2571,10 @@ (define-public kinit name "-" version ".tar.xz")) (sha256 (base32 - "1x4whs8p1daxjfp4ksf70rxrv7fx3w17s5wh6446039wzz9bv6ki")) + "1kpkqnq9krxlzhripwjhw3n55p5sxqsvj6nb2pqb9m0ppw97jlfb")) ;; Use the store paths for other packages and dynamically loaded ;; libs - (patches (search-patches "kinit-kdeinit-extra_libs.patch" - "kinit-kdeinit-libpath.patch")))) + (patches (search-patches "kinit-kdeinit-extra_libs.patch")))) (build-system cmake-build-system) (arguments `(#:phases @@ -2659,7 +2630,7 @@ (define-public kinit (define-public kio (package (name "kio") - (version "5.70.1") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2668,7 +2639,7 @@ (define-public kio name "-" version ".tar.xz")) (sha256 (base32 - "1f33jdjjx6k1d5fab35x8xakc4ny9fyfrgkbib60xncc82lz2h5l")) + "1cscsjb2v0zygzazfhcflc3gb5ny1a79g3i6glyzw6ppj2c3yhyl")) (patches (search-patches "kio-search-smbd-on-PATH.patch")))) (build-system cmake-build-system) (propagated-inputs @@ -2683,7 +2654,7 @@ (define-public kio kxmlgui solid)) (native-inputs - (list dbus qttools-5 extra-cmake-modules)) + (list extra-cmake-modules dbus kdoctools qttools-5)) (inputs `(;; TODO: LibACL , ("krb5" ,mit-krb5) @@ -2694,6 +2665,7 @@ (define-public kio ("kcrash" ,kcrash) ("kdbusaddons" ,kdbusaddons) ("kdoctools" ,kdoctools) + ("kguiaddons" ,kguiaddons) ("kiconthemes" ,kiconthemes) ("ki18n" ,ki18n) ("knotifications" ,knotifications) @@ -2705,10 +2677,11 @@ (define-public kio ("qtbase" ,qtbase-5) ("qtscript" ,qtscript) ("qtx11extras" ,qtx11extras) - ("sonnet" ,sonnet))) + ("sonnet" ,sonnet) + ("util-linux:lib" ,util-linux "lib") ; libmount + ("zlib" ,zlib))) (arguments - `(#:tests? #f ; FIXME: 41/50 tests fail. - #:phases + `(#:phases (modify-phases %standard-phases (add-after 'unpack 'patch (lambda _ @@ -2717,12 +2690,34 @@ (define-public kio (("(^\\s*qCWarning(KIOD_CATEGORY) << \"Error loading plugin:\")( << loader.errorString();)" _ a b) (string-append a "<< name" b))) #t)) - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - (setenv "XDG_RUNTIME_DIR" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "XDG_RUNTIME_DIR" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + (setenv "DBUS_FATAL_WARNINGS" "0") + (invoke "dbus-launch" "ctest" + "-E" ; FIXME: 17/67 tests fail. + (string-append "(kiocore-jobtest" + "|fileitemtest" + "|kiocore-kmountpointtest" + "|kiocore-ktcpsockettest" + "|kiocore-mimetypefinderjobtest" + "|kiocore-http_jobtest" + "|kiogui-openurljobtest" + "|kiocore-threadtest" + "|applicationlauncherjob_forkingtest" + "|applicationlauncherjob_scopetest" + "|applicationlauncherjob_servicetest" + "|commandlauncherjob_forkingtest" + "|commandlauncherjob_scopetest" + "|commandlauncherjob_servicetest" + "|kiowidgets-kdirmodeltest" + "|kiowidgets-kfileitemactionstest" + "|kiowidgets-kurifiltertest-colon-separator" + "|kiowidgets-kurifiltertest-space-separator" + "|kiofilewidgets-knewfilemenutest)"))) #t)) (add-after 'install 'add-symlinks ;; Some package(s) (e.g. bluedevil) refer to these service types by @@ -2733,10 +2728,6 @@ (define-public kio "/share/kservicetypes5/"))) (symlink (string-append kst5 "kfileitemactionplugin.desktop") (string-append kst5 "kfileitemaction-plugin.desktop")))))))) - ;;(replace 'check - ;; (lambda _ - ;; (setenv "DBUS_FATAL_WARNINGS" "0") - ;; (zero? (system* "dbus-launch" "ctest" "."))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Network transparent access to files and data") (description "This framework implements a lot of file management functions. @@ -2751,7 +2742,7 @@ (define-public kio (define-public knewstuff (package (name "knewstuff") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2760,7 +2751,7 @@ (define-public knewstuff name "-" version ".tar.xz")) (sha256 (base32 - "1hpxj4nawh57w8l64gjplb5mk5fpxiffm4x49kg75m637rxy19fq")))) + "0gvclv1a6xyrqa24svb56kp9zf2wi98as3q30lnwf0bpbpjsw52b")))) (build-system cmake-build-system) (propagated-inputs (list attica kservice kxmlgui)) @@ -2780,6 +2771,7 @@ (define-public knewstuff ki18n kiconthemes kjobwidgets + kpackage ktextwidgets kwidgetsaddons qtbase-5 @@ -2805,7 +2797,7 @@ (define-public knewstuff (define-public knotifyconfig (package (name "knotifyconfig") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2814,7 +2806,7 @@ (define-public knotifyconfig name "-" version ".tar.xz")) (sha256 (base32 - "1d483qrgyamwsqvcl70klv1g8744hn8z1h2j3qfydcvlwz8jy0gj")))) + "0fii74r0ap3n08lp9kj7pki0msqjsia2jnmavyps51kq37im5x7p")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -2847,7 +2839,7 @@ (define-public knotifyconfig (define-public kparts (package (name "kparts") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2856,7 +2848,7 @@ (define-public kparts name "-" version ".tar.xz")) (sha256 (base32 - "1gfaxr856zrsjxzdxw1sj12s6aib6r703jgf7yvsl8kilg8l2gsk")))) + "061kzss4b0bw67j3mc8h36mbaji077k3alk2ghcir7qix6r1hkh9")))) (build-system qt-build-system) (arguments '(#:phases (modify-phases %standard-phases @@ -2898,7 +2890,7 @@ (define-public kparts (define-public kpeople (package (name "kpeople") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2907,7 +2899,7 @@ (define-public kpeople name "-" version ".tar.xz")) (sha256 (base32 - "1dhvly19pj9lx78g7mc89scibzmra1vhv4zz33222zidkbrf9ryl")))) + "0wf555pqiannxb115mlbl43ds1365im95vadsbzv1gdz668p44xk")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -2934,7 +2926,7 @@ (define-public kpeople (define-public krunner (package (name "krunner") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -2943,7 +2935,7 @@ (define-public krunner name "-" version ".tar.xz")) (sha256 (base32 - "0fhb26vi9z1mky79kq12qq4g4ghz3530cx84n5l3sdgkd6nfsyqf")))) + "1vcgqjyx9i8k9q4j6q9p4f7sp76aap8gqn2v269lb7imcrfhrj1z")))) (build-system cmake-build-system) (propagated-inputs (list plasma-framework)) @@ -2984,20 +2976,15 @@ (define-public krunner (("//usr/bin\"") (string-append (getcwd) "\"")) ;; multiple path-parts (("/bin/ls") (search-input-file inputs "/bin/ls"))))) - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") - ;; Blacklist some failing test-functions. FIXME: Make them pass. - (with-output-to-file "bin/BLACKLIST" - (lambda _ - (display "[testMatch]\n*\n") - (display "[testMulti]\n*\n"))) - #t)) (replace 'check - (lambda _ - (invoke "dbus-launch" "ctest" ".")))))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + (invoke "dbus-launch" "ctest" + "-E" ;; Some tests fail + "(runnercontexttest|dbusrunnertest|\ +runnermanagersinglerunnermodetest|runnermanagertest)"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Framework for Plasma runners") (description "The Plasma workspace provides an application called KRunner @@ -3009,7 +2996,7 @@ (define-public krunner (define-public kservice (package (name "kservice") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3018,17 +3005,16 @@ (define-public kservice name "-" version ".tar.xz")) (sha256 (base32 - "0g49p5331f7dl46rvi43akmjm1jx70w9797j6d17jy7z9s9sqikw")))) + "1y1fr1galhhi6yf9w9qcvkp1zb63ifvr4wb43jwpvpms9djxkqjj")))) (build-system cmake-build-system) (propagated-inputs - (list kconfig kcoreaddons)) + (list kconfig kcoreaddons kdoctools)) (native-inputs - (list bison extra-cmake-modules flex)) + (list bison extra-cmake-modules flex shared-mime-info)) (inputs (list kcrash kdbusaddons kdoctools ki18n qtbase-5)) (arguments - `(#:tests? #f ; FIXME: 6/10 tests fail. - #:phases + `(#:phases (modify-phases %standard-phases (add-after 'unpack 'patch ;; Adopted from NixOS' patches "qdiriterator-follow-symlinks" and @@ -3044,12 +3030,13 @@ (define-public kservice (("^\\s*QString resolved = QDir\\(dir\\)\\.canonicalPath\\(\\);") "QString resolved = QDir::cleanPath(dir);")) #t)) - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") - #t))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") + ;; Disable failing tests. + (invoke "ctest" "-E" "(kautostarttest|ksycocatest)"))))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Plugin framework for desktop services") (description "KService provides a plugin framework for handling desktop @@ -3061,7 +3048,7 @@ (define-public kservice (define-public ktexteditor (package (name "ktexteditor") - (version "5.70.1") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3070,10 +3057,11 @@ (define-public ktexteditor "ktexteditor-" version ".tar.xz")) (sha256 (base32 - "0k10yj1ia1w1mznj4g5nvp65p226zcvgwxc85ycn2w8lbkknidf7")))) + "137v8g7j8kkv9yh30ysmm5n6imyyd3jmd0f6w5ni00kxl0y1rl5w")))) (build-system cmake-build-system) (propagated-inputs - (list kparts)) + (list kparts + ksyntaxhighlighting)) (native-inputs (list extra-cmake-modules pkg-config)) (inputs @@ -3093,7 +3081,6 @@ (define-public ktexteditor ki18n kjobwidgets kservice - ksyntaxhighlighting ktextwidgets kwidgetsaddons kxmlgui @@ -3106,19 +3093,18 @@ (define-public ktexteditor solid sonnet)) (arguments - `(#:tests? #f ; FIXME: 2/54 tests fail: Cannot find fontdirectory qtbase/lib/font - #:phases + `(#:phases (modify-phases %standard-phases (add-after 'unpack 'setup (lambda* (#:key inputs #:allow-other-keys) (setenv "XDG_DATA_DIRS" ; FIXME build phase doesn't find parts.desktop (string-append (assoc-ref inputs "kparts") "/share")) #t)) - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? ;; Maybe locale issues with tests? + (setenv "QT_QPA_PLATFORM" "offscreen") + (invoke "ctest" "-E" "(completion_test|kateview_test|movingrange_test)")) #t)) (add-after 'install 'add-symlinks ;; Some package(s) (e.g. plasma-sdk) refer to these service types @@ -3141,7 +3127,7 @@ (define-public ktexteditor (define-public ktextwidgets (package (name "ktextwidgets") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3150,7 +3136,7 @@ (define-public ktextwidgets name "-" version ".tar.xz")) (sha256 (base32 - "1609rlwba674kr9whawk93vb1b14b5ly7wvir7kjyjp4j715f47w")))) + "030bz67n6m3fkbldnr48mzicm9cgnr9gdpwipaghl5x5k3s7p1py")))) (build-system qt-build-system) (propagated-inputs (list ki18n sonnet)) @@ -3179,7 +3165,7 @@ (define-public ktextwidgets (define-public kwallet (package (name "kwallet") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3188,10 +3174,10 @@ (define-public kwallet name "-" version ".tar.xz")) (sha256 (base32 - "1ps6ywcirv7xcisvwfcpvk53wm7m8y5lrz4nhkm36rizrdglw19r")))) + "1ra0cxw70vb6pks8sqw5k895rnrfzwxhg6vh4yc5dgzdn1nagb3i")))) (build-system cmake-build-system) (native-inputs - (list extra-cmake-modules)) + (list extra-cmake-modules kdoctools)) (inputs (list gpgme kauth @@ -3221,7 +3207,7 @@ (define-public kwallet (define-public kxmlgui (package (name "kxmlgui") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3230,7 +3216,7 @@ (define-public kxmlgui name "-" version ".tar.xz")) (sha256 (base32 - "0cvzcq2dcz89c0ffhvfb820hfmqa87mfdbjvrqjwdysc9lr8zx8f")))) + "0hxpjyjr77q2gyi3hg13119aza3634rvmllbj66pi7y37h6lr2z0")))) (build-system cmake-build-system) (propagated-inputs (list kconfig kconfigwidgets)) @@ -3242,6 +3228,7 @@ (define-public kxmlgui kcodecs kcoreaddons kglobalaccel + kguiaddons kiconthemes kitemviews ki18n @@ -3272,16 +3259,16 @@ (define-public kxmlgui (define-public kxmlrpcclient (package (name "kxmlrpcclient") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/frameworks/" - (version-major+minor version) "/" + (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 (base32 - "1cmfv2w9yfi8jhj5nawfz7kw8jbr1k5cr3n5xv3z59pg2vazsx8b")))) + "1axy34g5ahd1c3qg7ab7h786jibpaj4dvj45x50x5czq06idqchf")))) (build-system cmake-build-system) (propagated-inputs (list kio)) @@ -3315,7 +3302,7 @@ (define-public kxmlrpcclient (define-public plasma-framework (package (name "plasma-framework") - (version "5.70.1") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3324,13 +3311,12 @@ (define-public plasma-framework name "-" version ".tar.xz")) (sha256 (base32 - "06cxajsxj62g3c37ssrrcaxb9a12zbyp2kvrjqym329k5vd89272")) - (patches (search-patches "plasma-framework-fix-KF5PlasmaMacros.cmake.patch")))) + "1xq66lyagjsgfashhqgqgqhda0rqfqf0l5yf1gc4ziv48mibrhn6")))) (build-system cmake-build-system) (propagated-inputs (list kpackage kservice)) (native-inputs - (list extra-cmake-modules pkg-config)) + (list extra-cmake-modules kdoctools pkg-config)) (inputs `(("kactivities" ,kactivities) ("karchive" ,karchive) @@ -3343,7 +3329,6 @@ (define-public plasma-framework ("kcoreaddons" ,kcoreaddons) ("kdbusaddons" ,kdbusaddons) ("kdeclarative" ,kdeclarative) - ("kdoctools" ,kdoctools) ("kglobalaccel" ,kglobalaccel) ("kguiaddons" ,kguiaddons) ("kiconthemes" ,kiconthemes) @@ -3352,11 +3337,13 @@ (define-public plasma-framework ("kio" ,kio) ("ki18n" ,ki18n) ("kjobwidgets" ,kjobwidgets) - ("knotificantions" ,knotifications) + ("knotifications" ,knotifications) ("kwayland" ,kwayland) ("kwidgetsaddons" ,kwidgetsaddons) ("kwindowsystem" ,kwindowsystem) ("kxmlgui" ,kxmlgui) + ;; XXX: "undefined reference to `glGetString'" errors occur without libglvnd, + ("libglvnd" ,libglvnd) ("phonon" ,phonon) ("qtbase" ,qtbase-5) ("qtdeclarative-5" ,qtdeclarative-5) @@ -3365,14 +3352,17 @@ (define-public plasma-framework ("qtx11extras" ,qtx11extras) ("solid" ,solid))) (arguments - `(#:tests? #f ; FIXME: 9/15 tests fail. - #:phases + `(#:phases (modify-phases %standard-phases - (add-before 'check 'check-setup - (lambda _ - (setenv "HOME" (getcwd)) - ;; make Qt render "offscreen", required for tests - (setenv "QT_QPA_PLATFORM" "offscreen") + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "HOME" (getcwd)) + (setenv "QT_QPA_PLATFORM" "offscreen") ;; These tests fail + (invoke "ctest" "-E" (string-append "(plasma-dialogstatetest" + "|plasma-iconitemtest" + "|plasma-themetest" + "|dialognativetest)"))) #t))))) (home-page "https://community.kde.org/Frameworks") (synopsis "Libraries, components and tools of Plasma workspaces") @@ -3384,7 +3374,7 @@ (define-public plasma-framework (define-public purpose (package (name "purpose") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3393,7 +3383,7 @@ (define-public purpose name "-" version ".tar.xz")) (sha256 (base32 - "1pxlx2hgj42zsisws8f486n8sg0vn5a5mhb85prifwkaw0rqzgah")))) + "02j09zf18dwjk17mn841m7cm0qsn7gcz5lff8dad3yah0lc3wqcl")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules)) @@ -3409,13 +3399,6 @@ (define-public purpose qtdeclarative-5)) (arguments `(#:tests? #f ;; seem to require network; don't find QTQuick components - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'dont-use-qt515-logic - (lambda _ - (substitute* "src/externalprocess/purposeprocess_main.cpp" - ((" 15") " 16")) - #t))) #:configure-flags '("-DBUILD_TESTING=OFF"))) ; not run anyway (home-page "https://community.kde.org/Frameworks") (synopsis "Offers available actions for a specific purpose") @@ -3457,7 +3440,7 @@ (define kinit-bootstrap (define-public kde-frameworkintegration (package (name "kde-frameworkintegration") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) (uri (string-append @@ -3466,7 +3449,7 @@ (define-public kde-frameworkintegration "frameworkintegration-" version ".tar.xz")) (sha256 (base32 - "1lvccvhhkzdv1hw627kw3ds18gfq4bxdhlvh959piqxq5gh9d2n0")))) + "0pgcwfxxzvfvqyjfgqzsllzfy9il4y8xr8dzdyjmd5vccpvgd3mx")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules pkg-config)) @@ -3512,7 +3495,7 @@ (define-public kde-frameworkintegration (define-public kdelibs4support (package (name "kdelibs4support") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3521,15 +3504,17 @@ (define-public kdelibs4support (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "0imkibjlfc0jshdzr05fz5dy2xmfhvgsfan9b1r35spwsn5qkawx")))) + (base32 "1q7d0i09klkhsiwq7i91ypxakdr5b841zdb60q7yjzcdmn25wbi9")))) (build-system cmake-build-system) (native-inputs (list dbus docbook-xml-4.4 ; optional extra-cmake-modules + kdoctools perl perl-uri pkg-config + qttools shared-mime-info kjobwidgets ;; required for running the tests strace @@ -3606,7 +3591,7 @@ (define-public kdelibs4support (lambda _ (display "[testSmb]\n*\n"))) ;; kuniqueapptest hangs. FIXME: Make this test pass. - (invoke "dbus-launch" "ctest" "." + (invoke "dbus-launch" "ctest" "-E" "kstandarddirstest|kuniqueapptest")))))) (home-page "https://community.kde.org/Frameworks") (synopsis "KDE Frameworks 5 porting aid from KDELibs4") @@ -3628,7 +3613,7 @@ (define-public kdelibs4support (define-public khtml (package (name "khtml") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3637,7 +3622,7 @@ (define-public khtml (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "1jh0g6xv57hyclnh54x0f72lby1gvlisan23y7mzlqf67aky52s5")))) + (base32 "06hpjcm5yrfj1056vvv9dklccd0a1y09zm8ch4a5d8l2lfgdg8ci")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules perl)) @@ -3678,7 +3663,7 @@ (define-public khtml (define-public kjs (package (name "kjs") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3687,7 +3672,7 @@ (define-public kjs (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "0s3n0pdz59p5v967zrxcas3lb94k5bv9vi8058fi0l20nwwlcgh5")))) + (base32 "067ilsm78x03kf5fs2xmlasvy2712k0xrsa404g2zj81fm92s1q4")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules kdoctools perl pkg-config)) @@ -3707,7 +3692,7 @@ (define-public kjs (define-public kjsembed (package (name "kjsembed") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3716,7 +3701,7 @@ (define-public kjsembed (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "0976faazhxhhi1wpvpcs8hwb2knz0z7j44v3ay3hw73rq4p3bipm")))) + (base32 "0db0r8v0bhp3razwyvmvk9r4psl14vgn23c4cm2q1b5pl0w6bhnp")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules kdoctools qttools-5)) @@ -3731,7 +3716,7 @@ (define-public kjsembed (define-public kmediaplayer (package (name "kmediaplayer") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3740,7 +3725,7 @@ (define-public kmediaplayer (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "0lrm4y727nhwaivl37zpmnrwx048gfhyjw19m6q5z9p37lk43jja")))) + (base32 "19lpib2wj91w8shsf9056nwi46qja8nh96hj164ydqlkslpfnf7y")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules kdoctools qttools-5)) @@ -3767,7 +3752,7 @@ (define-public kmediaplayer (define-public kross (package (name "kross") - (version "5.70.0") + (version "5.92.0") (source (origin (method url-fetch) @@ -3776,7 +3761,7 @@ (define-public kross (version-major+minor version) "/portingAids/" name "-" version ".tar.xz")) (sha256 - (base32 "12b527l12rcf421p613ydbacilp9v9iy90ma35w21sdf9a15k675")))) + (base32 "1gqy1h5mqsfgbpqkdrhs7xf77kw4yy19mryda1fwjcqzxd02i7hj")))) (build-system cmake-build-system) (native-inputs (list extra-cmake-modules kdoctools qttools-5)) @@ -3809,19 +3794,29 @@ (define-public kross (define-public kdav (package (name "kdav") - (version "20.04.3") + (version "5.92.0") (source (origin (method url-fetch) - (uri (string-append "mirror://kde/stable/release-service/" version - "/src/kdav-" version ".tar.xz")) + (uri (string-append "mirror://kde/stable/frameworks/" + (version-major+minor version) "/" + name "-" version ".tar.xz")) (sha256 - (base32 "0445gl4xm0h39igkxgb6vmq5iaa04wkgrgbs7nfd0zwngk8xaidn")))) + (base32 "1i5i6bkjairz1slk3fhrxd3s8wkcdaqg55jg2bv86kqh7d3nrcgk")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) (inputs (list kcoreaddons ki18n kio qtbase-5 qtxmlpatterns)) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? ;; Seems to require network. + (invoke "ctest" "-E" + "(kdav-davcollectionsmultifetchjobtest|kdav-davitemfetchjob)")) + #t))))) (home-page "https://invent.kde.org/frameworks/kdav") (synopsis "DAV protocol implementation with KJobs") (description "This is a DAV protocol implementation with KJobs. Calendars diff --git a/gnu/packages/patches/kdbusaddons-kinit-file-name.patch b/gnu/packages/patches/kdbusaddons-kinit-file-name.patch deleted file mode 100644 index ffed88e043..0000000000 --- a/gnu/packages/patches/kdbusaddons-kinit-file-name.patch +++ /dev/null @@ -1,15 +0,0 @@ -Add placeholder for kinit's store file name. - -diff --git a/src/kdeinitinterface.cpp b/src/kdeinitinterface.cpp -index 22fa5e5..3d40937 100644 ---- a/src/kdeinitinterface.cpp -+++ b/src/kdeinitinterface.cpp -@@ -52,7 +52,7 @@ void KDEInitInterface::ensureKdeinitRunning() - // If not found in system paths, search other paths - if (srv.isEmpty()) { - const QStringList searchPaths = QStringList() -- << QCoreApplication::applicationDirPath() // then look where our application binary is located -+ << QString::fromUtf8("@SUBSTITUTEME@/bin") // using QStringLiteral would be more efficient, but breaks guix store reference detection. - << QLibraryInfo::location(QLibraryInfo::BinariesPath); // look where exec path is (can be set in qt.conf) - srv = QStandardPaths::findExecutable(QStringLiteral("kdeinit5"), searchPaths); - if (srv.isEmpty()) { diff --git a/gnu/packages/patches/kinit-kdeinit-extra_libs.patch b/gnu/packages/patches/kinit-kdeinit-extra_libs.patch index 1271f3df7d..b27c6ed535 100644 --- a/gnu/packages/patches/kinit-kdeinit-extra_libs.patch +++ b/gnu/packages/patches/kinit-kdeinit-extra_libs.patch @@ -21,27 +21,6 @@ pkgs/development/libraries/kde-frameworks/kinit/kdeinit-extra_libs.patch #endif }; #endif -@@ -1533,20 +1531,6 @@ static int initXconnection() - } - #endif - --#ifndef Q_OS_OSX --// Find a shared lib in the lib dir, e.g. libkio.so. --// Completely unrelated to plugins. --static QString findSharedLib(const QString &lib) --{ -- QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/") + lib; -- if (QFile::exists(path)) { -- return path; -- } -- // We could also look in LD_LIBRARY_PATH, but really, who installs the main libs in different prefixes? -- return QString(); --} --#endif -- - extern "C" { - - static void secondary_child_handler(int) @@ -1673,7 +1673,7 @@ #if defined(Q_OS_UNIX) && !defined(Q_OS_OSX) if (!d.suicide && qEnvironmentVariableIsEmpty("KDE_IS_PRELINKED")) { diff --git a/gnu/packages/patches/kinit-kdeinit-libpath.patch b/gnu/packages/patches/kinit-kdeinit-libpath.patch deleted file mode 100644 index 6382e8804b..0000000000 --- a/gnu/packages/patches/kinit-kdeinit-libpath.patch +++ /dev/null @@ -1,37 +0,0 @@ -Search libraries in GUIX_KF5INIT_LIB_PATH. - -Based on an idea by NixOs -pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch - -=================================================================== ---- kinit-5.32.0/src/kdeinit/kinit.cpp.orig 2017-10-22 21:02:20.908765455 +0200 -+++ kinit-5.32.0/src/kdeinit/kinit.cpp 2017-10-22 21:03:25.312818248 +0200 -@@ -623,20 +623,18 @@ - if (libpath_relative) { - // NB: Because Qt makes the actual dlopen() call, the - // RUNPATH of kdeinit is *not* respected - see - // https://sourceware.org/bugzilla/show_bug.cgi?id=13945 - // - so we try hacking it in ourselves -- QString install_lib_dir = QFile::decodeName( -- CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); -- QString orig_libpath = libpath; -- libpath = install_lib_dir + libpath; -- l.setFileName(libpath); -- if (!l.load()) { -- libpath = orig_libpath; -- l.setFileName(libpath); -- l.load(); -- } -+ // Try to load the library relative to the active profiles. -+ QByteArrayList profiles = qgetenv("KDEINIT5_LIBRARY_PATH").split(':'); -+ for (const QByteArray &profile: profiles) { -+ if (!profile.isEmpty()) { -+ l.setFileName(QFile::decodeName(profile) + QStringLiteral("/") + libpath); -+ if (l.load()) break; -+ } -+ } - } else { - l.load(); - } - if (!l.isLoaded()) { - QString ltdlError(l.errorString()); diff --git a/gnu/packages/patches/kio-search-smbd-on-PATH.patch b/gnu/packages/patches/kio-search-smbd-on-PATH.patch index 55535ffa11..5118c9a361 100644 --- a/gnu/packages/patches/kio-search-smbd-on-PATH.patch +++ b/gnu/packages/patches/kio-search-smbd-on-PATH.patch @@ -1,30 +1,24 @@ -Adopted from NixOS -pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch +From af54a2a37655df26a33bc6783cb472c38f65322f Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Sun, 28 Mar 2021 10:31:12 -0500 +Subject: [PATCH 1/2] Remove impure smbd search path -=================================================================== ---- kio-5.17.0.orig/src/core/ksambashare.cpp -+++ kio-5.17.0/src/core/ksambashare.cpp -@@ -67,13 +67,18 @@ KSambaSharePrivate::~KSambaSharePrivate( - +--- + src/core/ksambashare.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/ksambashare.cpp b/src/core/ksambashare.cpp +index e810ce4..7cfb4e6 100644 +--- a/src/core/ksambashare.cpp ++++ b/src/core/ksambashare.cpp +@@ -61,7 +61,7 @@ KSambaSharePrivate::~KSambaSharePrivate() bool KSambaSharePrivate::isSambaInstalled() { -- if (QFile::exists(QStringLiteral("/usr/sbin/smbd")) -- || QFile::exists(QStringLiteral("/usr/local/sbin/smbd"))) { -- return true; -+ const QByteArray pathEnv = qgetenv("PATH"); -+ if (!pathEnv.isEmpty()) { -+ QLatin1Char pathSep(':'); -+ QStringList paths = QFile::decodeName(pathEnv).split(pathSep, QString::SkipEmptyParts); -+ for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it) { -+ it->append(QStringLiteral("/smbd")); -+ if (QFile::exists(*it)) { -+ return true; -+ } -+ } + const bool daemonExists = +- !QStandardPaths::findExecutable(QStringLiteral("smbd"), {QStringLiteral("/usr/sbin/"), QStringLiteral("/usr/local/sbin/")}).isEmpty(); ++ !QStandardPaths::findExecutable(QStringLiteral("smbd")).isEmpty(); + if (!daemonExists) { + qCDebug(KIO_CORE_SAMBASHARE) << "KSambaShare: Could not find smbd"; } - -- //qDebug() << "Samba is not installed!"; -- - return false; - } - +-- +2.30.1 diff --git a/gnu/packages/patches/kpackage-allow-external-paths.patch b/gnu/packages/patches/kpackage-allow-external-paths.patch deleted file mode 100644 index c1c9efde7f..0000000000 --- a/gnu/packages/patches/kpackage-allow-external-paths.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/kpackage/package.cpp b/src/kpackage/package.cpp -index 5aec9fd..b15c933 100644 ---- a/src/kpackage/package.cpp -+++ b/src/kpackage/package.cpp -@@ -820,7 +820,7 @@ PackagePrivate::PackagePrivate() - : QSharedData(), - fallbackPackage(nullptr), - metadata(nullptr), -- externalPaths(false), -+ externalPaths(true), - valid(false), - checkedValid(false) - { diff --git a/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch b/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch deleted file mode 100644 index d677f19a70..0000000000 --- a/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 668010ebc9fd84d9dc60f90b9a4ebf3c7054977f Mon Sep 17 00:00:00 2001 -From: Hartmut Goebel -Date: Sun, 25 Oct 2020 20:11:13 +0000 -Subject: [PATCH] Fix build errors if PREFIX is different from ECM's PREFIX. - -See for details. ---- - KF5PackageMacros.cmake | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/KF5PackageMacros.cmake b/KF5PackageMacros.cmake -index f4c1d1d..acd3798 100644 ---- a/KF5PackageMacros.cmake -+++ b/KF5PackageMacros.cmake -@@ -1,6 +1,5 @@ - --find_package(ECM 1.6.0 CONFIG REQUIRED) --include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake) -+include(KDEInstallDirs) - - set(KPACKAGE_RELATIVE_DATA_INSTALL_DIR "kpackage") - --- -GitLab - diff --git a/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch b/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch deleted file mode 100644 index bd55d512cf..0000000000 --- a/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ff5ed26f21d304e867ab57781878069567deb23d Mon Sep 17 00:00:00 2001 -From: Hartmut Goebel -Date: Mon, 3 Aug 2020 19:49:58 +0000 -Subject: [PATCH] Fix build errors if PREFIX is different from ECM's PREFIX. - -See for details ---- - KF5PlasmaMacros.cmake | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/KF5PlasmaMacros.cmake b/KF5PlasmaMacros.cmake -index 494b42d56..80b3fd8dd 100644 ---- a/KF5PlasmaMacros.cmake -+++ b/KF5PlasmaMacros.cmake -@@ -1,6 +1,5 @@ - --find_package(ECM 1.6.0 CONFIG REQUIRED) --include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake) -+include(KDEInstallDirs) - - set(PLASMA_RELATIVE_DATA_INSTALL_DIR "plasma") - set(PLASMA_DATA_INSTALL_DIR "${KDE_INSTALL_DATADIR}/${PLASMA_RELATIVE_DATA_INSTALL_DIR}") --- -GitLab - -- cgit v1.2.3 From 568d1676490ec766bcf199025e56ecd945dec286 Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Tue, 21 Jun 2022 04:56:08 +0200 Subject: gnu: grantleetheme: Update to 21.12.3. * gnu/packages/kde.scm (grantleetheme): Update to 21.12.3. * gnu/local.mk: Remove patch. * gnu/packages/patches/grantlee-merge-theme-dirs.patch: Remove file. Signed-off-by: Marius Bakke --- gnu/local.mk | 1 - gnu/packages/kde.scm | 5 +- .../patches/grantlee-merge-theme-dirs.patch | 163 --------------------- 3 files changed, 2 insertions(+), 167 deletions(-) delete mode 100644 gnu/packages/patches/grantlee-merge-theme-dirs.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index b20d16b8a6..b8722c0a37 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1240,7 +1240,6 @@ dist_patch_DATA = \ %D%/packages/patches/gpm-glibc-2.26.patch \ %D%/packages/patches/gpodder-disable-updater.patch \ %D%/packages/patches/gpsbabel-fix-i686-test.patch \ - %D%/packages/patches/grantlee-merge-theme-dirs.patch \ %D%/packages/patches/grep-timing-sensitive-test.patch \ %D%/packages/patches/grfcodec-gcc-compat.patch \ %D%/packages/patches/gromacs-tinyxml2.patch \ diff --git a/gnu/packages/kde.scm b/gnu/packages/kde.scm index f187c02ba4..d83018934d 100644 --- a/gnu/packages/kde.scm +++ b/gnu/packages/kde.scm @@ -124,15 +124,14 @@ (define-public baloo-widgets (define-public grantleetheme (package (name "grantleetheme") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/grantleetheme-" version ".tar.xz")) (sha256 - (base32 "0gabc5cb0sf00s7m5v2jnq55qsrdbrq6nqd15y1i15p788zifsjx")) - (patches (search-patches "grantlee-merge-theme-dirs.patch")))) + (base32 "1w83slbkj2y1wk78srq2k95ybs66sb4mbaa0zm7fl9pkwhqxbnb7")))) (build-system qt-build-system) (arguments `(#:tests? #f)) ; unexpected error in the test suite. (native-inputs diff --git a/gnu/packages/patches/grantlee-merge-theme-dirs.patch b/gnu/packages/patches/grantlee-merge-theme-dirs.patch deleted file mode 100644 index 96a15a387b..0000000000 --- a/gnu/packages/patches/grantlee-merge-theme-dirs.patch +++ /dev/null @@ -1,163 +0,0 @@ -Taken from nixpkgs, see -grantleetheme: merge themes across multiple prefixes - - - -diff --git a/src/grantleetheme.cpp b/src/grantleetheme.cpp -index 27d5bc8..8d43140 100644 ---- a/src/grantleetheme.cpp -+++ b/src/grantleetheme.cpp -@@ -46,7 +46,7 @@ ThemePrivate::ThemePrivate(const ThemePrivate &other) - , description(other.description) - , name(other.name) - , dirName(other.dirName) -- , absolutePath(other.absolutePath) -+ , absolutePaths(other.absolutePaths) - , author(other.author) - , email(other.email) - , loader(other.loader) -@@ -64,12 +64,15 @@ void ThemePrivate::setupEngine() - - void ThemePrivate::setupLoader() - { -- // Get the parent dir with themes, we set the theme directory separately -- QDir dir(absolutePath); -- dir.cdUp(); -+ QStringList templateDirs; -+ for (const QString& path : absolutePaths) { -+ QDir dir(path); -+ dir.cdUp(); -+ templateDirs << dir.absolutePath(); -+ } - - loader = QSharedPointer::create(); -- loader->setTemplateDirs({ dir.absolutePath() }); -+ loader->setTemplateDirs(templateDirs); - loader->setTheme(dirName); - - if (!sEngine) { -@@ -121,7 +124,7 @@ Theme::Theme(const QString &themePath, const QString &dirName, const QString &de - KConfigGroup group(&config, QStringLiteral("Desktop Entry")); - if (group.isValid()) { - d->dirName = dirName; -- d->absolutePath = themePath; -+ d->absolutePaths = QStringList(themePath); - d->name = group.readEntry("Name", QString()); - d->description = group.readEntry("Description", QString()); - d->themeFileName = group.readEntry("FileName", QString()); -@@ -140,7 +143,7 @@ Theme::~Theme() - - bool Theme::operator==(const Theme &other) const - { -- return isValid() && other.isValid() && d->absolutePath == other.absolutePath(); -+ return isValid() && other.isValid() && d->absolutePaths == other.absolutePaths(); - } - - Theme &Theme::operator=(const Theme &other) -@@ -184,7 +187,15 @@ QString Theme::dirName() const - - QString Theme::absolutePath() const - { -- return d->absolutePath; -+ if (! d->absolutePaths.isEmpty()) { -+ return d->absolutePaths.first(); -+ }; -+ return QString(); -+} -+ -+QStringList Theme::absolutePaths() const -+{ -+ return d->absolutePaths; - } - - QString Theme::author() const -@@ -223,6 +231,13 @@ QString Theme::render(const QString &templateName, const QVariantHash &data, con - return result; - } - -+void Theme::addThemeDir(const QString& path) -+{ -+ QDir dir(path); -+ dir.cdUp(); -+ d->absolutePaths << dir.absolutePath(); -+} -+ - void Theme::addPluginPath(const QString &path) - { - if (!ThemePrivate::sEngine) { -diff --git a/src/grantleetheme.h b/src/grantleetheme.h -index a25c27b..be38299 100644 ---- a/src/grantleetheme.h -+++ b/src/grantleetheme.h -@@ -48,11 +48,14 @@ public: - Q_REQUIRED_RESULT QStringList displayExtraVariables() const; - Q_REQUIRED_RESULT QString dirName() const; - Q_REQUIRED_RESULT QString absolutePath() const; -+ Q_REQUIRED_RESULT QStringList absolutePaths() const; - Q_REQUIRED_RESULT QString author() const; - Q_REQUIRED_RESULT QString authorEmail() const; - - Q_REQUIRED_RESULT QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray()); - -+ void addThemeDir(const QString&); -+ - static void addPluginPath(const QString &path); - - private: -diff --git a/src/grantleetheme_p.h b/src/grantleetheme_p.h -index eb73dcb..00510e9 100644 ---- a/src/grantleetheme_p.h -+++ b/src/grantleetheme_p.h -@@ -43,7 +43,7 @@ public: - QString description; - QString name; - QString dirName; -- QString absolutePath; -+ QStringList absolutePaths; - QString author; - QString email; - -diff --git a/src/grantleethememanager.cpp b/src/grantleethememanager.cpp -index 606d717..dc99041 100644 ---- a/src/grantleethememanager.cpp -+++ b/src/grantleethememanager.cpp -@@ -125,25 +125,18 @@ public: - - for (const QString &directory : qAsConst(themesDirectories)) { - QDirIterator dirIt(directory, QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot); -- QStringList alreadyLoadedThemeName; - while (dirIt.hasNext()) { - dirIt.next(); - const QString dirName = dirIt.fileName(); - GrantleeTheme::Theme theme = q->loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); - if (theme.isValid()) { - QString themeName = theme.name(); -- if (alreadyLoadedThemeName.contains(themeName)) { -- int i = 2; -- const QString originalName(theme.name()); -- while (alreadyLoadedThemeName.contains(themeName)) { -- themeName = originalName + QStringLiteral(" (%1)").arg(i); -- ++i; -- } -- theme.d->name = themeName; -+ QMap::iterator i = themes.find(dirName); -+ if (i != themes.end()) { -+ i.value().addThemeDir(dirIt.filePath()); -+ } else { -+ themes.insert(dirName, theme); - } -- alreadyLoadedThemeName << themeName; -- themes.insert(dirName, theme); -- //qDebug()<<" theme.name()"<addDir(directory); -@@ -366,7 +359,7 @@ QString ThemeManager::pathFromThemes(const QString &themesRelativePath, const QS - GrantleeTheme::Theme theme = loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); - if (theme.isValid()) { - if (dirName == themeName) { -- return theme.absolutePath(); -+ return theme.absolutePaths().first(); - } - } - } -- cgit v1.2.3 From 298b349a0524d6d52b4d37632001b92abd659098 Mon Sep 17 00:00:00 2001 From: Brendan Tildesley Date: Wed, 2 Feb 2022 20:08:23 +1100 Subject: gnu: KDE PIM: Update all packages to 21.12.3. * gnu/packages/kde-pim.scm (KDE PIM): Update to 21.12.3. (akonadi, akonadi-calendar, akonadi-contacts, akonadi-mime, akonadi-notes, akonadi-search, kaddressbook, kalarmcal, kcalendarsupport, kcalutils, kdepim-runtime, keventviews, kgpg, kidentitymanagement, kimap, kincidenceeditor, kldap, kleopatra, kmail, kmailcommon, kmailimporter, kmailtransport, kmbox, kmessagelib, kmime, knotes, kontactinterface, korganizer, kpeoplevcard, kpimcommon, kpimtextedit, ksmtp, ktnef, libgravatar, libkdepim, libkgapi, libkleo, libksieve): Update to 21.12.3. (kblog): Update to 20.04.3. * gnu/packages/patches/akonadi-not-relocatable.patch * gnu/packages/patches/akonadi-paths.patch * gnu/packages/patches/akonadi-timestamps.patch Fix patches to apply to latest code. (akonadi-calendar): [inputs]: Add new dependencies. (akonadi-contacts): [inputs]: Add new dependencies. (akonadi-search): [arguments]: Disable failing tests. (kcalendarsupport): [inputs]: Add new dependency, remove obsolete kdepim-apps-lib. (libksieve): [arguments]: Enable test that works now. * gnu/packages/patches/libksieve-Fix-missing-link-libraries.patch: Fix patch. (kaddressbook): [inputs]: Remove obsolete kdepim-apps-libs. Move kdocstools to native-inputs. (kmessagelib): [inputs]: Remove obsolete kdepim-appslibs, add kguiaddons. [arguments]: Fix findind header file. (kmailimporter): [inputs]: Add new dependencies. (kmailtransport): [inputs]: Add qtkeychain. (knotes): [inputs]: Move kdocstools to native-inputs. (kincidenceeditor): [inputs]: Add new dependencies. Remove obsolete kdepim-apps-libs [arguments]: Disable failing test. (kldap): [inputs]: Add qtkeychain. (kgpg)[arguments]: Disable failing tests. (libkleo): [propagated-inputs]: Propagate gpgme, qgpgme. [arguments]: Disable failing tests. (kdepim-runtime): [inputs]: Add new dependencies grantlee, grantleetheme, kcmutils, kldap, libkdepim, qtkeychain [arguments]: Enable all the tests that pass. We need to use the old hack instead of search-input-directory to workaround a mysterious include error. (kdepim-apps-lib): Remove obsolete package. (kmail): [origin]: Remove patch. Don't think it is needed anymore. [inputs]: Add new dependencies, delete obsolete kdepim-apps-libs and duplicate kmime. [arguments]: Disable failing tests. * gnu/packages/patches/kmail-Fix-missing-link-libraries.patch: Delete file. * gnu/local.mk: Remove reference to patch. (kmailcommon): [inputs]: Add new dependencies. Signed-off-by: Marius Bakke --- gnu/local.mk | 1 - gnu/packages/kde-pim.scm | 347 +++++++++++---------- gnu/packages/patches/akonadi-not-relocatable.patch | 51 ++- gnu/packages/patches/akonadi-paths.patch | 32 +- gnu/packages/patches/akonadi-timestamps.patch | 6 +- .../patches/kmail-Fix-missing-link-libraries.patch | 41 --- .../libksieve-Fix-missing-link-libraries.patch | 76 ++--- 7 files changed, 248 insertions(+), 306 deletions(-) delete mode 100644 gnu/packages/patches/kmail-Fix-missing-link-libraries.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index b8722c0a37..bd5889310f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1371,7 +1371,6 @@ dist_patch_DATA = \ %D%/packages/patches/kinit-kdeinit-extra_libs.patch \ %D%/packages/patches/kio-search-smbd-on-PATH.patch \ %D%/packages/patches/kismet-unbundle-boost.patch \ - %D%/packages/patches/kmail-Fix-missing-link-libraries.patch \ %D%/packages/patches/kmod-module-directory.patch \ %D%/packages/patches/kmscon-runtime-keymap-switch.patch \ %D%/packages/patches/kmplayer-aarch64.patch \ diff --git a/gnu/packages/kde-pim.scm b/gnu/packages/kde-pim.scm index 1ed90b95c1..a17dcad42c 100644 --- a/gnu/packages/kde-pim.scm +++ b/gnu/packages/kde-pim.scm @@ -45,14 +45,14 @@ (define-module (gnu packages kde-pim) (define-public akonadi (package (name "akonadi") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-" version ".tar.xz")) (sha256 - (base32 "0kkn7lh3akkk9cdi8qdk9kqzs1cgv916mkl440x4ykqd1v8brzqb")) + (base32 "026srxk7da20vfhbj7jh8aip3sylpm61czwblj3wxxps0vbxxs2g")) (patches (search-patches "akonadi-paths.patch" "akonadi-timestamps.patch" @@ -90,9 +90,7 @@ (define-public akonadi (modify-phases (@ (guix build qt-build-system) %standard-phases) (add-before 'configure 'add-definitions (lambda* (#:key outputs inputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (mysql (assoc-ref inputs "mysql")) - (pgsql (assoc-ref inputs "postgresql"))) + (let ((out (assoc-ref outputs "out"))) (with-output-to-file "CMakeLists.txt.new" (lambda _ (display @@ -120,14 +118,14 @@ (define-public akonadi (define-public akonadi-calendar (package (name "akonadi-calendar") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-calendar-" version ".tar.xz")) (sha256 - (base32 "1mq76qyd3jcngb2yfanpn7qvklzllza399fxwii0mqppp1vmnb2b")))) + (base32 "0hzy6y9pxa06k0pp5yr84i0sv15qgzjn7nrlmsylm6iy7fspqqbq")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -136,6 +134,8 @@ (define-public akonadi-calendar akonadi-contacts akonadi-mime boost + grantlee + grantleetheme kcalendarcore kcalutils kcodecs @@ -163,21 +163,24 @@ (define-public akonadi-calendar (define-public akonadi-contacts (package (name "akonadi-contacts") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-contacts-" version ".tar.xz")) (sha256 - (base32 "0igggarnl99s5pl73dgrpha4lf7vnr000iy69vcwmqs5lxb7cyli")))) + (base32 "04ixj09s27q8pbmfrb1475bc0h84sb5ikfxzpc4i5b3whx40g9dm")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) (inputs (list akonadi boost + grantlee + grantleetheme kauth + kcmutils kcodecs kcompletion kconfigwidgets @@ -194,6 +197,7 @@ (define-public akonadi-contacts ktextwidgets kwidgetsaddons kxmlgui + libkleo prison kio qtbase-5 @@ -214,14 +218,14 @@ (define-public akonadi-contacts (define-public akonadi-mime (package (name "akonadi-mime") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-mime-" version ".tar.xz")) (sha256 - (base32 "1wd776ia3z22a79biq04y4m83n8xpvfmyg8bcsslr7lmc3avdg8w")))) + (base32 "1bcrbf5z9175p206cvm5s6zq882nb32cf9akdcbnadqiibrpxkxv")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules libxslt ;; xslt for generating interface descriptions @@ -266,14 +270,14 @@ (define-public akonadi-mime (define-public akonadi-notes (package (name "akonadi-notes") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-notes-" version ".tar.xz")) (sha256 - (base32 "04y293kjrmjjcbb7fkjl7hl4vrks4cjjxnvc6ibzyv81rn6cdhh2")))) + (base32 "0xkcw9izgxfzglciig2i4wiz6iflzjg0d6dp1nq6p1kwxwc899sb")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -291,14 +295,14 @@ (define-public akonadi-notes (define-public akonadi-search (package (name "akonadi-search") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/akonadi-search-" version ".tar.xz")) (sha256 - (base32 "1h5p44y244gzf7ndzw7afrvq9c76ybp8ddvg82p3lzjh02rrvd50")))) + (base32 "1id6zzjxc9zvpz1ryj2zn1yff5ak04r1mlk9cklbj99frzf0wv6p")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules @@ -335,7 +339,8 @@ (define-public akonadi-search (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (invoke "dbus-launch" "ctest"))))))) + (invoke "dbus-launch" "ctest" "-E" + "akonadi-sqlite-collectionindexingjobtest"))))))) (home-page "https://api.kde.org/kdepim/akonadi/html/index.html") (synopsis "Akonadi search library") (description "This package provides a library used to search in the @@ -346,46 +351,58 @@ (define-public akonadi-search (define-public kincidenceeditor (package (name "kincidenceeditor") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/incidenceeditor-" version ".tar.xz")) (sha256 - (base32 "1xpp5lw60mvpjsjsxmicfa5y2d68wnb9vm4yb1krwkihm852ziny")))) + (base32 "1sbflfggpqhwhg3iw46462z3p83sjhlx6f1fvgz251m020vqq9xa")))) (properties `((upstream-name . "incidenceeditor"))) (build-system qt-build-system) (native-inputs - (list extra-cmake-modules)) + (list extra-cmake-modules dbus)) (inputs (list akonadi akonadi-calendar akonadi-contacts akonadi-mime boost + grantlee + grantleetheme kcalendarcore kcalendarsupport kcalutils kcodecs kcontacts kdbusaddons - kdepim-apps-libs kdiagram keventviews ki18n kiconthemes kidentitymanagement + kimap kio kitemmodels kldap kmailtransport kmime + kpimcommon kpimtextedit ktextwidgets kwallet libkdepim qtbase-5)) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "dbus-launch" "ctest" ;; FIXME: test fails. + "-E" "akonadi-sqlite-incidencedatetimetest")) + #t))))) (home-page "https://invent.kde.org/pim/incidenceeditor") (synopsis "KDE PIM library for editing incidences") (description "This library provides an incidence editor for KDE PIM.") @@ -395,17 +412,17 @@ (define-public kincidenceeditor (define-public kaddressbook (package (name "kaddressbook") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kaddressbook-" version ".tar.xz")) (sha256 - (base32 "1vpdhdj87ai2sxjn2jk3mh6bzfr1n3yzydnkgv7nc8v1m2fdawap")))) + (base32 "1hzq0fdy99l1kqw14d582l0s56gvrw86abihib6k4az4c6g3c0md")))) (build-system qt-build-system) (native-inputs - (list extra-cmake-modules)) + (list extra-cmake-modules kdoctools)) (inputs (list akonadi akonadi-contacts @@ -421,8 +438,6 @@ (define-public kaddressbook kcontacts kcrash kdbusaddons - kdepim-apps-libs - kdoctools ki18n kiconthemes kimap @@ -452,14 +467,14 @@ (define-public kaddressbook (define-public kalarmcal (package (name "kalarmcal") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kalarmcal-" version ".tar.xz")) (sha256 - (base32 "0g0bm4zzzcpl2pqqf609349zagwrgj6a4ibxpgg4zf21aacdq8bi")))) + (base32 "160pmr702b68hys9l02azvrv6pagy1r2whw0zp3jlf6863p9fkqr")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -493,14 +508,14 @@ (define-public kalarmcal (define-public kblog (package (name "kblog") - (version "20.04.1") + (version "20.04.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kblog-" version ".tar.xz")) (sha256 - (base32 "0pi3axs58wsz5vq6vyisz73s24q739zplwrblyvkcm16nll4mvhk")))) + (base32 "1d5r9ivc1xmhkrz780xga87p84h7dnxjl981qap16gy37sxahcjr")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -527,14 +542,14 @@ (define-public kblog (define-public kcalendarsupport (package (name "kcalendarsupport") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/calendarsupport-" version ".tar.xz")) (sha256 - (base32 "1yv3hs7qw481cxw4kzbx5l8vv18bgzm1b0vj3zrlqqxwl5ac6xvy")))) + (base32 "0annni037cp1ga2lj2gkjxlkygnaxna4fs095lbaqp5zljz3g8vp")))) (properties `((upstream-name . "calendarsupport"))) (build-system qt-build-system) (native-inputs @@ -543,12 +558,12 @@ (define-public kcalendarsupport (list akonadi akonadi-calendar akonadi-mime + akonadi-notes boost kcalendarcore kcalutils kcompletion kdbusaddons - kdepim-apps-libs kguiaddons kholidays ki18n @@ -572,14 +587,14 @@ (define-public kcalendarsupport (define-public kcalutils (package (name "kcalutils") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kcalutils-" version ".tar.xz")) (sha256 - (base32 "0v268w8vhgqxq1nwv9b9cy4h7zqgjrv19r44g3zc9w5j76ivix86")))) + (base32 "006sfkjzyid8byl2mmyn1is4nra9wjqh21ksd5g1kv948hf1jdcs")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules libxml2)) ;; xmllint required for tests @@ -607,61 +622,17 @@ (define-public kcalutils functions for accessing calendar data using the kcalcore API.") (license license:lgpl2.0+))) -(define-public kdepim-apps-libs - (package - (name "kdepim-apps-libs") - (version "20.04.1") - (source - (origin - (method url-fetch) - (uri (string-append "mirror://kde/stable/release-service/" version - "/src/kdepim-apps-libs-" version ".tar.xz")) - (sha256 - (base32 "0m9qrfjs97anh9h6ibggx23ddlm1zkxjap2iyf3gf672ip01fvci")))) - (build-system qt-build-system) - (native-inputs - (list extra-cmake-modules)) - (inputs - (list akonadi - akonadi-contacts - boost - gpgme - grantlee - grantleetheme - kconfig - kconfigwidgets - kcontacts - kcoreaddons - ki18n - kimap - kio - kitemmodels - kmime - kpimcommon - kservice - kwidgetsaddons - libkleo - prison - qgpgme - qtbase-5)) - (home-page "https://invent.kde.org/pim/kdepim-apps-libs") - (synopsis "KDE PIM mail related libraries and data files") - (description "This package provides mail related libraries and data files -for KDE PIM.") - (license ;; GPL for programs, LGPL for libraries - (list license:gpl2+ license:lgpl2.0+)))) - (define-public kdepim-runtime (package (name "kdepim-runtime") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kdepim-runtime-" version ".tar.xz")) (sha256 - (base32 "1in4x4wvgclkni72cfkw9jx35d0qd0jmfwybm3ksx5qx5sbki9gg")))) + (base32 "1ahrnnc9vn0556s4nrsjgc9vbf5rb6yby7fn33p3jjnpgja0mc7m")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules dbus kdoctools libxslt shared-mime-info)) @@ -673,9 +644,12 @@ (define-public kdepim-runtime akonadi-notes boost cyrus-sasl + grantlee + grantleetheme kalarmcal kcalendarcore kcalutils + kcmutils kcodecs kconfig kconfigwidgets @@ -687,6 +661,7 @@ (define-public kdepim-runtime kio kitemmodels kmailtransport + kldap kmbox kmime knotifications @@ -697,11 +672,13 @@ (define-public kdepim-runtime ktextwidgets kwallet kwindowsystem + libkdepim libkgapi ;; TODO: libkolab qca qtbase-5 qtdeclarative-5 + qtkeychain qtnetworkauth-5 qtspeech qtwebchannel-5 @@ -710,8 +687,7 @@ (define-public kdepim-runtime (arguments ;; TODO: 5/45 tests fail for quite different reasons, even with ;; "offscreen" and dbus - `(#:tests? #f - #:phases (modify-phases %standard-phases + `(#:phases (modify-phases %standard-phases (add-after 'set-paths 'extend-CPLUS_INCLUDE_PATH (lambda* (#:key inputs #:allow-other-keys) ;; FIXME: is not @@ -719,8 +695,19 @@ (define-public kdepim-runtime ;; this hack. (setenv "CPLUS_INCLUDE_PATH" (string-append - (search-input-directory inputs "include/KF5") - ":" (or (getenv "CPLUS_INCLUDE_PATH") "")))))))) + (assoc-ref inputs "akonadi-mime") "/include/KF5:" + (or (getenv "CPLUS_INCLUDE_PATH") ""))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; FIXME: Atleast some appear to require network. + (invoke "dbus-launch" "ctest" "-E" "\ +(akonadi-sqlite-synctest|akonadi-sqlite-pop3test|storecompacttest\ +|akonadi-sqlite-ewstest|ewsmoveitemrequest_ut|ewsdeleteitemrequest_ut\ +|ewsgetitemrequest_ut|ewsunsubscriberequest_ut|ewssettings_ut\ +|templatemethodstest|akonadi-sqlite-serverbusytest|ewsattachment_ut|\\ +testmovecollectiontask)")) + #t))))) (home-page "https://invent.kde.org/pim/kdepim-runtime") (synopsis "Runtime components for Akonadi KDE") (description "This package contains Akonadi agents written using KDE @@ -735,14 +722,14 @@ (define-public kdepim-runtime (define-public keventviews (package (name "keventviews") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/eventviews-" version ".tar.xz")) (sha256 - (base32 "0si9p95rgp7mgkzhzwyy10zrwzy1kipbhm1y96yjlc9rxi3jrc73")))) + (base32 "01x9ccwspn1dwkmcxcr8p6pazj6w31pxhx0bzlfr6bgpccicp2w2")))) (properties `((upstream-name . "eventviews"))) (build-system qt-build-system) (native-inputs @@ -784,23 +771,34 @@ (define-public keventviews (define-public kgpg (package (name "kgpg") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kgpg-" version ".tar.xz")) (sha256 - (base32 "03d3gsbara7ga2cyrhafkw11qq9cj804h9vpvxl4wd2a9c90snkh")))) + (base32 "1mzq3g4xwg459k0mp9xvg8bhilizadbh4gck1764wq69bxlcyav3")))) (build-system qt-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "dbus-launch" "ctest" "-E" ;; FIXME: Failing tests. + "(kgpg-import|kgpg-disable)"))))))) (native-inputs (list extra-cmake-modules gnupg ;; TODO: Remove after gpgme uses fixed path + dbus ;; Remove after failing test passes kdoctools)) (inputs (list akonadi akonadi-contacts boost gpgme + grantlee + grantleetheme karchive kcodecs kcontacts @@ -831,14 +829,14 @@ (define-public kgpg (define-public kidentitymanagement (package (name "kidentitymanagement") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kidentitymanagement-" version ".tar.xz")) (sha256 - (base32 "0flp9p9hlr1zfgvsy5i1nq55p7bvnhqxkxbif1lyw0cq6iblxhgr")))) + (base32 "18xwvlmqhih5jmig2mj3a6mc5awlxdv8f81da6cgm123imhrirk4")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -870,14 +868,14 @@ (define-public kidentitymanagement (define-public kimap (package (name "kimap") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kimap-" version ".tar.xz")) (sha256 - (base32 "1x22wfzqp92mn1fy2xl89k9yjfk2vgcva0fd30i9rrqj4aw2rsma")))) + (base32 "11jd9zkvflfh3gqs36fhj8mla3k44xf7zdb0z4nl9sk5nhhgm5px")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -901,24 +899,24 @@ (define-public kimap (define-public kldap (package (name "kldap") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kldap-" version ".tar.xz")) (sha256 - (base32 "0whlp586ycsx0qf0nr81avwscpq62w5js46z7vayy0dxkhrhfayr")))) + (base32 "13llsfhx9lfvhf90a3vmpkyh02fjg5sp4fmrwrqyx9hjrbmy1g0a")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules kdoctools)) (inputs - (list ki18n kio kwidgetsaddons qtbase-5)) + (list ki18n kio kwidgetsaddons qtbase-5 qtkeychain)) (propagated-inputs (list cyrus-sasl openldap)) (home-page "https://api.kde.org/kdepim/kldap/html/index.html") (synopsis "Library for accessing LDAP") - (description " This is a library for accessing LDAP with a convenient Qt + (description "This is a library for accessing LDAP with a convenient Qt style C++ API. LDAP (Lightweight Directory Access Protocol) is an application protocol for querying and modifying directory services running over TCP/IP.") (license license:lgpl2.0+))) @@ -926,14 +924,14 @@ (define-public kldap (define-public kleopatra (package (name "kleopatra") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kleopatra-" version ".tar.xz")) (sha256 - (base32 "1m50nzb2m27fkb8z3k34cv4zi2akr0fx8zn7lk5swhg49sgrip6n")))) + (base32 "10f61m0qrs0qipn94jd32gibyj8pcvprs8j7gmac0mym0b3djjls")))) (build-system qt-build-system) (native-inputs (list dbus extra-cmake-modules gnupg ;; TODO: Remove after gpgme uses fixed path @@ -968,7 +966,7 @@ (define-public kleopatra (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (invoke "dbus-launch" "ctest" ".")) + (invoke "dbus-launch" "ctest")) #t))))) (home-page "https://apps.kde.org/kleopatra/") (synopsis "Certificate Manager and Unified Crypto GUI") @@ -981,15 +979,14 @@ (define-public kleopatra (define-public kmail (package (name "kmail") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kmail-" version ".tar.xz")) (sha256 - (base32 "06qfxzi5pasm6p5ck44sjca96dz8xzd1nndq5lqcyvcxmmnvvz3p")) - (patches (search-patches "kmail-Fix-missing-link-libraries.patch")))) + (base32 "1knh6cf72hidc6jyiw250b708b410fla0c5w83zaavmwv37ah8z0")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules dbus kdoctools)) @@ -1000,6 +997,8 @@ (define-public kmail akonadi-search boost gpgme + grantlee + grantleetheme kbookmarks kcalendarcore kcalutils @@ -1010,7 +1009,6 @@ (define-public kmail kcontacts kcrash kdbusaddons - kdepim-apps-libs kguiaddons ki18n kiconthemes @@ -1025,7 +1023,6 @@ (define-public kmail kmailtransport kmessagelib kmime - kmime knotifications knotifyconfig kontactinterface @@ -1035,6 +1032,7 @@ (define-public kmail kservice ksyntaxhighlighting ktextwidgets + kuserfeedback ktnef kwallet kwidgetsaddons @@ -1048,6 +1046,7 @@ (define-public kmail qgpgme qtbase-5 qtdeclarative-5 + qtkeychain qtwebchannel-5 qtwebengine-5 sonnet)) @@ -1057,7 +1056,14 @@ (define-public kmail (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (invoke "dbus-launch" "ctest" ".")) + (invoke "dbus-launch" "ctest" "-E" ;; FIXME: Many failing tests. + "(akonadi-sqlite-kmcomposerwintest|\ +akonadi-sqlite-tagselectdialogtest|\ +akonadi-sqlite-kmcommandstest|\ +sendlateragent-sendlaterutiltest|\ +sendlateragent-sendlaterconfigtest|\ +followupreminder-followupreminderconfigtest|\ +akonadi-sqlite-unifiedmailboxmanagertest)")) #t))))) (home-page "https://kontact.kde.org/components/kmail/") (synopsis "Full featured graphical email client") @@ -1074,14 +1080,14 @@ (define-public kmail (define-public kmailcommon (package (name "kmailcommon") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/mailcommon-" version ".tar.xz")) (sha256 - (base32 "0q1k57zx1l7bnzrk1hadjxjn6r4yzz833mgsvaai9sd8qg022x2l")))) + (base32 "1zi8zkhv9g4vsylqzjm2wr9v6b20irfxhf4q467cmpqqrqpcp3af")))) (properties `((upstream-name . "mailcommon"))) (build-system qt-build-system) (native-inputs @@ -1092,6 +1098,8 @@ (define-public kmailcommon akonadi-mime boost gpgme + grantlee + grantleetheme karchive kcodecs kcompletion @@ -1100,6 +1108,7 @@ (define-public kmailcommon kcontacts kdbusaddons kdesignerplugin + kguiaddons ki18n kiconthemes kidentitymanagement @@ -1127,7 +1136,7 @@ (define-public kmailcommon qgpgme qtbase-5)) (arguments - `(#:tests? #f)) ;; TODO: 4/56 tests fail, even with "offscreen" and dbus + `(#:tests? #f)) ;; TODO: 12/62 tests fail (home-page "https://invent.kde.org/pim/mailcommon") (synopsis "KDE email utility library") (description "The mail common library provides utility functions for @@ -1138,32 +1147,38 @@ (define-public kmailcommon (define-public kmailimporter (package (name "kmailimporter") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/mailimporter-" version ".tar.xz")) (sha256 - (base32 "1929pw0shdzi0yvjnqhak680hjjibg8f8hqy3svyxxhiqbhfjm26")))) + (base32 "0lcr9zzdf16f82spr9x33jnzr23sx7xk2zvfpzdki3b5jxvapnsk")))) (properties `((upstream-name . "mailimporter"))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) (inputs (list akonadi + akonadi-contacts akonadi-mime + grantlee + grantleetheme boost karchive kcompletion kconfig kconfigwidgets + kcontacts kcoreaddons kdbusaddons ki18n + kimap kio kitemmodels kmime + kpimcommon kxmlgui libkdepim qtbase-5)) @@ -1177,14 +1192,14 @@ (define-public kmailimporter (define-public kmailtransport (package (name "kmailtransport") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kmailtransport-" version ".tar.xz")) (sha256 - (base32 "1swqlgzxzlqffm119sbhszy9lr93m8lzwygr0q4raa660b6yiavm")))) + (base32 "0l3pgs781a6is937i0bkz9ykr40l36rwlrirsr4g8wh0gkc3ifi6")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules kdoctools)) @@ -1206,7 +1221,8 @@ (define-public kmailtransport ktextwidgets kwallet libkgapi - qtbase-5)) + qtbase-5 + qtkeychain)) (arguments `(#:tests? #f)) ;; TODO - 3/3 tests fail, require drkonqi (home-page "https://api.kde.org/kdepim/kmailtransport/html/index.html") @@ -1218,14 +1234,14 @@ (define-public kmailtransport (define-public kmbox (package (name "kmbox") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kmbox-" version ".tar.xz")) (sha256 - (base32 "03cny38v4y1lmcrs6d34hbj9assqgf51rqryf5rdzkiaq79c1krc")))) + (base32 "04cl2khj3a7n81nlmxsg8kgszrl22qm6s2kvbrhz39yfzi31cwqr")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1240,14 +1256,14 @@ (define-public kmbox (define-public kmessagelib (package (name "kmessagelib") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/messagelib-" version ".tar.xz")) (sha256 - (base32 "03vq4962bhps2j9c9i52majlbkmvg2gmr197igv8xamja1vs8hk1")))) + (base32 "0xrhnkahqirsz37lbvx505ll7bfhr25lbq89yqq81bxbzkbvamsw")))) (properties `((upstream-name . "messagelib"))) (build-system qt-build-system) (native-inputs @@ -1270,7 +1286,7 @@ (define-public kmessagelib kconfigwidgets kcontacts kdbusaddons - kdepim-apps-libs + kguiaddons ki18n kiconthemes kidentitymanagement @@ -1309,12 +1325,11 @@ (define-public kmessagelib (add-after 'set-paths 'extend-CPLUS_INCLUDE_PATH (lambda* (#:key inputs #:allow-other-keys) ;; FIXME: One of the compilation steps fail to find - ;; without this hack. + ;; without this hack. (setenv "CPLUS_INCLUDE_PATH" - (string-append - (assoc-ref inputs "libkdepim") - "/include/KF5:" - (or (getenv "CPLUS_INCLUDE_PATH") "")))))))) + (string-append (assoc-ref inputs "qtbase") + "/include/qt5/QtPrintSupport:" + (or (getenv "CPLUS_INCLUDE_PATH") "")))))))) (home-page "https://invent.kde.org/pim/messagelib") (synopsis "KDE PIM messaging libraries") (description "This package provides several libraries for messages, @@ -1326,14 +1341,14 @@ (define-public kmessagelib (define-public kmime (package (name "kmime") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kmime-" version ".tar.xz")) (sha256 - (base32 "1dkdxfr1ry10qyql5sp1ai4li11f0ncf9hipg27j59y70mlyrl2r")))) + (base32 "03s7l4lywdvp97h4qjgq06qqcclvnhy83qsrfzv0w2wcl631nnpw")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1362,17 +1377,17 @@ (define-public kmime (define-public knotes (package (name "knotes") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/knotes-" version ".tar.xz")) (sha256 - (base32 "13h4n7fb5p6g1f5kmw6pblpd76j904psm30s3a5d3kykni57dijx")))) + (base32 "07pj0aqwsy1xi5mx7x0h3zmxfg0n4afgjax9a9ihc553xs6k48d7")))) (build-system qt-build-system) (native-inputs - (list extra-cmake-modules libxslt)) + (list extra-cmake-modules kdoctools libxslt)) (inputs (list akonadi akonadi-contacts @@ -1392,14 +1407,12 @@ (define-public knotes kcoreaddons kcrash kdnssd - kdoctools kglobalaccel kiconthemes kimap kitemmodels kitemviews kmime - kmime knewstuff knotifications knotifyconfig @@ -1434,14 +1447,14 @@ (define-public knotes (define-public kontactinterface (package (name "kontactinterface") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kontactinterface-" version ".tar.xz")) (sha256 - (base32 "0s1qm1wjkvbb1film94r7g88d8vgh26bm0hm6gpyqv5bazw5qx3j")))) + (base32 "1qwx0q4bbk3d720ij37wbd54g9alw6ispjl1mq19hkk3gs5l1c78")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1462,14 +1475,14 @@ (define-public kontactinterface (define-public korganizer (package (name "korganizer") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/korganizer-" version ".tar.xz")) (sha256 - (base32 "04lz3ldrr0lpy9zpsg9ja1i9gxzlcjpqcwn3g7l4jjdky4frcr2r")))) + (base32 "072pyzs38dv07mwi4hlfb4rh9jx40dpxac3ywy7kj6nyvbfjmh0r")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules dbus qttools-5 kdoctools)) @@ -1481,6 +1494,8 @@ (define-public korganizer akonadi-notes akonadi-search boost + grantlee + grantleetheme kcalendarcore kcalendarsupport kcalutils @@ -1493,7 +1508,6 @@ (define-public korganizer kcoreaddons kcrash kdbusaddons - kdepim-apps-libs keventviews kholidays kiconthemes @@ -1536,11 +1550,11 @@ (define-public korganizer (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (invoke "dbus-launch" "ctest" ".")) + (invoke "dbus-launch" "ctest")) #t))))) (home-page "https://apps.kde.org/korganizer/") (synopsis "Organizational assistant, providing calendars and other similar -functionality to help you organize your life.") +functionality to help you organize your life") (description "KOrganizer is the calendar and scheduling component of Kontact. It provides management of events and tasks, alarm notification, web export, network transparent handling of data, group scheduling, import and @@ -1585,14 +1599,14 @@ (define-public kpeoplevcard (define-public kpimcommon (package (name "kpimcommon") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/pimcommon-" version ".tar.xz")) (sha256 - (base32 "15lfqv5w4iwyjlvf4idykpkjgppl0ic59r4dw95qkbbjkps0nr7j")))) + (base32 "1k1d100lr277lgwyzn2ssxsx9x2yd9nfd5657r95vmdnkh2qs517")))) (properties `((upstream-name . "pimcommon"))) (build-system qt-build-system) (native-inputs @@ -1602,9 +1616,13 @@ (define-public kpimcommon akonadi akonadi-contacts akonadi-mime + akonadi-search boost grantlee + grantleetheme ;; TODO: ("kaccounts" ,kaccounts) + kcalendarcore + kcmutils kcodecs kconfig kconfigwidgets @@ -1619,10 +1637,10 @@ (define-public kpimcommon kitemmodels kitemviews kjobwidgets + kldap kmime knewstuff kpimtextedit - kservice ktextwidgets kwallet kwidgetsaddons @@ -1644,14 +1662,14 @@ (define-public kpimcommon (define-public libgravatar (package (name "libgravatar") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/libgravatar-" version ".tar.xz")) (sha256 - (base32 "0981ci2kr20v4fk11h57rqya0brgslfazpgq1yk5yqiwyqqm49r2")))) + (base32 "1bihy3dfagwc7aday40myqjbn555mkzzaaq7c14ywkmhh99dhvh7")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) (inputs (list kconfig @@ -1674,14 +1692,14 @@ (define-public libgravatar (define-public kpimtextedit (package (name "kpimtextedit") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/kpimtextedit-" version ".tar.xz")) (sha256 - (base32 "0j6d4sv405c3x0ww75qsww94apidsb8aaqf59akhv96zmv0vx5wy")))) + (base32 "19hrqbjcmpi81vmnggrkrv0fcc9inhz5aa5klx0141aylnzfgwsl")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -1715,14 +1733,14 @@ (define-public kpimtextedit (define-public ksmtp (package (name "ksmtp") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/ksmtp-" version ".tar.xz")) (sha256 - (base32 "1xyaahibm0dc3qdwiak5yqa66szxaxnylvqxi6k21ayvzn2vxbhx")))) + (base32 "0kdy5gsg1sgccvdk1fpf866xl9m8v8z034jpgf6s7n2pr5r5mni2")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1755,14 +1773,14 @@ (define-public ksmtp (define-public ktnef (package (name "ktnef") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/ktnef-" version ".tar.xz")) (sha256 - (base32 "0cn5p32w2kas56yyc15c22kll4hd02lvvxz2n6cz1wda8alspj19")))) + (base32 "1in991n8alkxf40p0wvkr7gdaaz8w4kdw1rsq6sbjil6cs4cr5nl")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules)) @@ -1787,14 +1805,14 @@ (define-public ktnef (define-public libkdepim (package (name "libkdepim") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/libkdepim-" version ".tar.xz")) (sha256 - (base32 "0bask561laxgkgm3rxfpyxqs6jx1l9xjk058lhycq0pik6vwhdha")))) + (base32 "0g9jx6z5jf9yqn01xc1k038b4ljr9sil7bwvifc64s38qxl9wmww")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -1834,14 +1852,14 @@ (define-public libkdepim (define-public libkgapi (package (name "libkgapi") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/libkgapi-" version ".tar.xz")) (sha256 - (base32 "0nvd5fqrvyb7c3g7rf1lxbbv38q9sqnhd6irgx7awwgw92inxky4")))) + (base32 "1vbk8786mk1irm94bsm97270gnd149nz7w0zqnvwz499f72d21jx")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules qttools-5)) @@ -1869,14 +1887,14 @@ (define-public libkgapi (define-public libkleo (package (name "libkleo") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/libkleo-" version ".tar.xz")) (sha256 - (base32 "0rijpmqyx4mrr7csik3vkfcra7kfywk6yz548fmq3ha8wa9ax8fv")))) + (base32 "19q128ldi0aspy7vc03r54vrf7wz7l1181x9pbmax8340nbnaz7l")))) (build-system qt-build-system) (native-inputs (list extra-cmake-modules kdoctools qttools-5)) @@ -1895,6 +1913,18 @@ (define-public libkleo kpimtextedit qgpgme qtbase-5)) + (propagated-inputs + `(("gpgme" ,gpgme) + ("qgpgme" ,qgpgme))) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? ;; FIXME: These tests fail. + (invoke "ctest" "-E" + "(keyresolvercoretest|newkeyapprovaldialogtest)")) + #t))))) (home-page "https://invent.kde.org/pim/libkleo") (synopsis "KDE PIM cryptographic library") (description "@code{libkleo} is a library for Kleopatra and other parts of @@ -1905,14 +1935,14 @@ (define-public libkleo (define-public libksieve (package (name "libksieve") - (version "20.04.1") + (version "21.12.3") (source (origin (method url-fetch) (uri (string-append "mirror://kde/stable/release-service/" version "/src/libksieve-" version ".tar.xz")) (sha256 - (base32 "04k2nkwg5vlgbr5wpvsq02wi54ljsy4ka7y3ns5x3d2gb06wp03c")) + (base32 "1li9cc5y6xbn4m4qa21qmsjd4xzshp67mxwh2nvr17mfs8ray7vd")) (patches (search-patches "libksieve-Fix-missing-link-libraries.patch")))) (build-system qt-build-system) (native-inputs @@ -1951,11 +1981,6 @@ (define-public libksieve "src/ksieveui/editor/webengine/autotests/CMakeLists.txt" (("^\\s*(add_test|ecm_mark_as_test)\\W" line) (string-append "# " line))) - ;; FIXME: This test fails due to time zone problems. - (substitute* - "src/ksieveui/autocreatescripts/autotests/CMakeLists.txt" - ((".*sieveeditorgraphicalmodewidgettest\\.cpp.*") - "")) #t))))) (home-page "https://invent.kde.org/pim/libksieve") (synopsis "KDE Sieve library") diff --git a/gnu/packages/patches/akonadi-not-relocatable.patch b/gnu/packages/patches/akonadi-not-relocatable.patch index c3964c5c05..bd4cbee79f 100644 --- a/gnu/packages/patches/akonadi-not-relocatable.patch +++ b/gnu/packages/patches/akonadi-not-relocatable.patch @@ -1,19 +1,18 @@ -From bc018b4bc816a3b51deb9739bedbf8a2268d0684 Mon Sep 17 00:00:00 2001 -From: gnidorah -Date: Fri, 22 Dec 2017 17:36:03 +0300 -Subject: [PATCH] Revert "Make Akonadi installation properly relocatable" +From 4b90a0bd4411a66bbe6ecf85ce89a60a58bee969 Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Sun, 25 Apr 2021 08:01:21 -0500 +Subject: [PATCH 3/3] akonadi revert make relocatable -This reverts commit b2bb55f13f2ac783f89cc414de8c39f62fa2096a. --- CMakeLists.txt | 3 --- KF5AkonadiConfig.cmake.in | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) -Index: akonadi-19.08.0/CMakeLists.txt -=================================================================== ---- akonadi-19.08.0.orig/CMakeLists.txt -+++ akonadi-19.08.0/CMakeLists.txt -@@ -306,9 +306,6 @@ configure_package_config_file( +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4e8cc81..63161b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -368,9 +368,6 @@ configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} @@ -21,29 +20,25 @@ Index: akonadi-19.08.0/CMakeLists.txt - AKONADI_INCLUDE_DIR - KF5Akonadi_DATA_DIR ) - + install(FILES -Index: akonadi-19.08.0/KF5AkonadiConfig.cmake.in -=================================================================== ---- akonadi-19.08.0.orig/KF5AkonadiConfig.cmake.in -+++ akonadi-19.08.0/KF5AkonadiConfig.cmake.in -@@ -26,8 +26,8 @@ if(BUILD_TESTING) - find_dependency(Qt5Test "@QT_REQUIRED_VERSION@") - endif() - +diff --git a/KF5AkonadiConfig.cmake.in b/KF5AkonadiConfig.cmake.in +index bcf7320..1574319 100644 +--- a/KF5AkonadiConfig.cmake.in ++++ b/KF5AkonadiConfig.cmake.in +@@ -1,10 +1,10 @@ + @PACKAGE_INIT@ + -set_and_check(AKONADI_DBUS_INTERFACES_DIR "@PACKAGE_AKONADI_DBUS_INTERFACES_INSTALL_DIR@") -set_and_check(AKONADI_INCLUDE_DIR "@PACKAGE_AKONADI_INCLUDE_DIR@") +set_and_check(AKONADI_DBUS_INTERFACES_DIR "@AKONADI_DBUS_INTERFACES_INSTALL_DIR@") +set_and_check(AKONADI_INCLUDE_DIR "@AKONADI_INCLUDE_DIR@") - - find_dependency(Boost "@Boost_MINIMUM_VERSION@") - -@@ -35,7 +35,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/KF5Ako - include(${CMAKE_CURRENT_LIST_DIR}/KF5AkonadiMacros.cmake) - + # The directory where akonadi-xml.xsd and kcfg2dbus.xsl are installed -set(KF5Akonadi_DATA_DIR "@PACKAGE_KF5Akonadi_DATA_DIR@") +set(KF5Akonadi_DATA_DIR "@KF5Akonadi_DATA_DIR@") - - #################################################################################### - # CMAKE_AUTOMOC + + # set the directories + if(NOT AKONADI_INSTALL_DIR) +-- +2.31.1 diff --git a/gnu/packages/patches/akonadi-paths.patch b/gnu/packages/patches/akonadi-paths.patch index ac08ec5448..bb4a19ede0 100644 --- a/gnu/packages/patches/akonadi-paths.patch +++ b/gnu/packages/patches/akonadi-paths.patch @@ -1,26 +1,26 @@ This is based on the respectve patch from NixPkgs, but with the parts pinning -mysql and postgresql executables removed. The our package definition on why. +mysql and postgresql executables removed. See our package definition on why. diff --git a/src/akonadicontrol/agentmanager.cpp b/src/akonadicontrol/agentmanager.cpp --- a/src/akonadicontrol/agentmanager.cpp +++ b/src/akonadicontrol/agentmanager.cpp -@@ -61,7 +61,7 @@ public: - []() { - QCoreApplication::instance()->exit(255); - }); +@@ -47,7 +47,7 @@ public: + connect(this, &Akonadi::ProcessControl::unableToStart, this, []() { + QCoreApplication::instance()->exit(255); + }); - start(QStringLiteral("akonadiserver"), args, RestartOnCrash); -+ start(QLatin1String(NIX_OUT "/bin/akonadiserver"), args, RestartOnCrash); ++ start(QStringLiteral(NIX_OUT "/bin/akonadiserver"), args, RestartOnCrash); } - + ~StorageProcessControl() override -@@ -84,7 +84,7 @@ public: - []() { - qCCritical(AKONADICONTROL_LOG) << "Failed to start AgentServer!"; - }); +@@ -69,7 +69,7 @@ public: + connect(this, &Akonadi::ProcessControl::unableToStart, this, []() { + qCCritical(AKONADICONTROL_LOG) << "Failed to start AgentServer!"; + }); - start(QStringLiteral("akonadi_agent_server"), args, RestartOnCrash); -+ start(QLatin1String(NIX_OUT "/bin/akonadi_agent_server"), args, RestartOnCrash); ++ start(QStringLiteral(NIX_OUT "/bin/akonadi_agent_server"), args, RestartOnCrash); } - + ~AgentServerProcessControl() override diff --git a/src/akonadicontrol/agentprocessinstance.cpp b/src/akonadicontrol/agentprocessinstance.cpp --- a/src/akonadicontrol/agentprocessinstance.cpp @@ -37,12 +37,12 @@ diff --git a/src/akonadicontrol/agentprocessinstance.cpp b/src/akonadicontrol/ag diff --git a/src/server/storage/dbconfigmysql.cpp b/src/server/storage/dbconfigmysql.cpp --- a/src/server/storage/dbconfigmysql.cpp +++ b/src/server/storage/dbconfigmysql.cpp -@@ -209,7 +209,7 @@ bool DbConfigMysql::startInternalServer() +@@ -215,7 +215,7 @@ bool DbConfigMysql::startInternalServer() #endif - + // generate config file - const QString globalConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-global.conf")); + const QString globalConfig = QLatin1String(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf"); - const QString localConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-local.conf")); + const QString localConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-local.conf")); const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf"); if (globalConfig.isEmpty()) { diff --git a/gnu/packages/patches/akonadi-timestamps.patch b/gnu/packages/patches/akonadi-timestamps.patch index e299a6991f..df81fdb2dc 100644 --- a/gnu/packages/patches/akonadi-timestamps.patch +++ b/gnu/packages/patches/akonadi-timestamps.patch @@ -2,12 +2,12 @@ Index: akonadi-19.08.0/src/server/storage/dbconfigmysql.cpp =================================================================== --- akonadi-19.08.0.orig/src/server/storage/dbconfigmysql.cpp +++ akonadi-19.08.0/src/server/storage/dbconfigmysql.cpp -@@ -235,8 +235,7 @@ bool DbConfigMysql::startInternalServer( +@@ -260,8 +260,7 @@ bool DbConfigMysql::startInternalServer( bool confUpdate = false; QFile actualFile(actualConfig); // update conf only if either global (or local) is newer than actual -- if ((QFileInfo(globalConfig).lastModified() > QFileInfo(actualFile).lastModified()) || -- (QFileInfo(localConfig).lastModified() > QFileInfo(actualFile).lastModified())) { +- if ((QFileInfo(globalConfig).lastModified() > QFileInfo(actualFile).lastModified()) +- || (QFileInfo(localConfig).lastModified() > QFileInfo(actualFile).lastModified())) { + if (true) { QFile globalFile(globalConfig); QFile localFile(localConfig); diff --git a/gnu/packages/patches/kmail-Fix-missing-link-libraries.patch b/gnu/packages/patches/kmail-Fix-missing-link-libraries.patch deleted file mode 100644 index fc784d63dd..0000000000 --- a/gnu/packages/patches/kmail-Fix-missing-link-libraries.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 6b0a3a60870499b20ce9ae2ea07cbc5ee53cbdd2 Mon Sep 17 00:00:00 2001 -From: Hartmut Goebel -Date: Tue, 21 Jan 2020 23:23:38 +0100 -Subject: [PATCH] Fix missing link libraries. - -See - -These are only actually missing if the libraries reside in different -prefixes, as it is the case in Guix or Nix. ---- - agents/archivemailagent/CMakeLists.txt | 1 + - agents/followupreminderagent/CMakeLists.txt | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/agents/archivemailagent/CMakeLists.txt b/agents/archivemailagent/CMakeLists.txt -index 95c6249de..d0ddcd475 100644 ---- a/agents/archivemailagent/CMakeLists.txt -+++ b/agents/archivemailagent/CMakeLists.txt -@@ -22,6 +22,7 @@ ki18n_wrap_ui(libarchivemailagent_SRCS ui/archivemailwidget.ui ) - add_library(archivemailagent STATIC ${libarchivemailagent_SRCS}) - target_link_libraries(archivemailagent - KF5::MailCommon -+ KF5::Libkdepim - KF5::I18n - KF5::Notifications - KF5::KIOWidgets -diff --git a/agents/followupreminderagent/CMakeLists.txt b/agents/followupreminderagent/CMakeLists.txt -index 9ae7eaa29..527044807 100644 ---- a/agents/followupreminderagent/CMakeLists.txt -+++ b/agents/followupreminderagent/CMakeLists.txt -@@ -27,6 +27,7 @@ target_link_libraries(followupreminderagent - KF5::AkonadiMime - KF5::AkonadiAgentBase - KF5::DBusAddons -+ KF5::FollowupReminder - KF5::XmlGui - KF5::KIOWidgets - KF5::Notifications --- -2.21.1 - diff --git a/gnu/packages/patches/libksieve-Fix-missing-link-libraries.patch b/gnu/packages/patches/libksieve-Fix-missing-link-libraries.patch index 238c4ec46c..3835c2e313 100644 --- a/gnu/packages/patches/libksieve-Fix-missing-link-libraries.patch +++ b/gnu/packages/patches/libksieve-Fix-missing-link-libraries.patch @@ -1,59 +1,23 @@ -From 732861dda9c466841a09329a0b2c992f2b78c40a Mon Sep 17 00:00:00 2001 -From: Hartmut Goebel -Date: Tue, 21 Jan 2020 23:15:23 +0100 -Subject: [PATCH] Fix missing link libraries. - See -These are only actually missing if the libraries reside in different -prefixes, as it is the case in Guix or Nix. ---- - src/ksieveui/autocreatescripts/tests/CMakeLists.txt | 2 ++ - src/ksieveui/scriptsparsing/autotests/CMakeLists.txt | 2 +- - src/ksieveui/scriptsparsing/tests/CMakeLists.txt | 8 ++++++-- - 3 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/src/ksieveui/autocreatescripts/tests/CMakeLists.txt b/src/ksieveui/autocreatescripts/tests/CMakeLists.txt -index 8a482b4..c43216c 100644 ---- a/src/ksieveui/autocreatescripts/tests/CMakeLists.txt -+++ b/src/ksieveui/autocreatescripts/tests/CMakeLists.txt -@@ -15,6 +16,7 @@ set(parsingscript_gui_SRCS parsingscript_gui.cpp ../../tests/capability.cpp) - add_executable(parsingscript_gui ${parsingscript_gui_SRCS}) - target_link_libraries(parsingscript_gui - KF5::KIOCore -+ KF5::SyntaxHighlighting - KF5::KSieveUi - KF5::KSieve - KF5::PimCommon -diff --git a/src/ksieveui/scriptsparsing/autotests/CMakeLists.txt b/src/ksieveui/scriptsparsing/autotests/CMakeLists.txt -index e41a74e..31703ef 100644 ---- a/src/ksieveui/scriptsparsing/autotests/CMakeLists.txt -+++ b/src/ksieveui/scriptsparsing/autotests/CMakeLists.txt -@@ -5,7 +5,7 @@ macro(add_sieveeditor_xmlprintingscriptbuilding _source _extrasource) - ecm_add_test(${_test} - TEST_NAME ${_name} - NAME_PREFIX "sieveeditor-xmlprintingscriptbuilding-" -- LINK_LIBRARIES Qt5::Test KF5::I18n KF5::KSieveUi -+ LINK_LIBRARIES Qt5::Test KF5::I18n KF5::KSieveUi KF5::SyntaxHighlighting - ) - endmacro() - add_sieveeditor_xmlprintingscriptbuilding(xmlprintingscriptbuildertest.cpp "" "") -diff --git a/src/ksieveui/scriptsparsing/tests/CMakeLists.txt b/src/ksieveui/scriptsparsing/tests/CMakeLists.txt -index a252039..99a1aaa 100644 ---- a/src/ksieveui/scriptsparsing/tests/CMakeLists.txt -+++ b/src/ksieveui/scriptsparsing/tests/CMakeLists.txt -@@ -9,5 +9,9 @@ set(xmlsieveparsing_SRCS - ) - - add_executable(xmlsieveparsing ${xmlsieveparsing_SRCS} ) --target_link_libraries(xmlsieveparsing KF5::KSieveUi KF5::KSieve KF5::I18n) -- -+target_link_libraries(xmlsieveparsing -+ KF5::KSieveUi -+ KF5::SyntaxHighlighting -+ KF5::KSieve -+ KF5::I18n -+) --- -2.21.1 +diff --git a/src/ksieveui/CMakeLists.txt b/src/ksieveui/CMakeLists.txt +--- a/src/ksieveui/CMakeLists.txt ++++ b/src/ksieveui/CMakeLists.txt +@@ -255,6 +255,7 @@ target_link_libraries(KF5KSieveUi + KF5::KManageSieve + KF5::KSieve + KF5::PimCommon ++ KF5::SyntaxHighlighting + PRIVATE + KF5::Libkdepim + KF5::Archive +@@ -269,7 +270,6 @@ target_link_libraries(KF5KSieveUi + KF5::I18n + KF5::SonnetUi + Qt::PrintSupport +- KF5::SyntaxHighlighting + ) + set_target_properties(KF5KSieveUi PROPERTIES +-- +2.33.0 -- cgit v1.2.3 From 1499aa8773c1671aacd3d082d431cda67c2a22a1 Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Thu, 21 Jul 2022 12:38:08 +0200 Subject: gnu: kmplayer: Update to specific commit. * gnu/packages/kde-multimedia.scm (kmplayer): Update to specific commit. [source]: Switch to GIT-FETCH. * gnu/packages/patches/kmplayer-aarch64.patch: Remove file. * gnu/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch: Remove file. * gnu/local.mk: Remove patches. Signed-off-by: Marius Bakke --- gnu/local.mk | 2 - gnu/packages/kde-multimedia.scm | 106 +++++++++++---------- gnu/packages/patches/kmplayer-aarch64.patch | 57 ----------- .../kmplayer-upstream_Fix-build-with-Qt-5.9.patch | 42 -------- 4 files changed, 55 insertions(+), 152 deletions(-) delete mode 100644 gnu/packages/patches/kmplayer-aarch64.patch delete mode 100644 gnu/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index bd5889310f..1c4c102e11 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1373,8 +1373,6 @@ dist_patch_DATA = \ %D%/packages/patches/kismet-unbundle-boost.patch \ %D%/packages/patches/kmod-module-directory.patch \ %D%/packages/patches/kmscon-runtime-keymap-switch.patch \ - %D%/packages/patches/kmplayer-aarch64.patch \ - %D%/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch \ %D%/packages/patches/kobodeluxe-paths.patch \ %D%/packages/patches/kobodeluxe-enemies-pipe-decl.patch \ %D%/packages/patches/kobodeluxe-const-charp-conversion.patch \ diff --git a/gnu/packages/kde-multimedia.scm b/gnu/packages/kde-multimedia.scm index b9d3ea3bf4..6fe6db0681 100644 --- a/gnu/packages/kde-multimedia.scm +++ b/gnu/packages/kde-multimedia.scm @@ -605,55 +605,59 @@ (define-public kmix (list license:gpl2+ license:lgpl2.0+ license:fdl1.2+)))) (define-public kmplayer - (package - (name "kmplayer") - (version "0.12.0b") - (source - (origin - (method url-fetch) - (uri (string-append "mirror://kde/stable/kmplayer/0.12" - "/kmplayer-" version ".tar.bz2")) - (sha256 - (base32 "0wzdxym4fc83wvqyhcwid65yv59a2wvp1lq303cn124mpnlwx62y")) - (patches (search-patches - "kmplayer-aarch64.patch" - "kmplayer-upstream_Fix-build-with-Qt-5.9.patch")))) - (build-system qt-build-system) - (native-inputs - (list extra-cmake-modules pkg-config kdoctools)) - (inputs - (list kbookmarks - kconfig - kcoreaddons - kdelibs4support - ki18n - kinit - kio - kparts - kmediaplayer - kwidgetsaddons - libxcb ;; FIXME: why does cmake not find XEVIE and XPRINT? - oxygen-icons ; default icon set - phonon - qtbase-5 - cairo - qtsvg-5 - qtx11extras - xcb-util - xcb-util-cursor - xcb-util-errors - xcb-util-image - xcb-util-keysyms - xcb-util-wm)) - (arguments - (list #:configure-flags - #~(list (string-append - "-DCMAKE_CXX_FLAGS=-I" - #$(this-package-input "qtx11extras") - "/include/qt5")))) - (home-page "https://apps.kde.org/kmplayer/") - (synopsis "Media player using mplayer/phonon as backend") - (description "Kmplayer can play all the audio/video supported by + ;; The latest release was in 2016, and does not work with the newer + ;; KDE libraries. + (let ((commit "88e85308b71dc5e58cc655b5b9a13cd71b78233f") + (revision "1")) + (package + (name "kmplayer") + (version (git-version "0.12.0b" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://invent.kde.org/multimedia/kmplayer") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1pzk0js499diqabpwxjq6nnwpmj1ikpyyykzjbm844xcbm74cl19")))) + (build-system qt-build-system) + (native-inputs + (list extra-cmake-modules pkg-config kdoctools)) + (inputs + (list kbookmarks + kconfig + kcoreaddons + kdelibs4support + ki18n + kinit + kio + kparts + kmediaplayer + kwidgetsaddons + libxcb ;; FIXME: why does cmake not find XEVIE and XPRINT? + oxygen-icons ; default icon set + phonon + qtbase-5 + cairo + qtsvg-5 + qtx11extras + xcb-util + xcb-util-cursor + xcb-util-errors + xcb-util-image + xcb-util-keysyms + xcb-util-wm)) + (arguments + (list #:configure-flags + #~(list (string-append + "-DCMAKE_CXX_FLAGS=-I" + #$(this-package-input "qtx11extras") + "/include/qt5")))) + (home-page "https://apps.kde.org/kmplayer/") + (synopsis "Media player using mplayer/phonon as backend") + (description "Kmplayer can play all the audio/video supported by mplayer/phonon from a local file or URL and be embedded in Konqueror and KHTML. It also plays DVDs. @@ -667,8 +671,8 @@ (define-public kmplayer @item Broadcasting, http streaming, using ffserver/ffmpeg @item For TV sources, you need v4lctl (part of the xawtv package) @end itemize") - (license ;; GPL for programs, LGPL for libraries, FDL for documentation - (list license:gpl2+ license:lgpl2.0+ license:fdl1.2+)))) + (license ;; GPL for programs, LGPL for libraries, FDL for documentation + (list license:gpl2+ license:lgpl2.0+ license:fdl1.2+))))) (define-public kwave (package diff --git a/gnu/packages/patches/kmplayer-aarch64.patch b/gnu/packages/patches/kmplayer-aarch64.patch deleted file mode 100644 index 76f713be96..0000000000 --- a/gnu/packages/patches/kmplayer-aarch64.patch +++ /dev/null @@ -1,57 +0,0 @@ -Index: b/src/moz-sdk/prcpucfg.h -=================================================================== ---- a/src/moz-sdk/prcpucfg.h -+++ b/src/moz-sdk/prcpucfg.h -@@ -288,6 +288,52 @@ - #define PR_BYTES_PER_WORD_LOG2 3 - #define PR_BYTES_PER_DWORD_LOG2 3 - -+#elif defined(__aarch64__) -+ -+#define IS_LITTLE_ENDIAN 1 -+#undef IS_BIG_ENDIAN -+#define IS_64 -+ -+#define PR_BYTES_PER_BYTE 1 -+#define PR_BYTES_PER_SHORT 2 -+#define PR_BYTES_PER_INT 4 -+#define PR_BYTES_PER_INT64 8 -+#define PR_BYTES_PER_LONG 8 -+#define PR_BYTES_PER_FLOAT 4 -+#define PR_BYTES_PER_DOUBLE 8 -+#define PR_BYTES_PER_WORD 8 -+#define PR_BYTES_PER_DWORD 8 -+ -+#define PR_BITS_PER_BYTE 8 -+#define PR_BITS_PER_SHORT 16 -+#define PR_BITS_PER_INT 32 -+#define PR_BITS_PER_INT64 64 -+#define PR_BITS_PER_LONG 64 -+#define PR_BITS_PER_FLOAT 32 -+#define PR_BITS_PER_DOUBLE 64 -+#define PR_BITS_PER_WORD 64 -+ -+#define PR_BITS_PER_BYTE_LOG2 3 -+#define PR_BITS_PER_SHORT_LOG2 4 -+#define PR_BITS_PER_INT_LOG2 5 -+#define PR_BITS_PER_INT64_LOG2 6 -+#define PR_BITS_PER_LONG_LOG2 6 -+#define PR_BITS_PER_FLOAT_LOG2 5 -+#define PR_BITS_PER_DOUBLE_LOG2 6 -+#define PR_BITS_PER_WORD_LOG2 6 -+ -+#define PR_ALIGN_OF_SHORT 2 -+#define PR_ALIGN_OF_INT 4 -+#define PR_ALIGN_OF_LONG 8 -+#define PR_ALIGN_OF_INT64 8 -+#define PR_ALIGN_OF_FLOAT 4 -+#define PR_ALIGN_OF_DOUBLE 8 -+#define PR_ALIGN_OF_POINTER 8 -+#define PR_ALIGN_OF_WORD 8 -+ -+#define PR_BYTES_PER_WORD_LOG2 3 -+#define PR_BYTES_PER_DWORD_LOG2 3 -+ - #elif defined(__mc68000__) - - #undef IS_LITTLE_ENDIAN diff --git a/gnu/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch b/gnu/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch deleted file mode 100644 index 6a40dbe347..0000000000 --- a/gnu/packages/patches/kmplayer-upstream_Fix-build-with-Qt-5.9.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3def65075c09af4961cd399e8e78ed78cca72e65 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bauer -Date: Wed, 11 Oct 2017 22:16:02 +0200 -Subject: [PATCH] Fix build with Qt 5.9 - -Summary: -moc 5.9 errors out when building: -Error: Plugin Metadata file "" could not be opened: file to open is a directory - -Same issue and fix as https://phabricator.kde.org/D5392 for khtml. - -CCBUG: 377490 - -Test Plan: builds fine now with Qt 5.9.0rc and also earlier versions. - -Reviewers: vriezen, pino - -Reviewed By: pino - -Subscribers: pino - -Differential Revision: https://phabricator.kde.org/D5985 ---- - src/kmplayer_part.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/kmplayer_part.h b/src/kmplayer_part.h -index f90f85d..0fddbaa 100644 ---- a/src/kmplayer_part.h -+++ b/src/kmplayer_part.h -@@ -36,7 +36,7 @@ namespace KMPlayer { - - class KMPlayerFactory : public KPluginFactory { - Q_OBJECT -- Q_PLUGIN_METADATA(IID "org.kde.KPluginFactory" FILE "") -+ Q_PLUGIN_METADATA(IID "org.kde.KPluginFactory") - Q_INTERFACES(KPluginFactory) - public: - KMPlayerFactory(); --- -2.14.2 - -- cgit v1.2.3 From 92fdda5a6351dd5246b65165547d50d0b827cef3 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 5 Sep 2022 18:48:21 +0200 Subject: gnu: polkit: Look up polkit rules under /etc, and enable session tracking. This is a follow-up to commit 290ac5cd1e67d99b4d704603c1559dfb72f542c2. * gnu/packages/polkit.scm (polkit-mozjs)[source](snippet): Add substitutions. [source](patches): New field. [arguments]: Pass --sysconfdir and -Dsession_tracking in #:configure-flags. * gnu/packages/patches/polkit-disable-systemd.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. --- gnu/local.mk | 1 + gnu/packages/patches/polkit-disable-systemd.patch | 30 +++++++++++++++++++++++ gnu/packages/polkit.scm | 15 +++++++++--- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/polkit-disable-systemd.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index f050a37be6..a9ea72673f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1649,6 +1649,7 @@ dist_patch_DATA = \ %D%/packages/patches/plib-CVE-2011-4620.patch \ %D%/packages/patches/plib-CVE-2012-4552.patch \ %D%/packages/patches/plotutils-spline-test.patch \ + %D%/packages/patches/polkit-disable-systemd.patch \ %D%/packages/patches/portaudio-audacity-compat.patch \ %D%/packages/patches/portmidi-modular-build.patch \ %D%/packages/patches/postgresql-disable-resolve_symlinks.patch \ diff --git a/gnu/packages/patches/polkit-disable-systemd.patch b/gnu/packages/patches/polkit-disable-systemd.patch new file mode 100644 index 0000000000..551fdf7de8 --- /dev/null +++ b/gnu/packages/patches/polkit-disable-systemd.patch @@ -0,0 +1,30 @@ +Don't install systemd units unless using libsystemd session tracking. + +Submitted upstream: + + https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/134 + +diff --git a/data/meson.build b/data/meson.build +--- a/data/meson.build ++++ b/data/meson.build +@@ -26,7 +26,7 @@ if enable_pam + ) + endif + +-if enable_logind ++if session_tracking == 'libsystemd-login' + configure_file( + input: 'polkit.service.in', + output: '@BASENAME@', +diff --git a/meson.build b/meson.build +--- a/meson.build ++++ b/meson.build +@@ -199,7 +199,7 @@ if enable_logind + + # systemd unit / service files + systemd_systemdsystemunitdir = get_option('systemdsystemunitdir') +- if systemd_systemdsystemunitdir == '' ++ if systemd_systemdsystemunitdir == '' and session_tracking == 'libsystemd-login' + systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it') + # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used + systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index 18d299bbd1..a5c1b0dc98 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -63,6 +63,7 @@ (define-public polkit-mozjs (uri (string-append "https://www.freedesktop.org/software/polkit/releases/" name "-" version ".tar.gz")) + (patches (search-patches "polkit-disable-systemd.patch")) (sha256 (base32 "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx")) @@ -75,11 +76,17 @@ (define-public polkit-mozjs (substitute* "test/meson.build" (("subdir\\('polkitbackend'\\)") "")) - ;; Guix System's polkit - ;; service stores actions under /etc/polkit-1/actions. + ;; Look up actions and rules from /etc/polkit ... + (substitute* "src/polkitbackend/meson.build" + (("'-DPACKAGE_SYSCONF_DIR=.*,") + "'-DPACKAGE_SYSCONF_DIR=\"/etc\"',")) (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c" (("PACKAGE_DATA_DIR \"/polkit-1/actions\"") "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\"")) + ;; ... but install package files below the prefix. + (substitute* "meson.build" + (("pk_sysconfdir = get_option\\('sysconfdir'\\)") + "pk_sysconfdir = get_option('prefix') + '/etc'")) ;; Set the setuid helper's real location. (substitute* "src/polkitagent/polkitagentsession.c" (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"") @@ -104,7 +111,9 @@ (define-public polkit-mozjs docbook-xsl)) ;for man page generation (arguments (list #:configure-flags - #~'("-Dman=true" + #~'("--sysconfdir=/etc" + "-Dsession_tracking=libelogind" + "-Dman=true" "-Dtests=true" "-Djs_engine=mozjs" ;; Work around broken gobject-introspection detection when -- cgit v1.2.3 From 08473753a0ebafef22c0894d846e3b42fd6be2a2 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sat, 24 Sep 2022 22:15:58 +0300 Subject: gnu: firebird: Add support for riscv64-linux. * gnu/packages/databases.scm (firebird)[source]: Add patches. [arguments]: Add custom phase when building for riscv64-linux to force the bootstrap phase to occur. [native-inputs]: When building for riscv64-linux add autoconf, automake and libtool. * gnu/packages/patches/firebird-riscv64-support-pt1.patch, gnu/packages/patches/firebird-riscv64-support-pt2.patch: New files. * gnu/local.mk (dist_patch_DATA): Register them. --- gnu/local.mk | 2 + gnu/packages/databases.scm | 13 +++ .../patches/firebird-riscv64-support-pt1.patch | 42 ++++++++ .../patches/firebird-riscv64-support-pt2.patch | 108 +++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 gnu/packages/patches/firebird-riscv64-support-pt1.patch create mode 100644 gnu/packages/patches/firebird-riscv64-support-pt2.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 2764a138e8..297571c028 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1089,6 +1089,8 @@ dist_patch_DATA = \ %D%/packages/patches/fifo-map-fix-flags-for-gcc.patch \ %D%/packages/patches/fifo-map-remove-catch.hpp.patch \ %D%/packages/patches/findutils-localstatedir.patch \ + %D%/packages/patches/firebird-riscv64-support-pt1.patch \ + %D%/packages/patches/firebird-riscv64-support-pt2.patch \ %D%/packages/patches/flann-cmake-3.11.patch \ %D%/packages/patches/flatpak-fix-path.patch \ %D%/packages/patches/flatpak-unset-gdk-pixbuf-for-sandbox.patch \ diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index 48040a77c8..43c341c7a4 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -269,6 +269,8 @@ (define-public firebird "Firebird-" version "." revision ".tar.bz2")) (sha256 (base32 "0h033xj1kxwgvdv4ncm6kk0mqybvvn203gf88xcv3avys9hbnf4i")) + (patches (search-patches "firebird-riscv64-support-pt1.patch" + "firebird-riscv64-support-pt2.patch")) (modules '((guix build utils))) (snippet `(begin @@ -323,6 +325,13 @@ (define-public firebird (srfi srfi-26)) #:phases (modify-phases %standard-phases + ,@(if (target-riscv64?) + `((add-before 'bootstrap 'force-bootstrap + (lambda _ + (delete-file "configure") + ;; This file prevents automake from running. + (delete-file "autogen.sh")))) + '()) (add-after 'unpack 'use-system-boost (lambda _ (substitute* "src/include/firebird/Message.h" @@ -384,6 +393,10 @@ (define-public firebird (for-each rmdir (list "include/firebird/impl" "lib/firebird/plugins/udr"))))))))) + (native-inputs + (if (target-riscv64?) + (list autoconf automake libtool) + '())) (inputs (list boost editline diff --git a/gnu/packages/patches/firebird-riscv64-support-pt1.patch b/gnu/packages/patches/firebird-riscv64-support-pt1.patch new file mode 100644 index 0000000000..a46bfe208a --- /dev/null +++ b/gnu/packages/patches/firebird-riscv64-support-pt1.patch @@ -0,0 +1,42 @@ +https://salsa.debian.org/firebird-team/firebird3.0/-/raw/master/debian/patches/out/riscv64-prefix.patch + +Description: add builds/posix/prefix.linux_riscv64, missing upstream + It appears the commit adding RiscV64 support + (1e8e7858db84750a77006d307bf28e9686f9414e) misses the build prefix file + Here's one submitted by Manuel A. Fernandez Montecelo +Author: Manuel A. Fernandez Montecelo +Bug: http://tracker.firebirdsql.org/browse/CORE-5851 +Bug-Debian: https://bugs.debian.org/895257 +Author: Manuel A. Fernandez Montecelo + +--- /dev/null ++++ b/builds/posix/prefix.linux_riscv64 +@@ -0,0 +1,28 @@ ++# The contents of this file are subject to the Interbase Public ++# License Version 1.0 (the "License"); you may not use this file ++# except in compliance with the License. You may obtain a copy ++# of the License at http://www.Inprise.com/IPL.html ++# ++# Software distributed under the License is distributed on an ++# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express ++# or implied. See the License for the specific language governing ++# rights and limitations under the License. ++# ++# The Original Code was created by Inprise Corporation ++# and its predecessors. Portions created by Inprise Corporation are ++# Copyright (C) Inprise Corporation. ++# ++# All Rights Reserved. ++# Contributor(s): ______________________________________. ++# Start of file prefix.linux: $(VERSION) $(PLATFORM) ++# 14 Apr 2008 Alan Barclay alan AT escribe.co.uk ++# 2018, "Manuel A. Fernandez Montecelo" ++ ++ ++#LD=@CXX@ ++ ++#PROD_FLAGS=-ggdb -O3 -fno-omit-frame-pointer -DLINUX -pipe -MMD -fPIC ++#DEV_FLAGS=-ggdb -DLINUX -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Wall -Wno-switch ++ ++PROD_FLAGS=-O3 -DLINUX -DRISCV64 -pipe -p -MMD -fPIC -fsigned-char -fmessage-length=0 -std=gnu++03 -fno-delete-null-pointer-checks ++DEV_FLAGS=-ggdb -DLINUX -DRISCV64 -pipe -p -MMD -fPIC -Wall -fsigned-char -fmessage-length=0 -Wno-non-virtual-dtor diff --git a/gnu/packages/patches/firebird-riscv64-support-pt2.patch b/gnu/packages/patches/firebird-riscv64-support-pt2.patch new file mode 100644 index 0000000000..a6f93c1a50 --- /dev/null +++ b/gnu/packages/patches/firebird-riscv64-support-pt2.patch @@ -0,0 +1,108 @@ +https://salsa.debian.org/firebird-team/firebird3.0/-/raw/master/debian/patches/upstream/riscv64-support.patch + +1e8e7858db84750a77006d307bf28e9686f9414e Patch for CORE-5779: support for riscv64, also some code fixes related with prior ports + Minor corrections compared to the commit above due to whitespace/spelling + differences with 3.0 version +Bug-Debian: https://bugs.debian.org/895257 +Bug: http://tracker.firebirdsql.org/browse/CORE-5779 + +--- a/configure.ac ++++ b/configure.ac +@@ -251,6 +251,18 @@ dnl CPU_TYPE=ppc64 + libdir=/usr/lib64 + ;; + ++ riscv64*-*-linux*) ++ MAKEFILE_PREFIX=linux_riscv64 ++ INSTALL_PREFIX=linux ++ PLATFORM=LINUX ++ AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) ++ EDITLINE_FLG=Y ++ SHRLIB_EXT=so ++ STD_EDITLINE=true ++ STD_ICU=true ++ libdir=/usr/lib64 ++ ;; ++ + powerpc64le-*-linux*) + MAKEFILE_PREFIX=linux_powerpc64el + INSTALL_PREFIX=linux +--- a/src/common/classes/DbImplementation.cpp ++++ b/src/common/classes/DbImplementation.cpp +@@ -49,6 +49,7 @@ static const UCHAR CpuAlpha = 14; + static const UCHAR CpuArm64 = 15; + static const UCHAR CpuPowerPc64el = 16; + static const UCHAR CpuM68k = 17; ++static const UCHAR CpuRiscV64 = 18; + + static const UCHAR OsWindows = 0; + static const UCHAR OsLinux = 1; +@@ -89,7 +90,8 @@ const char* hardware[] = { + "Alpha", + "ARM64", + "PowerPC64el", +- "M68k" ++ "M68k", ++ "RiscV64" + }; + + const char* operatingSystem[] = { +@@ -116,22 +118,22 @@ const char* compiler[] = { + // This table lists pre-fb3 implementation codes + const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] = + { +-// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el +-/* Windows */ 50, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* Linux */ 60, 66, 65, 69, 86, 71, 72, 75, 76, 79, 78, 80, 81, 82, 83, 84, 85, +-/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, +-/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PPC64el M68k RiscV64 ++/* Windows */ 50, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* Linux */ 60, 66, 65, 69, 86, 71, 72, 75, 76, 79, 78, 80, 81, 82, 83, 84, 85, 87, 88, ++/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, ++/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + const UCHAR backEndianess[FB_NELEM(hardware)] = + { +-// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k +- 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1 ++// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PPC64el M68k RiscV64 ++ 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, + }; + + } // anonymous namespace +--- a/src/common/common.h ++++ b/src/common/common.h +@@ -135,6 +135,10 @@ + #define FB_CPU CpuArm64 + #endif /* ARM64 */ + ++#ifdef RISCV64 ++#define FB_CPU CpuRiscV64 ++#endif /* RISCV64 */ ++ + #ifdef sparc + #define FB_CPU CpuUltraSparc + #define RISC_ALIGNMENT +--- a/src/jrd/inf_pub.h ++++ b/src/jrd/inf_pub.h +@@ -247,7 +247,7 @@ enum info_db_implementations + isc_info_db_impl_linux_ppc64el = 85, + isc_info_db_impl_linux_ppc64 = 86, + isc_info_db_impl_linux_m68k = 87, +- ++ isc_info_db_impl_linux_riscv64 = 88, + + isc_info_db_impl_last_value // Leave this LAST! + }; -- cgit v1.2.3