Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] calibre: backport patch to fix ebook-viewer
@ 2019-11-06  8:39 voidlinux-github
  2019-11-06  8:56 ` [PR PATCH] [Updated] " voidlinux-github
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: voidlinux-github @ 2019-11-06  8:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

There is a new pull request by bra1nwave against master on the void-packages repository

https://github.com/bra1nwave/void-packages calibre
https://github.com/void-linux/void-packages/pull/16178

[WIP] calibre: backport patch to fix ebook-viewer
fixes https://github.com/void-linux/void-packages/issues/16146

A patch file from https://github.com/void-linux/void-packages/pull/16178.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-calibre-16178.patch --]
[-- Type: text/x-diff, Size: 7397 bytes --]

From a7bea1da1650ba8b7abb303698846283b7239725 Mon Sep 17 00:00:00 2001
From: bra1nwave <bra1nwave@protonmail.com>
Date: Tue, 5 Nov 2019 17:54:27 +0100
Subject: [PATCH] calibre: backport patch to fix ebook-viewer

---
 .../calibre/patches/calibre-qt-5.13.2.patch   | 166 ++++++++++++++++++
 srcpkgs/calibre/template                      |   2 +-
 2 files changed, 167 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/calibre/patches/calibre-qt-5.13.2.patch

diff --git a/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
new file mode 100644
index 00000000000..37206e30942
--- /dev/null
+++ b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
@@ -0,0 +1,166 @@
+From 2da7dd741fcebd3af89f77bc3fc4f52fe90940de Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:18:35 +0530
+Subject: [PATCH 1/4] Better error message on AJAX call failure
+
+(cherry picked from commit 8b7b9427bd71f48acf9dc766c976bb3f5ce5e357)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 7a8c453e5e..3a43984903 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -81,7 +81,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+                 rtext = xhr.responseText or ''
+             except:
+                 rtext = ''
+-            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{}] {}<br><br>{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200])
++            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{} ({})] {}<br><br>{}'), xhr.request_path, xhr.status, event, xhr.statusText, rtext[:200])
+ 
+     def progress_callback(ev):
+         if ev.lengthComputable:
+-- 
+2.23.0
+
+
+From fc63678168b5bbb8c48f1930535e1d2bfb90c13f Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:24:10 +0530
+Subject: [PATCH 2/4] Workaround for AJAX breakage on Qt 5.13.2
+
+Fixes #1850975 [qt5-webengine 5.13.2 breaks ebook-viewer](https://bugs.launchpad.net/calibre/+bug/1850975)
+
+(cherry picked from commit 6cccd18be81133ce57c885ecad9e012a16a3fe8b)
+---
+ src/pyj/ajax.pyj | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 3a43984903..5a038eaed5 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -102,6 +102,9 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
++        if xhr.status is ok_code and end_type is 'error':
++            # this apparently happens on Qt 5.13.2
++            end_type = 'load'
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+-- 
+2.23.0
+
+
+From 71223eb8a2ace02473ada1568f123d2bd5af3891 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:12:25 +0530
+Subject: [PATCH 3/4] Also reset headers/footers when resetting interface
+
+And work Qt 5.13.2 bug in more places
+
+(cherry picked from commit a179632356579a954eccf2d23112f061e8187a68)
+[Eli: disentangled from unrelated changes relying on commit 4e98478013c7e23a6333cb27cc09976667c77d1f]
+---
+ src/pyj/ajax.pyj        | 10 +++++++---
+ src/pyj/viewer-main.pyj |  5 ++++-
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 5a038eaed5..9337c6ad62 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -47,6 +47,12 @@ def absolute_path(path):
+     return path
+ 
+ 
++def workaround_qt_bug(xhr, end_type, ok_code=200):
++    if end_type is 'error' and xhr.status is ok_code:
++        end_type = 'load'
++    return end_type
++
++
+ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', query=None, timeout=None, ok_code=200, progress_totals_needed=True):
+     # Run an AJAX request. on_complete must be a function that accepts three
+     # arguments: end_type, xhr, ev where end_type is one of 'abort', 'error',
+@@ -102,9 +108,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
+-        if xhr.status is ok_code and end_type is 'error':
+-            # this apparently happens on Qt 5.13.2
+-            end_type = 'load'
++        end_type = workaround_qt_bug(xhr, end_type, ok_code)
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj
+index 87c9d3e9a5..d7047386d9 100644
+--- src/pyj/viewer-main.pyj
++++ src/pyj/viewer-main.pyj
+@@ -7,7 +7,7 @@ from elementmaker import E
+ from gettext import gettext as _, install
+ 
+ import initialize  # noqa: unused-import
+-from ajax import ajax
++from ajax import ajax, workaround_qt_bug
+ from book_list.globals import set_session_data
+ from book_list.library_data import library_data
+ from book_list.theme import get_color
+@@ -34,6 +34,7 @@ view = None
+ 
+ 
+ def file_received(name, file_data, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -62,6 +63,7 @@ def get_file(book, name, proceed):
+     xhr.send()
+ 
+ def mathjax_file_received(name, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -139,6 +141,7 @@ def show_error(title, msg, details):
+ 
+ def manifest_received(key, initial_cfi, initial_toc_node, pathtoebook, end_type, xhr, ev):
+     nonlocal book
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'load':
+         book = new_book(key, {})
+         data = xhr.response
+-- 
+2.23.0
+
+
+From 461f2095d3a91cd1e81e3a853b3fc985c7ecbcd6 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:16:17 +0530
+Subject: [PATCH 4/4] Only use Qt bug workaround in the viewer
+
+(cherry picked from commit c17411a39f9db0fe15455f6a0dd959ffe70087e5)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 9337c6ad62..ec5c78cd1c 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -48,7 +48,7 @@ def absolute_path(path):
+ 
+ 
+ def workaround_qt_bug(xhr, end_type, ok_code=200):
+-    if end_type is 'error' and xhr.status is ok_code:
++    if end_type is 'error' and xhr.status is ok_code and window.navigator.userAgent.indexOf('calibre-viewer') is 0:
+         end_type = 'load'
+     return end_type
+ 
+-- 
+2.23.0
+
diff --git a/srcpkgs/calibre/template b/srcpkgs/calibre/template
index d4ee7a5366a..6aeb58bc8c3 100644
--- a/srcpkgs/calibre/template
+++ b/srcpkgs/calibre/template
@@ -1,7 +1,7 @@
 # Template file for 'calibre'
 pkgname=calibre
 version=4.2.0
-revision=1
+revision=2
 build_style=python2-module
 pycompile_dirs="/usr/lib/calibre/"
 make_build_args="gui"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] calibre: backport patch to fix ebook-viewer
  2019-11-06  8:39 [PR PATCH] [WIP] calibre: backport patch to fix ebook-viewer voidlinux-github
@ 2019-11-06  8:56 ` voidlinux-github
  2019-11-06  8:57 ` voidlinux-github
  2019-11-07 16:27 ` [PR PATCH] [Merged]: " voidlinux-github
  2 siblings, 0 replies; 4+ messages in thread
From: voidlinux-github @ 2019-11-06  8:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

There is an updated pull request by bra1nwave against master on the void-packages repository

https://github.com/bra1nwave/void-packages calibre
https://github.com/void-linux/void-packages/pull/16178

[WIP] calibre: backport patch to fix ebook-viewer
fixes https://github.com/void-linux/void-packages/issues/16146

A patch file from https://github.com/void-linux/void-packages/pull/16178.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-calibre-16178.patch --]
[-- Type: text/x-diff, Size: 9640 bytes --]

From b4cb1a1866e1e85b705341436d4c111d5d702a4d Mon Sep 17 00:00:00 2001
From: bra1nwave <bra1nwave@protonmail.com>
Date: Tue, 5 Nov 2019 17:54:27 +0100
Subject: [PATCH 1/2] calibre: rebuild against qt5-5.13.2 - backport patch to
 fix ebook-viewer

---
 .../calibre/patches/calibre-qt-5.13.2.patch   | 166 ++++++++++++++++++
 srcpkgs/calibre/template                      |  11 +-
 2 files changed, 174 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/calibre/patches/calibre-qt-5.13.2.patch

diff --git a/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
new file mode 100644
index 00000000000..37206e30942
--- /dev/null
+++ b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
@@ -0,0 +1,166 @@
+From 2da7dd741fcebd3af89f77bc3fc4f52fe90940de Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:18:35 +0530
+Subject: [PATCH 1/4] Better error message on AJAX call failure
+
+(cherry picked from commit 8b7b9427bd71f48acf9dc766c976bb3f5ce5e357)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 7a8c453e5e..3a43984903 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -81,7 +81,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+                 rtext = xhr.responseText or ''
+             except:
+                 rtext = ''
+-            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{}] {}<br><br>{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200])
++            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{} ({})] {}<br><br>{}'), xhr.request_path, xhr.status, event, xhr.statusText, rtext[:200])
+ 
+     def progress_callback(ev):
+         if ev.lengthComputable:
+-- 
+2.23.0
+
+
+From fc63678168b5bbb8c48f1930535e1d2bfb90c13f Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:24:10 +0530
+Subject: [PATCH 2/4] Workaround for AJAX breakage on Qt 5.13.2
+
+Fixes #1850975 [qt5-webengine 5.13.2 breaks ebook-viewer](https://bugs.launchpad.net/calibre/+bug/1850975)
+
+(cherry picked from commit 6cccd18be81133ce57c885ecad9e012a16a3fe8b)
+---
+ src/pyj/ajax.pyj | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 3a43984903..5a038eaed5 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -102,6 +102,9 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
++        if xhr.status is ok_code and end_type is 'error':
++            # this apparently happens on Qt 5.13.2
++            end_type = 'load'
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+-- 
+2.23.0
+
+
+From 71223eb8a2ace02473ada1568f123d2bd5af3891 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:12:25 +0530
+Subject: [PATCH 3/4] Also reset headers/footers when resetting interface
+
+And work Qt 5.13.2 bug in more places
+
+(cherry picked from commit a179632356579a954eccf2d23112f061e8187a68)
+[Eli: disentangled from unrelated changes relying on commit 4e98478013c7e23a6333cb27cc09976667c77d1f]
+---
+ src/pyj/ajax.pyj        | 10 +++++++---
+ src/pyj/viewer-main.pyj |  5 ++++-
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 5a038eaed5..9337c6ad62 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -47,6 +47,12 @@ def absolute_path(path):
+     return path
+ 
+ 
++def workaround_qt_bug(xhr, end_type, ok_code=200):
++    if end_type is 'error' and xhr.status is ok_code:
++        end_type = 'load'
++    return end_type
++
++
+ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', query=None, timeout=None, ok_code=200, progress_totals_needed=True):
+     # Run an AJAX request. on_complete must be a function that accepts three
+     # arguments: end_type, xhr, ev where end_type is one of 'abort', 'error',
+@@ -102,9 +108,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
+-        if xhr.status is ok_code and end_type is 'error':
+-            # this apparently happens on Qt 5.13.2
+-            end_type = 'load'
++        end_type = workaround_qt_bug(xhr, end_type, ok_code)
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj
+index 87c9d3e9a5..d7047386d9 100644
+--- src/pyj/viewer-main.pyj
++++ src/pyj/viewer-main.pyj
+@@ -7,7 +7,7 @@ from elementmaker import E
+ from gettext import gettext as _, install
+ 
+ import initialize  # noqa: unused-import
+-from ajax import ajax
++from ajax import ajax, workaround_qt_bug
+ from book_list.globals import set_session_data
+ from book_list.library_data import library_data
+ from book_list.theme import get_color
+@@ -34,6 +34,7 @@ view = None
+ 
+ 
+ def file_received(name, file_data, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -62,6 +63,7 @@ def get_file(book, name, proceed):
+     xhr.send()
+ 
+ def mathjax_file_received(name, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -139,6 +141,7 @@ def show_error(title, msg, details):
+ 
+ def manifest_received(key, initial_cfi, initial_toc_node, pathtoebook, end_type, xhr, ev):
+     nonlocal book
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'load':
+         book = new_book(key, {})
+         data = xhr.response
+-- 
+2.23.0
+
+
+From 461f2095d3a91cd1e81e3a853b3fc985c7ecbcd6 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:16:17 +0530
+Subject: [PATCH 4/4] Only use Qt bug workaround in the viewer
+
+(cherry picked from commit c17411a39f9db0fe15455f6a0dd959ffe70087e5)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 9337c6ad62..ec5c78cd1c 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -48,7 +48,7 @@ def absolute_path(path):
+ 
+ 
+ def workaround_qt_bug(xhr, end_type, ok_code=200):
+-    if end_type is 'error' and xhr.status is ok_code:
++    if end_type is 'error' and xhr.status is ok_code and window.navigator.userAgent.indexOf('calibre-viewer') is 0:
+         end_type = 'load'
+     return end_type
+ 
+-- 
+2.23.0
+
diff --git a/srcpkgs/calibre/template b/srcpkgs/calibre/template
index d4ee7a5366a..fde94a5b1fd 100644
--- a/srcpkgs/calibre/template
+++ b/srcpkgs/calibre/template
@@ -1,14 +1,13 @@
 # Template file for 'calibre'
 pkgname=calibre
 version=4.2.0
-revision=1
+revision=2
 build_style=python2-module
 pycompile_dirs="/usr/lib/calibre/"
-make_build_args="gui"
 hostmakedepends="pkg-config python-BeautifulSoup4 python-Pillow python-PyQt5-svg
  python-PyQt5-webengine python-apsw python-css-parser python-dateutil
  python-devel python-html5-parser python-msgpack python-regex qt5-qmake
- xdg-utils"
+ xdg-utils rapydscript-ng"
 makedepends="glib-devel libchmlib-devel libinput-devel libmagick-devel libmtp-devel
  libpodofo-devel libwmf-devel libxkbcommon-devel python-PyQt5-devel
  qt5-devel sqlite-devel tslib-devel hunspell-devel"
@@ -38,6 +37,12 @@ do_configure() {
 		-e "s/^Name=calibre/Name=Calibre/g"
 }
 
+do_build() {
+	python2 setup.py build
+	python2 setup.py gui
+	python2 setup.py rapydscript
+}
+
 do_install() {
 	vmkdir usr/share/zsh/site-functions
 

From 3c61536f35f6004c56a07f6c3a7c8700a4fc11cb Mon Sep 17 00:00:00 2001
From: bra1nwave <bra1nwave@protonmail.com>
Date: Wed, 6 Nov 2019 09:56:01 +0100
Subject: [PATCH 2/2] New package: rapydscript-ng-0.7.20

---
 srcpkgs/rapydscript-ng/template | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/rapydscript-ng/template

diff --git a/srcpkgs/rapydscript-ng/template b/srcpkgs/rapydscript-ng/template
new file mode 100644
index 00000000000..c33766613bf
--- /dev/null
+++ b/srcpkgs/rapydscript-ng/template
@@ -0,0 +1,28 @@
+# Template file for 'rapydscript-ng'
+pkgname=rapydscript-ng
+version=0.7.20
+revision=1
+archs=noarch
+hostmakedepends="nodejs"
+depends="nodejs"
+short_desc="Transpiler for a Python like language to JavaScript"
+maintainer="bra1nwave <bra1nwave@protonmail.com>"
+license="BSD-2-Clause"
+homepage="https://github.com/kovidgoyal/rapydscript-ng"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+changelog="https://raw.githubusercontent.com/kovidgoyal/rapydscript-ng/master/CHANGELOG.md"
+checksum=11540118ce88f33b974884f08d1627938bc57669f0eefc1392bf9fc9d411ae03
+
+do_build() {
+	npm install --no-optional
+	bin/rapydscript self --complete
+	rm -rf release/ && mv dev/ release/
+}
+
+do_install() {
+	vmkdir usr/bin
+	vmkdir usr/lib/node_modules/rapydscript-ng/
+	vcopy "*" usr/lib/node_modules/rapydscript-ng/
+	ln -s /usr/lib/node_modules/rapydscript-ng/bin/rapydscript "${DESTDIR}"/usr/bin/rapydscript
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] calibre: backport patch to fix ebook-viewer
  2019-11-06  8:39 [PR PATCH] [WIP] calibre: backport patch to fix ebook-viewer voidlinux-github
  2019-11-06  8:56 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-11-06  8:57 ` voidlinux-github
  2019-11-07 16:27 ` [PR PATCH] [Merged]: " voidlinux-github
  2 siblings, 0 replies; 4+ messages in thread
From: voidlinux-github @ 2019-11-06  8:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

There is an updated pull request by bra1nwave against master on the void-packages repository

https://github.com/bra1nwave/void-packages calibre
https://github.com/void-linux/void-packages/pull/16178

[WIP] calibre: backport patch to fix ebook-viewer
fixes https://github.com/void-linux/void-packages/issues/16146

A patch file from https://github.com/void-linux/void-packages/pull/16178.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-calibre-16178.patch --]
[-- Type: text/x-diff, Size: 9640 bytes --]

From b4cb1a1866e1e85b705341436d4c111d5d702a4d Mon Sep 17 00:00:00 2001
From: bra1nwave <bra1nwave@protonmail.com>
Date: Tue, 5 Nov 2019 17:54:27 +0100
Subject: [PATCH 1/2] calibre: rebuild against qt5-5.13.2 - backport patch to
 fix ebook-viewer

---
 .../calibre/patches/calibre-qt-5.13.2.patch   | 166 ++++++++++++++++++
 srcpkgs/calibre/template                      |  11 +-
 2 files changed, 174 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/calibre/patches/calibre-qt-5.13.2.patch

diff --git a/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
new file mode 100644
index 00000000000..37206e30942
--- /dev/null
+++ b/srcpkgs/calibre/patches/calibre-qt-5.13.2.patch
@@ -0,0 +1,166 @@
+From 2da7dd741fcebd3af89f77bc3fc4f52fe90940de Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:18:35 +0530
+Subject: [PATCH 1/4] Better error message on AJAX call failure
+
+(cherry picked from commit 8b7b9427bd71f48acf9dc766c976bb3f5ce5e357)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 7a8c453e5e..3a43984903 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -81,7 +81,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+                 rtext = xhr.responseText or ''
+             except:
+                 rtext = ''
+-            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{}] {}<br><br>{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200])
++            xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{} ({})] {}<br><br>{}'), xhr.request_path, xhr.status, event, xhr.statusText, rtext[:200])
+ 
+     def progress_callback(ev):
+         if ev.lengthComputable:
+-- 
+2.23.0
+
+
+From fc63678168b5bbb8c48f1930535e1d2bfb90c13f Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sat, 2 Nov 2019 07:24:10 +0530
+Subject: [PATCH 2/4] Workaround for AJAX breakage on Qt 5.13.2
+
+Fixes #1850975 [qt5-webengine 5.13.2 breaks ebook-viewer](https://bugs.launchpad.net/calibre/+bug/1850975)
+
+(cherry picked from commit 6cccd18be81133ce57c885ecad9e012a16a3fe8b)
+---
+ src/pyj/ajax.pyj | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 3a43984903..5a038eaed5 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -102,6 +102,9 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
++        if xhr.status is ok_code and end_type is 'error':
++            # this apparently happens on Qt 5.13.2
++            end_type = 'load'
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+-- 
+2.23.0
+
+
+From 71223eb8a2ace02473ada1568f123d2bd5af3891 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:12:25 +0530
+Subject: [PATCH 3/4] Also reset headers/footers when resetting interface
+
+And work Qt 5.13.2 bug in more places
+
+(cherry picked from commit a179632356579a954eccf2d23112f061e8187a68)
+[Eli: disentangled from unrelated changes relying on commit 4e98478013c7e23a6333cb27cc09976667c77d1f]
+---
+ src/pyj/ajax.pyj        | 10 +++++++---
+ src/pyj/viewer-main.pyj |  5 ++++-
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 5a038eaed5..9337c6ad62 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -47,6 +47,12 @@ def absolute_path(path):
+     return path
+ 
+ 
++def workaround_qt_bug(xhr, end_type, ok_code=200):
++    if end_type is 'error' and xhr.status is ok_code:
++        end_type = 'load'
++    return end_type
++
++
+ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', query=None, timeout=None, ok_code=200, progress_totals_needed=True):
+     # Run an AJAX request. on_complete must be a function that accepts three
+     # arguments: end_type, xhr, ev where end_type is one of 'abort', 'error',
+@@ -102,9 +108,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
+         is_network_error = ev if end_type is 'error' else False
+         if xhr.status is not ok_code and end_type is 'load':
+             end_type = 'error'
+-        if xhr.status is ok_code and end_type is 'error':
+-            # this apparently happens on Qt 5.13.2
+-            end_type = 'load'
++        end_type = workaround_qt_bug(xhr, end_type, ok_code)
+         if end_type is not 'load':
+             set_error(end_type, is_network_error)
+         on_complete(end_type, xhr, ev)
+diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj
+index 87c9d3e9a5..d7047386d9 100644
+--- src/pyj/viewer-main.pyj
++++ src/pyj/viewer-main.pyj
+@@ -7,7 +7,7 @@ from elementmaker import E
+ from gettext import gettext as _, install
+ 
+ import initialize  # noqa: unused-import
+-from ajax import ajax
++from ajax import ajax, workaround_qt_bug
+ from book_list.globals import set_session_data
+ from book_list.library_data import library_data
+ from book_list.theme import get_color
+@@ -34,6 +34,7 @@ view = None
+ 
+ 
+ def file_received(name, file_data, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -62,6 +63,7 @@ def get_file(book, name, proceed):
+     xhr.send()
+ 
+ def mathjax_file_received(name, proceed, end_type, xhr, ev):
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'abort':
+         return
+     if end_type is not 'load':
+@@ -139,6 +141,7 @@ def show_error(title, msg, details):
+ 
+ def manifest_received(key, initial_cfi, initial_toc_node, pathtoebook, end_type, xhr, ev):
+     nonlocal book
++    end_type = workaround_qt_bug(xhr, end_type)
+     if end_type is 'load':
+         book = new_book(key, {})
+         data = xhr.response
+-- 
+2.23.0
+
+
+From 461f2095d3a91cd1e81e3a853b3fc985c7ecbcd6 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Sun, 3 Nov 2019 07:16:17 +0530
+Subject: [PATCH 4/4] Only use Qt bug workaround in the viewer
+
+(cherry picked from commit c17411a39f9db0fe15455f6a0dd959ffe70087e5)
+---
+ src/pyj/ajax.pyj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj
+index 9337c6ad62..ec5c78cd1c 100644
+--- src/pyj/ajax.pyj
++++ src/pyj/ajax.pyj
+@@ -48,7 +48,7 @@ def absolute_path(path):
+ 
+ 
+ def workaround_qt_bug(xhr, end_type, ok_code=200):
+-    if end_type is 'error' and xhr.status is ok_code:
++    if end_type is 'error' and xhr.status is ok_code and window.navigator.userAgent.indexOf('calibre-viewer') is 0:
+         end_type = 'load'
+     return end_type
+ 
+-- 
+2.23.0
+
diff --git a/srcpkgs/calibre/template b/srcpkgs/calibre/template
index d4ee7a5366a..fde94a5b1fd 100644
--- a/srcpkgs/calibre/template
+++ b/srcpkgs/calibre/template
@@ -1,14 +1,13 @@
 # Template file for 'calibre'
 pkgname=calibre
 version=4.2.0
-revision=1
+revision=2
 build_style=python2-module
 pycompile_dirs="/usr/lib/calibre/"
-make_build_args="gui"
 hostmakedepends="pkg-config python-BeautifulSoup4 python-Pillow python-PyQt5-svg
  python-PyQt5-webengine python-apsw python-css-parser python-dateutil
  python-devel python-html5-parser python-msgpack python-regex qt5-qmake
- xdg-utils"
+ xdg-utils rapydscript-ng"
 makedepends="glib-devel libchmlib-devel libinput-devel libmagick-devel libmtp-devel
  libpodofo-devel libwmf-devel libxkbcommon-devel python-PyQt5-devel
  qt5-devel sqlite-devel tslib-devel hunspell-devel"
@@ -38,6 +37,12 @@ do_configure() {
 		-e "s/^Name=calibre/Name=Calibre/g"
 }
 
+do_build() {
+	python2 setup.py build
+	python2 setup.py gui
+	python2 setup.py rapydscript
+}
+
 do_install() {
 	vmkdir usr/share/zsh/site-functions
 

From 1355664e629d31078f21958e64248aa160f11fc1 Mon Sep 17 00:00:00 2001
From: bra1nwave <bra1nwave@protonmail.com>
Date: Wed, 6 Nov 2019 09:56:01 +0100
Subject: [PATCH 2/2] New package: rapydscript-ng-0.7.20

---
 srcpkgs/rapydscript-ng/template | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/rapydscript-ng/template

diff --git a/srcpkgs/rapydscript-ng/template b/srcpkgs/rapydscript-ng/template
new file mode 100644
index 00000000000..d5f04b75877
--- /dev/null
+++ b/srcpkgs/rapydscript-ng/template
@@ -0,0 +1,28 @@
+# Template file for 'rapydscript-ng'
+pkgname=rapydscript-ng
+version=0.7.20
+revision=1
+archs=noarch
+hostmakedepends="nodejs"
+depends="nodejs"
+short_desc="Transpiler for a Python like language to JavaScript"
+maintainer="bra1nwave <bra1nwave@protonmail.com>"
+license="BSD-2-Clause"
+homepage="https://github.com/kovidgoyal/rapydscript-ng"
+changelog="https://raw.githubusercontent.com/kovidgoyal/rapydscript-ng/master/CHANGELOG.md"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=11540118ce88f33b974884f08d1627938bc57669f0eefc1392bf9fc9d411ae03
+
+do_build() {
+	npm install --no-optional
+	bin/rapydscript self --complete
+	rm -rf release/ && mv dev/ release/
+}
+
+do_install() {
+	vmkdir usr/bin
+	vmkdir usr/lib/node_modules/rapydscript-ng/
+	vcopy "*" usr/lib/node_modules/rapydscript-ng/
+	ln -s /usr/lib/node_modules/rapydscript-ng/bin/rapydscript "${DESTDIR}"/usr/bin/rapydscript
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Merged]: calibre: backport patch to fix ebook-viewer
  2019-11-06  8:39 [PR PATCH] [WIP] calibre: backport patch to fix ebook-viewer voidlinux-github
  2019-11-06  8:56 ` [PR PATCH] [Updated] " voidlinux-github
  2019-11-06  8:57 ` voidlinux-github
@ 2019-11-07 16:27 ` voidlinux-github
  2 siblings, 0 replies; 4+ messages in thread
From: voidlinux-github @ 2019-11-07 16:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

There's a merged pull request on the void-packages repository

calibre: backport patch to fix ebook-viewer
https://github.com/void-linux/void-packages/pull/16178

Description:
fixes https://github.com/void-linux/void-packages/issues/16146

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-07 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  8:39 [PR PATCH] [WIP] calibre: backport patch to fix ebook-viewer voidlinux-github
2019-11-06  8:56 ` [PR PATCH] [Updated] " voidlinux-github
2019-11-06  8:57 ` voidlinux-github
2019-11-07 16:27 ` [PR PATCH] [Merged]: " voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).