Toggle diff (321 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index d07aaeb90b..784d961487 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1007,6 +1007,7 @@ dist_patch_DATA = \
%D%/packages/patches/fontconfig-hurd-path-max.patch \
%D%/packages/patches/fpc-reproducibility.patch \
%D%/packages/patches/fplll-std-fenv.patch \
+ %D%/packages/patches/fractal-switch-from-failure-to-anyhow.patch \
%D%/packages/patches/freedink-engine-fix-sdl-hints.patch \
%D%/packages/patches/freebayes-devendor-deps.patch \
%D%/packages/patches/freeimage-unbundle.patch \
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index af8722a02e..8b494891c6 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -12138,7 +12138,6 @@ editing environment for translation issues within the GNU gettext/GNOME desktop
world.")
(license license:gpl3+)))
-
(define-public ocrfeeder
(package
(name "ocrfeeder")
@@ -12201,3 +12200,145 @@ world.")
(description "OCRFeeder is a complete Optical Character Recognition and
Document Analysis and Recognition program.")
(license license:gpl3+)))
+
+(define-public fractal
+ (package
+ (name "fractal")
+ (version "4.4.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.gnome.org/GNOME/fractal")
+ (commit version)))
+ (file-name (string-append "fractal-" version))
+ (sha256
+ (base32
+ "1v2aw41gfmixki6g7j7mcav7i7qkn17k7zndvvfv08rgsrvma8qd"))
+ (patches
+ (search-patches
+ "fractal-switch-from-failure-to-anyhow.patch"))))
+ (build-system cargo-build-system)
+ (arguments
+ `(#:imported-modules
+ (,@%cargo-build-system-modules
+ ,@%meson-build-system-modules)
+ #:modules
+ ((guix build cargo-build-system)
+ (guix build utils)
+ ((guix build meson-build-system) #:prefix meson:))
+ #:cargo-inputs
+ (("rust-anyhow" ,rust-anyhow-1)
+ ("rust-comrak" ,rust-comrak-0.7)
+ ("rust-directories" ,rust-directories-2)
+ ("rust-dirs" ,rust-dirs-2)
+ ("rust-either" ,rust-either-1)
+ ("rust-fragile" ,rust-fragile-1)
+ ("rust-gdk" ,rust-gdk-0.12)
+ ("rust-gdk-pixbuf" ,rust-gdk-pixbuf-0.8)
+ ("rust-gettext" ,rust-gettext-rs-0.4)
+ ("rust-glib" ,rust-glib-0.9)
+ ("rust-gio" ,rust-gio-0.8)
+ ("rust-gspell" ,rust-gspell-0.4)
+ ("rust-gstreamer" ,rust-gstreamer-0.15)
+ ("rust-gstreamer-pbutils" ,rust-gstreamer-pbutils-0.15)
+ ("rust-gstreamer-player" ,rust-gstreamer-player-0.15)
+ ("rust-gtk" ,rust-gtk-0.8)
+ ("rust-html2pango" ,rust-html2pango-0.3)
+ ("rust-letter-avatar" ,rust-letter-avatar-for-fractal)
+ ("rust-libhandy" ,rust-libhandy-0.5)
+ ("rust-loggerv" ,rust-loggerv-0.7)
+ ("rust-md5" ,rust-md5-0.7)
+ ("rust-mdl" ,rust-mdl-1)
+ ("rust-rand" ,rust-rand-0.7)
+ ("rust-regex" ,rust-regex-1)
+ ("rust-reqwest" ,rust-reqwest-0.10)
+ ("rust-ruma-identifiers" ,rust-ruma-identifiers-0.17)
+ ("rust-serde" ,rust-serde-1)
+ ("rust-secret-service" ,rust-secret-service-1)
+ ("rust-sourceview4" ,rust-sourceview4-for-fractal))
+ #:install-source? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-cargo
+ (lambda* (#:key vendor-dir #:allow-other-keys)
+ (substitute* "fractal-gtk/Cargo.toml"
+ (("git = .*") "")
+ ;; rust-gettext-rs
+ (("branch = \"no-gettext\"") "version = \"0.4.0\"")
+ ;; rust-sourceview4
+ (("rev = \"fa8819fa7ecbe56f44d951656d3825f468915754\"")
+ "version = \"0.2.0\"")
+ ;; rust-either
+ (("rev = \"60c99bc0723491e2dfd42bbe9b485c5f9323e96b\"")
+ "version = \"1.6.0\"")
+ (("\"serde_untagged\"") "\"serde\""))
+ (substitute*
+ (map
+ (lambda (dir) (string-append dir "/Cargo.toml"))
+ (find-files vendor-dir "system-deps.*" #:directories? #t))
+ (("0.0.10") ,(package-version rust-version-compare-0.0)))
+ (substitute* "meson.build"
+ (("'Cargo.lock',") ""))
+ (substitute* "scripts/cargo.sh"
+ (("export CARGO_HOME=.*" all)
+ (string-append all "\
+mkdir -p $CARGO_HOME
+cp $1/.cargo/config $CARGO_HOME
+")))
+
+ #t))
+ (add-after 'unpack 'skip-gtk-update-icon-cache
+ (lambda _
+ (substitute* "scripts/meson_post_install.py"
+ (("gtk-update-icon-cache") (which "true")))
+ #t))
+ (add-after 'configure 'configure-harder
+ (lambda* (#:key vendor-dir inputs #:allow-other-keys)
+ (for-each
+ (lambda (d)
+ (copy-recursively
+ (string-append (assoc-ref inputs "rust-sourceview4") "/" d)
+ (string-append vendor-dir "/rust-" d "-0.2.0")))
+ '("sourceview4" "sourceview4-sys"))
+ (delete-file-recursively
+ (car (find-files vendor-dir "fractal.*" #:directories? #t)))
+ #t))
+ (add-after 'patch-cargo-checksums 'really-configure
+ (lambda args
+ (apply (assoc-ref meson:%standard-phases 'configure)
+ #:build-type "release"
+ #:configure-flags '()
+ args)))
+ (replace 'build (assoc-ref meson:%standard-phases 'build))
+ (replace 'check
+ (lambda args
+ ((assoc-ref meson:%standard-phases 'check)
+ #:test-target "test"
+ #:parallel-tests? #t
+ #:tests? #t)))
+ (replace 'install (assoc-ref meson:%standard-phases 'install)))))
+ (native-inputs
+ `(("glib:bin" ,glib "bin")
+ ("gettext" ,gettext-minimal)
+ ("meson" ,meson-for-build)
+ ("ninja" ,ninja)
+ ("pkg-config" ,pkg-config)))
+ (inputs
+ `(("atk" ,atk)
+ ("cairo" ,cairo)
+ ("glib" ,glib)
+ ("gspell" ,gspell)
+ ("gst-editing-services" ,gst-editing-services)
+ ("gstreamer" ,gstreamer)
+ ("gst-plugins-base" ,gst-plugins-base)
+ ("gst-plugins-bad" ,gst-plugins-bad)
+ ("gtk+" ,gtk+)
+ ("gtksourceview" ,gtksourceview)
+ ("libhandy" ,libhandy-0.0)
+ ("openssl" ,openssl)))
+ (synopsis "Matrix messaging app for GNOME")
+ (description "Fractal is a Matrix messaging app for GNOME written in Rust.
+Its interface is optimized for collaboration in large groups, such as free
+software projects.")
+ (home-page "https://wiki.gnome.org/Apps/Fractal")
+ (license license:gpl3)))
diff --git a/gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch b/gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch
new file mode 100644
index 0000000000..6b830ecf94
--- /dev/null
+++ b/gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch
@@ -0,0 +1,143 @@
+From e4ca9dc5c0f4401f350338e4cd9b0734db9371bf Mon Sep 17 00:00:00 2001
+From: Yuki Okushi <huyuumi.dev@gmail.com>
+Date: Thu, 13 Aug 2020 14:41:50 +0900
+Subject: [PATCH] Switch from failure to anyhow
+
+---
+ Cargo.lock | 8 +++++++-
+ fractal-gtk/Cargo.toml | 2 +-
+ fractal-gtk/src/appop/attach.rs | 2 +-
+ fractal-gtk/src/cache/mod.rs | 2 +-
+ fractal-gtk/src/cache/state.rs | 7 +++----
+ fractal-gtk/src/util.rs | 8 ++++----
+ 6 files changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/Cargo.lock b/Cargo.lock
+index c0b5e5e2..f26d9787 100644
+--- a/Cargo.lock
++++ b/Cargo.lock
+@@ -88,6 +88,12 @@ dependencies = [
+ "winapi 0.3.9",
+ ]
+
++[[package]]
++name = "anyhow"
++version = "1.0.32"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
++
+ [[package]]
+ name = "arrayref"
+ version = "0.3.6"
+@@ -580,6 +586,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+ name = "fractal-gtk"
+ version = "4.4.0"
+ dependencies = [
++ "anyhow",
+ "cairo-rs",
+ "chrono",
+ "clap",
+@@ -587,7 +594,6 @@ dependencies = [
+ "directories",
+ "dirs",
+ "either 1.5.99",
+- "failure",
+ "fractal-matrix-api",
+ "fragile",
+ "gdk",
+diff --git a/fractal-gtk/Cargo.toml b/fractal-gtk/Cargo.toml
+index 960f64b5..e1c6a33d 100644
+--- a/fractal-gtk/Cargo.toml
++++ b/fractal-gtk/Cargo.toml
+@@ -6,11 +6,11 @@ workspace = "../"
+ edition = "2018"
+
+ [dependencies]
++anyhow = "1.0.32"
+ clap = "2.33.0"
+ comrak = "0.7.0"
+ directories = "2.0.2"
+ dirs = "2.0.2"
+-failure = "0.1.6"
+ fragile = "1.0.0"
+ gspell = "0.4.0"
+ gdk = "0.12.1"
+diff --git a/fractal-gtk/src/appop/attach.rs b/fractal-gtk/src/appop/attach.rs
+index 3f0813aa..3b5bff4c 100644
+--- a/fractal-gtk/src/appop/attach.rs
++++ b/fractal-gtk/src/appop/attach.rs
+@@ -6,7 +6,7 @@ use std::io::prelude::*;
+ use std::path::PathBuf;
+ use std::sync::{Arc, Mutex};
+
+-use failure::Error;
++use anyhow::Error;
+
+ use gtk::prelude::*;
+
+diff --git a/fractal-gtk/src/cache/mod.rs b/fractal-gtk/src/cache/mod.rs
+index 76942866..8943eac6 100644
+--- a/fractal-gtk/src/cache/mod.rs
++++ b/fractal-gtk/src/cache/mod.rs
+@@ -12,7 +12,7 @@ use std::thread;
+
+ use crate::types::Room;
+ use crate::types::RoomList;
+-use failure::Error;
++use anyhow::Error;
+ use fractal_api::identifiers::{DeviceId, UserId};
+ use std::collections::HashMap;
+ use std::hash::Hash;
+diff --git a/fractal-gtk/src/cache/state.rs b/fractal-gtk/src/cache/state.rs
+index 7cb5372a..0e62c59b 100644
+--- a/fractal-gtk/src/cache/state.rs
++++ b/fractal-gtk/src/cache/state.rs
+@@ -4,8 +4,7 @@ use mdl::Model;
+ use mdl::Store;
+ use serde::{Deserialize, Serialize};
+
+-use failure::err_msg;
+-use failure::Error;
++use anyhow::{anyhow, Error};
+
+ use std::cell::RefCell;
+ use std::fs::remove_dir_all;
+@@ -127,8 +126,8 @@ impl FCache {
+ guard.take();
+
+ let fname = cache_dir_path(None, "cache.mdl")
+- .or_else(|_| Err(err_msg("Can't remove cache file")))?;
+- remove_dir_all(fname).or_else(|_| Err(err_msg("Can't remove cache file")))
++ .or_else(|_| Err(anyhow!("Can't remove cache file")))?;
++ remove_dir_all(fname).or_else(|_| Err(anyhow!("Can't remove cache file")))
+ }
+
+ #[allow(dead_code)]
+diff --git a/fractal-gtk/src/util.rs b/fractal-gtk/src/util.rs
+index 764a8e8e..b2feb12c 100644
+--- a/fractal-gtk/src/util.rs
++++ b/fractal-gtk/src/util.rs
+@@ -1,6 +1,6 @@
+ use crate::globals::CACHE_PATH;
+-use failure::format_err;
+-use failure::Error as FailError;
++use anyhow::anyhow;
++use anyhow::Error as AnyhowError;
+ use gdk::prelude::*;
+ use gdk_pixbuf::Pixbuf;
+ use gio::{Settings, SettingsExt, SettingsSchemaSource};
+@@ -21,9 +21,9 @@ pub fn cache_dir_path(dir: Option<&str>, name: &str) -> Result<PathBuf, IoError>
+ Ok(path.join(name))
+ }
+
+-pub fn get_pixbuf_data(pb: &Pixbuf) -> Result<Vec<u8>, FailError> {
++pub fn get_pixbuf_data(pb: &Pixbuf) -> Result<Vec<u8>, AnyhowError> {
+ let image = cairo::ImageSurface::create(cairo::Format::ARgb32, pb.get_width(), pb.get_height())
+- .or_else(|_| Err(format_err!("Cairo Error")))?;
++ .or_else(|_| Err(anyhow!("Cairo Error")))?;
+
+ let g = cairo::Context::new(&image);
+ g.set_source_pixbuf(pb, 0.0, 0.0);
+--
+2.30.1
+
--
2.30.2