Compare commits

...

No commits in common. "c8s" and "c9s" have entirely different histories.
c8s ... c9s

7 changed files with 470 additions and 78 deletions

48
.gitignore vendored
View File

@ -1 +1,49 @@
/sushi-0.0.4.tar.xz
/sushi-0.0.5.tar.xz
/sushi-0.1.90.tar.xz
/sushi-0.1.92.tar.xz
/sushi-0.2.0.tar.xz
/sushi-0.2.1.tar.xz
/sushi-0.3.0.tar.xz
/sushi-0.3.91.tar.xz
/sushi-0.3.92.tar.xz
/sushi-0.4.0.tar.xz
/sushi-0.4.1.tar.xz
/sushi-0.5.1.tar.xz
/sushi-0.5.2.tar.xz
/sushi-0.5.4.tar.xz
/sushi-0.5.5.tar.xz
/sushi-3.5.90.tar.xz
/sushi-3.5.92.tar.xz
/sushi-3.6.0.tar.xz
/sushi-3.6.1.tar.xz
/sushi-3.7.3.tar.xz
/sushi-3.7.4.tar.xz
/sushi-3.7.5.tar.xz
/sushi-3.7.91.tar.xz
/sushi-3.8.0.tar.xz
/sushi-3.8.1.tar.xz
/sushi-3.11.90.tar.xz
/sushi-3.12.0.tar.xz
/sushi-3.15.90.tar.xz
/sushi-3.16.0.tar.xz
/sushi-3.17.4.tar.xz
/sushi-3.18.0.tar.xz
/sushi-3.19.90.tar.xz
/sushi-3.20.0.tar.xz
/sushi-3.21.91.tar.xz
/sushi-3.23.91.tar.xz
/sushi-3.24.0.tar.xz
/sushi-3.28.0.tar.xz
/sushi-3.28.1.tar.xz
/sushi-3.28.2.tar.xz
/sushi-3.28.3.tar.xz
/sushi-3.30.0.tar.xz
/sushi-3.31.2.tar.xz
/sushi-3.32.0.tar.xz
/sushi-3.33.3.tar.xz
/sushi-3.33.4.tar.xz
/sushi-3.33.90.tar.xz
/sushi-3.34.0.tar.xz
/sushi-3.38.0.tar.xz
/sushi-3.38.1.tar.xz

View File

@ -0,0 +1,244 @@
From 93adbd744a52c32879637375885b1df4feff21f4 Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Wed, 14 Jul 2021 16:19:19 +0200
Subject: [PATCH] Drop libmusicbrainz dependency
We are only using libmusicbrainz for finding the ASIN code for a
given artist and album.
With this changes we use libsoup to query the musicbrainz API
directly, allowing for the dependency on libmusicbrainz5 to be
dropped.
See https://musicbrainz.org/doc/MusicBrainz_API
and https://musicbrainz.org/doc/ASIN
---
flatpak/org.gnome.NautilusPreviewer.json | 11 ---
meson.build | 1 -
src/libsushi/meson.build | 1 -
src/libsushi/sushi-utils.c | 110 -----------------------
src/viewers/audio.js | 30 +++++--
5 files changed, 23 insertions(+), 130 deletions(-)
diff --git a/flatpak/org.gnome.NautilusPreviewer.json b/flatpak/org.gnome.NautilusPreviewer.json
index 22502f7..4291a26 100644
--- a/flatpak/org.gnome.NautilusPreviewer.json
+++ b/flatpak/org.gnome.NautilusPreviewer.json
@@ -86,17 +86,6 @@
}
]
},
- {
- "name": "libmusicbrainz",
- "buildsystem": "cmake",
- "sources": [
- {
- "type": "archive",
- "url": "https://github.com/metabrainz/libmusicbrainz/releases/download/release-5.1.0/libmusicbrainz-5.1.0.tar.gz",
- "sha256": "6749259e89bbb273f3f5ad7acdffb7c47a2cf8fcaeab4c4695484cef5f4c6b46"
- }
- ]
- },
{
"name": "gtksourceview",
"config-opts": [
diff --git a/meson.build b/meson.build
index 21a292a..c712397 100644
--- a/meson.build
+++ b/meson.build
@@ -21,7 +21,6 @@ gtk_x11_dep = dependency('gtk+-x11-3.0', required: get_option('X11'))
gtk_wayland_dep = dependency('gtk+-wayland-3.0', version: '>= 3.21.5', required: get_option('wayland'))
gtksourceview_dep = dependency('gtksourceview-4', version: '>=4.0.3')
harfbuzz_dep = dependency('harfbuzz', version: '>=0.9.9')
-musicbrainz_dep = dependency('libmusicbrainz5')
webkit_dep = dependency('webkit2gtk-4.0')
bindir = join_paths(get_option('prefix'), get_option('bindir'))
diff --git a/src/libsushi/meson.build b/src/libsushi/meson.build
index fe2e874..8740954 100644
--- a/src/libsushi/meson.build
+++ b/src/libsushi/meson.build
@@ -39,7 +39,6 @@ libsushi_deps = [
gstreamer_video_dep,
gtk_dep,
harfbuzz_dep,
- musicbrainz_dep
]
libsushi_sources = [
diff --git a/src/libsushi/sushi-utils.c b/src/libsushi/sushi-utils.c
index 5096fe4..d39b3f4 100644
--- a/src/libsushi/sushi-utils.c
+++ b/src/libsushi/sushi-utils.c
@@ -27,7 +27,6 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
-#include <musicbrainz5/mb5_c.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
@@ -400,112 +399,3 @@ sushi_pixbuf_from_gst_sample (GstSample *sample,
return pixbuf;
}
-
-typedef struct {
- gchar *artist;
- gchar *album;
-} FetchUriTaskData;
-
-static void
-fetch_uri_task_data_free (gpointer user_data)
-{
- FetchUriTaskData *data = user_data;
-
- g_free (data->artist);
- g_free (data->album);
-
- g_slice_free (FetchUriTaskData, data);
-}
-
-static FetchUriTaskData *
-fetch_uri_task_data_new (const gchar *artist,
- const gchar *album)
-{
- FetchUriTaskData *retval;
-
- retval = g_slice_new0 (FetchUriTaskData);
- retval->artist = g_strdup (artist);
- retval->album = g_strdup (album);
-
- return retval;
-}
-
-static void
-fetch_uri_job (GTask *task,
- gpointer source_object,
- gpointer task_data,
- GCancellable *cancellable)
-{
- FetchUriTaskData *data = task_data;
- g_autofree gchar *retval = NULL;
- g_auto(GStrv) param_names = NULL, param_values = NULL;
- Mb5Metadata metadata;
- Mb5Query query;
- Mb5Release release;
- Mb5ReleaseList release_list;
-
- query = mb5_query_new ("sushi", NULL, 0);
-
- param_names = g_new (gchar*, 3);
- param_values = g_new (gchar*, 3);
-
- param_names[0] = g_strdup ("query");
- param_values[0] = g_strdup_printf ("artist:\"%s\" AND release:\"%s\"", data->artist, data->album);
-
- param_names[1] = g_strdup ("limit");
- param_values[1] = g_strdup ("10");
-
- param_names[2] = NULL;
- param_values[2] = NULL;
-
- metadata = mb5_query_query (query, "release", "", "",
- 2, param_names, param_values);
-
- mb5_query_delete (query);
-
- if (metadata) {
- release_list = mb5_metadata_get_releaselist (metadata);
- int i;
- int release_list_length = mb5_release_list_size (release_list);
- for (i = 0; i < release_list_length; i++) {
- gchar asin[255];
-
- release = mb5_release_list_item (release_list, i);
- mb5_release_get_asin (release, asin, 255);
-
- if (asin != NULL && asin[0] != '\0') {
- retval = g_strdup (asin);
- break;
- }
- }
- }
- mb5_metadata_delete (metadata);
-
- if (retval == NULL)
- g_task_return_new_error (task,
- G_IO_ERROR,
- G_IO_ERROR_NOT_FOUND, "%s",
- "Error getting the ASIN from MusicBrainz");
- else
- g_task_return_pointer (task, g_steal_pointer (&retval), g_free);
-}
-
-gchar *
-sushi_get_asin_for_track_finish (GAsyncResult *result,
- GError **error)
-{
- return g_task_propagate_pointer (G_TASK (result), error);
-}
-
-void
-sushi_get_asin_for_track (const gchar *artist,
- const gchar *album,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_autoptr(GTask) task = g_task_new (NULL, NULL, callback, user_data);
- FetchUriTaskData *data = fetch_uri_task_data_new (artist, album);
-
- g_task_set_task_data (task, data, fetch_uri_task_data_free);
- g_task_run_in_thread (task, fetch_uri_job);
-}
diff --git a/src/viewers/audio.js b/src/viewers/audio.js
index f210165..dba474e 100644
--- a/src/viewers/audio.js
+++ b/src/viewers/audio.js
@@ -47,6 +47,7 @@ function _formatTimeString(timeVal) {
}
const AMAZON_IMAGE_FORMAT = "http://images.amazon.com/images/P/%s.01.LZZZZZZZ.jpg";
+const MUSIC_BRAINZ_ASIN_FORMAT = "https://musicbrainz.org/ws/2/release/?query=release:\"%s\"AND artist:\"%s\"&limit=1&fmt=json&inc=asin";
const fetchCoverArt = function(_tagList, _callback) {
function _fetchFromTags() {
let coverSample = null;
@@ -191,13 +192,28 @@ const fetchCoverArt = function(_tagList, _callback) {
let artist = _tagList.get_string('artist')[1];
let album = _tagList.get_string('album')[1];
- Sushi.get_asin_for_track(artist, album, (o, res) => {
- let asin
- try {
- asin = Sushi.get_asin_for_track_finish(res);
- } catch (e) {
- done(e, null);
- return;
+ let uri = MUSIC_BRAINZ_ASIN_FORMAT.format(album, artist);
+ let session = new Soup.SessionAsync();
+
+ let request;
+ try {
+ request = Soup.Message.new('GET', uri);
+ request.request_headers.append('User-Agent', 'gnome-sushi');
+ } catch (e) {
+ done(e, null);
+ return;
+ }
+
+ session.queue_message(request, (r, res) => {
+ let asin = null;
+ if (request.status_code == Soup.Status.OK) {
+ try {
+ let json_response = JSON.parse(request.response_body.data);
+ asin = json_response['release'][0]['asin'].toString();
+ } catch (e) {
+ done(e, null);
+ return;
+ }
}
_fetchFromCache(asin, (err, cover) => {
--
2.31.1

35
enable-sandbox.patch Normal file
View File

@ -0,0 +1,35 @@
From 87e5db488d509fb3f88fdd5aed3d58afcc930814 Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Mon, 4 Apr 2022 10:06:07 +0200
Subject: [PATCH] Enable webkit sandbox on GApplication.startup
This needs to be done only once, so this is a good place for it.
In commit 3fcb670f7385 we enabled it using Gjs "static" syntax, which
is not available in Gjs versions older than 1.71.1.
https://gitlab.gnome.org/GNOME/gjs/-/blob/70552bee79f644836a5e9f9a54845791b1ef7a94/NEWS#L67
Let's enable it on GApplication.startup for GNOME 41.
Fixes #81
---
src/ui/application.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/ui/application.js b/src/ui/application.js
index 53fe2b4..f84a9bc 100644
--- a/src/ui/application.js
+++ b/src/ui/application.js
@@ -85,6 +85,9 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
vfunc_startup() {
super.vfunc_startup();
+ // Enable web process sandbox
+ WebKit2.WebContext.get_default().set_sandbox_enabled(true);
+
this._defineStyleAndThemes();
}
--
GitLab

View File

@ -1,6 +1,6 @@
--- !Policy
product_versions:
- rhel-8
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}

View File

@ -1,67 +1,69 @@
diff --git a/configure.ac b/configure.ac
index 98ce0c2..9d69588 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,8 +71,7 @@ PKG_CHECK_MODULES(SUSHI,
libmusicbrainz5
evince-document-3.0
evince-view-3.0
- gtksourceview-3.0
- webkit2gtk-4.0)
+ gtksourceview-3.0)
diff --git a/meson.build b/meson.build
index be1ccd4..116f145 100644
--- a/meson.build
+++ b/meson.build
@@ -21,7 +21,7 @@ gtk_x11_dep = dependency('gtk+-x11-3.0', required: get_option('X11'))
gtk_wayland_dep = dependency('gtk+-wayland-3.0', version: '>= 3.21.5', required: get_option('wayland'))
gtksourceview_dep = dependency('gtksourceview-4', version: '>=4.0.3')
harfbuzz_dep = dependency('harfbuzz', version: '>=0.9.9')
-webkit_dep = dependency('webkit2gtk-4.0')
+webkit_dep = dependency('webkit2gtk-4.0', required: false)
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
diff --git a/src/js/viewers/html.js b/src/js/viewers/html.js
index 5135e2b..c7d078f 100644
--- a/src/js/viewers/html.js
+++ b/src/js/viewers/html.js
@@ -28,12 +28,22 @@ const Gtk = imports.gi.Gtk;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const Sushi = imports.gi.Sushi;
-const WebKit = imports.gi.WebKit2;
bindir = join_paths(get_option('prefix'), get_option('bindir'))
datadir = join_paths(get_option('prefix'), get_option('datadir'))
diff --git a/src/ui/main.js b/src/ui/main.js
index b0cb7de..2aa0b71 100644
--- a/src/ui/main.js
+++ b/src/ui/main.js
@@ -39,7 +39,6 @@ pkg.require({
Pango: '1.0',
Soup: '2.4',
Sushi: '1.0',
- WebKit2: '4.0',
});
const MimeHandler = imports.ui.mimeHandler;
const Utils = imports.ui.utils;
const {Gio, GLib} = imports.gi;
diff --git a/src/viewers/html.js b/src/viewers/html.js
index 3de4455..28d34de 100644
--- a/src/viewers/html.js
+++ b/src/viewers/html.js
@@ -23,11 +23,22 @@
*
*/
-const HTMLRenderer = new Lang.Class({
+var WebKit;
-const {Gtk, GLib, GObject, Sushi, WebKit2} = imports.gi;
+const {Gtk, GLib, GObject, Sushi} = imports.gi;
+
+var WebKit2;
+try {
+ imports.gi.versions.WebKit2 = '4.0';
+ WebKit = imports.gi.WebKit2;
+ WebKit2 = imports.gi.WebKit2;
+} catch(e) {
+}
+
+function _isAvailable() {
+ return WebKit !== undefined;
+ return WebKit2 !== undefined;
+}
+
+var HTMLRenderer = _isAvailable() ? new Lang.Class({
Name: 'HTMLRenderer',
_init : function(args) {
@@ -89,13 +99,15 @@ const HTMLRenderer = new Lang.Class({
const Renderer = imports.ui.renderer;
return this._toolbarActor;
-var Klass = GObject.registerClass({
+var Klass = _isAvailable() ? GObject.registerClass({
Implements: [Renderer.Renderer],
Properties: {
fullscreen: GObject.ParamSpec.boolean('fullscreen', '', '',
@@ -63,8 +74,10 @@ var Klass = GObject.registerClass({
get moveOnClick() {
return false;
}
-});
+}) : undefined;
-let handler = new MimeHandler.MimeHandler();
-let renderer = new HTMLRenderer();
+if (_isAvailable()) {
+ let handler = new MimeHandler.MimeHandler();
+ let renderer = new HTMLRenderer();
-let mimeTypes = [
-var mimeTypes = [
- 'text/html'
-];
+ let mimeTypes = [
+var mimeTypes = [];
+if (_isAvailable())
+ mimeTypes = [
+ 'text/html'
+ ];
-handler.registerMimeTypes(mimeTypes, renderer);
+ handler.registerMimeTypes(mimeTypes, renderer);
+}

View File

@ -1 +1 @@
SHA512 (sushi-3.28.3.tar.xz) = 2b285285d65e47f5d7b559426783a323ee79748def88448f2920fb612e330a8a9ff7908cda53d7974372d98d179e0efbbbd3d0acd545fad20f678114f53ab446
SHA512 (sushi-3.38.1.tar.xz) = b999e6892314875725bd4029163ae58813b46f0e5c59e58b62fc4491d611b48fc39459f6c5b5e1a7d75d792cfeb66681f4d3a7057e8cde8f5c3364a2312e0be7

View File

@ -1,29 +1,30 @@
%global url_ver %%(echo %{version}|cut -d. -f1,2)
Name: sushi
Version: 3.28.3
Version: 3.38.1
Release: 3%{?dist}
Summary: A quick previewer for Nautilus
License: GPLv2+ with exceptions
URL: https://wiki.gnome.org/ThreePointOne/Features/FilePreviewing
Source0: https://download.gnome.org/sources/%{name}/3.28/%{name}-%{version}.tar.xz
URL: https://gitlab.gnome.org/GNOME/sushi
Source0: https://download.gnome.org/sources/%{name}/%{url_ver}/%{name}-%{version}.tar.xz
Patch0: drop-libmusicbrainz-dep.patch
# https://gitlab.gnome.org/GNOME/sushi/-/merge_requests/30
Patch1: enable-sandbox.patch
# https://gitlab.gnome.org/GNOME/sushi/-/merge_requests/53
Patch0: optional-webkitgtk.patch
Patch2: optional-webkitgtk.patch
# Build deps for optional-webkitgtk.patch, which modifies configure.ac
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: intltool
BuildRequires: gettext
BuildRequires: gjs-devel
BuildRequires: pkgconfig(clutter-gst-3.0)
BuildRequires: pkgconfig(clutter-gtk-1.0)
BuildRequires: pkgconfig(clutter-x11-1.0)
BuildRequires: meson
BuildRequires: pkgconfig(evince-document-3.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gstreamer-audio-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtksourceview-3.0)
BuildRequires: pkgconfig(libmusicbrainz5)
BuildRequires: pkgconfig(gtksourceview-4)
BuildRequires: pkgconfig(webkit2gtk-4.0)
Obsoletes: sushi-devel < 0.5.1
@ -36,38 +37,100 @@ file manager.
%prep
%autosetup -p1
# autoreconf is for optional-webkitgtk.patch
autoreconf -fi
%build
%configure --disable-static
make %{?_smp_mflags}
%meson
%meson_build
%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%meson_install
%find_lang %{name}
%files -f %{name}.lang
%doc README AUTHORS NEWS TODO
%license COPYING
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/dbus-1/services/*
%{_bindir}/sushi
%{_libexecdir}/*
%{_libdir}/sushi/
%{_datadir}/dbus-1/services/org.gnome.NautilusPreviewer.service
%{_datadir}/metainfo/org.gnome.NautilusPreviewer.appdata.xml
%{_datadir}/sushi/
%changelog
* Mon Apr 15 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.28.3-3
- Use autosetup so WebKitGTK patch actually gets applied, and rewrite the patch to work
Resolves: RHEL-26699
* Wed Mar 06 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.38.1-3
- Allow running without WebKitGTK installed
Resolves: RHEL-26698
* Thu Mar 07 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.28.3-2
- Allow running with WebKitGTK uninstalled
Resolves: RHEL-26699
* Mon May 23 2022 Michael Catanzaro <mcatanzaro@redhat.com> - 3.38.1-2
- Enable web process sandbox
Resolves: #2070670
* Tue Aug 24 2021 Kalev Lember <klember@redhat.com> - 3.38.1-1
- Update to 3.38.1
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.38.0-7
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Jul 15 2021 Felipe Borges <feborges@redhat.com> - 3.38.0-6
- Drop libmusicbrainz5 dependency
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 3.38.0-5
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.38.0-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.38.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 01 2020 David King <amigadave@amigadave.com> - 3.38.0-2
- Remove unused clutter dependencies
* Thu Oct 22 2020 Felipe Borges <feborges@redhat.com> - 3.38.0-1
- Update to 3.38.0
* Wed Sep 23 2020 Felipe Borges <feborges@redhat.com> - 3.34.0-4
- Fix crash
- Related: #1880752
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.34.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.34.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Sep 10 2019 Kalev Lember <klember@redhat.com> - 3.34.0-1
- Update to 3.34.0
* Tue Aug 20 2019 Kalev Lember <klember@redhat.com> - 3.33.90-1
- Update to 3.33.90
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.33.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Jul 19 2019 Kalev Lember <klember@redhat.com> - 3.33.4-1
- Update to 3.33.4
* Mon Jun 17 2019 Kalev Lember <klember@redhat.com> - 3.33.3-1
- Update to 3.33.3
* Mon Mar 11 2019 Kalev Lember <klember@redhat.com> - 3.32.0-1
- Update to 3.32.0
* Thu Jan 31 2019 Kalev Lember <klember@redhat.com> - 3.31.2-1
- Update to 3.31.2
- Switch to the meson build system
* Thu Sep 06 2018 Kalev Lember <klember@redhat.com> - 3.30.0-1
- Update to 3.30.0
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Apr 23 2018 Kalev Lember <klember@redhat.com> - 3.28.3-1
- Update to 3.28.3