[arch-commits] Commit in calibre/trunk (PKGBUILD podofo_0.9.6.patch)
Eli Schwartz
eschwartz at archlinux.org
Sun Sep 9 02:10:44 UTC 2018
Date: Sunday, September 9, 2018 @ 02:10:43
Author: eschwartz
Revision: 378842
upgpkg: calibre 3.31.0-3
update podofo patch with upstream version
websocket test works for me, re-enabling for now
Modified:
calibre/trunk/PKGBUILD
calibre/trunk/podofo_0.9.6.patch
--------------------+
PKGBUILD | 7 -
podofo_0.9.6.patch | 198 +++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 194 insertions(+), 11 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2018-09-09 02:09:52 UTC (rev 378841)
+++ PKGBUILD 2018-09-09 02:10:43 UTC (rev 378842)
@@ -8,7 +8,7 @@
pkgname=calibre
pkgver=3.31.0
-pkgrel=2
+pkgrel=3
pkgdesc="Ebook management application"
arch=('x86_64')
url="https://calibre-ebook.com/"
@@ -31,12 +31,13 @@
podofo_0.9.6.patch)
sha256sums=('3c2713a89a186e20d45ea42f2ed6be509fecce880ce6e233e63e6f3a415fe1f5'
'SKIP'
- '6e5c856b164724ed54bf84b1e592a6aea52d0472874be706fd8b61e88ad73151')
+ '4243e18653348aed438e28af7268c40ea6047e4b1d2b091faeaa1351572f7873')
validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) <kovid at kovidgoyal.net>
prepare(){
cd "${pkgname}-${pkgver}"
+ # https://bugs.launchpad.net/bugs/1791430
patch -Np1 -i ${srcdir}/podofo_0.9.6.patch
# Remove unneeded files
@@ -64,8 +65,6 @@
# without xvfb-run this fails with much "Control socket failed to recv(), resetting"
# ERROR: test_websocket_perf (calibre.srv.tests.web_sockets.WebSocketTest)
- # websocket test fails currently.
- rm src/calibre/srv/tests/web_sockets.py
LANG='en_US.UTF-8' xvfb-run python2 setup.py test
}
Modified: podofo_0.9.6.patch
===================================================================
--- podofo_0.9.6.patch 2018-09-09 02:09:52 UTC (rev 378841)
+++ podofo_0.9.6.patch 2018-09-09 02:10:43 UTC (rev 378842)
@@ -1,22 +1,206 @@
+From dc130d90cdd257f37037a4699b8be1550efc2b6b Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid at kovidgoyal.net>
+Date: Sat, 8 Sep 2018 20:51:58 +0530
+Subject: [PATCH 1/3] Fix #1791430 [Podofo ABI breakage in
+ 0.9.6](https://bugs.launchpad.net/calibre/+bug/1791430)
+
+---
+ src/calibre/utils/podofo/doc.cpp | 31 +++++++++++++++++++------------
+ 1 file changed, 19 insertions(+), 12 deletions(-)
+
diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp
-index b33647336c..3d25ac993f 100644
+index b33647336c..58572a688e 100644
--- a/src/calibre/utils/podofo/doc.cpp
+++ b/src/calibre/utils/podofo/doc.cpp
-@@ -39,7 +39,7 @@ PDFDoc_load(PDFDoc *self, PyObject *args) {
+@@ -39,7 +39,11 @@ PDFDoc_load(PDFDoc *self, PyObject *args) {
if (PyArg_ParseTuple(args, "s#", &buffer, &size)) {
try {
-- self->doc->Load(buffer, (long)size);
-+ self->doc->LoadFromBuffer(buffer, (long)size);
++#if PODOFO_VERSION <= 0x000905
+ self->doc->Load(buffer, (long)size);
++#else
++ self->doc->LoadBuffer(buffer, (long)size);
++#endif
} catch(const PdfError & err) {
podofo_set_exception(err);
return NULL;
-@@ -56,7 +56,7 @@ PDFDoc_open(PDFDoc *self, PyObject *args) {
+@@ -56,7 +60,11 @@ PDFDoc_open(PDFDoc *self, PyObject *args) {
if (PyArg_ParseTuple(args, "s", &fname)) {
try {
-- self->doc->Load(fname);
-+ self->doc->LoadFromBuffer(fname, (long)strlen(fname));
++#if PODOFO_VERSION <= 0x000905
+ self->doc->Load(fname);
++#else
++ self->doc->LoadFromFile(fname);
++#endif
} catch(const PdfError & err) {
podofo_set_exception(err);
return NULL;
+@@ -88,7 +96,7 @@ PDFDoc_save(PDFDoc *self, PyObject *args) {
+ static PyObject *
+ PDFDoc_write(PDFDoc *self, PyObject *args) {
+ PyObject *ans;
+-
++
+ try {
+ PdfRefCountedBuffer buffer(1*1024*1024);
+ PdfOutputDevice out(&buffer);
+@@ -305,7 +313,7 @@ PDFDoc_set_xmp_metadata(PDFDoc *self, PyObject *args) {
+ long len = 0;
+ PoDoFo::PdfObject *metadata = NULL, *catalog = NULL;
+ PoDoFo::PdfStream *str = NULL;
+- TVecFilters compressed(1);
++ TVecFilters compressed(1);
+ compressed[0] = ePdfFilter_FlateDecode;
+
+ if (!PyArg_ParseTuple(args, "s#", &raw, &len)) return NULL;
+@@ -428,7 +436,7 @@ PDFDoc_setter(PDFDoc *self, PyObject *val, int field) {
+ PdfString *s = NULL;
+
+ if (self->doc->GetEncrypted()) s = podofo_convert_pystring_single_byte(val);
+- else s = podofo_convert_pystring(val);
++ else s = podofo_convert_pystring(val);
+ if (s == NULL) return -1;
+
+
+@@ -503,35 +511,35 @@ PDFDoc_producer_setter(PDFDoc *self, PyObject *val, void *closure) {
+ }
+
+ static PyGetSetDef PDFDoc_getsetters[] = {
+- {(char *)"title",
++ {(char *)"title",
+ (getter)PDFDoc_title_getter, (setter)PDFDoc_title_setter,
+ (char *)"Document title",
+ NULL},
+- {(char *)"author",
++ {(char *)"author",
+ (getter)PDFDoc_author_getter, (setter)PDFDoc_author_setter,
+ (char *)"Document author",
+ NULL},
+- {(char *)"subject",
++ {(char *)"subject",
+ (getter)PDFDoc_subject_getter, (setter)PDFDoc_subject_setter,
+ (char *)"Document subject",
+ NULL},
+- {(char *)"keywords",
++ {(char *)"keywords",
+ (getter)PDFDoc_keywords_getter, (setter)PDFDoc_keywords_setter,
+ (char *)"Document keywords",
+ NULL},
+- {(char *)"creator",
++ {(char *)"creator",
+ (getter)PDFDoc_creator_getter, (setter)PDFDoc_creator_setter,
+ (char *)"Document creator",
+ NULL},
+- {(char *)"producer",
++ {(char *)"producer",
+ (getter)PDFDoc_producer_getter, (setter)PDFDoc_producer_setter,
+ (char *)"Document producer",
+ NULL},
+- {(char *)"pages",
++ {(char *)"pages",
+ (getter)PDFDoc_pages_getter, NULL,
+ (char *)"Number of pages in document (read only)",
+ NULL},
+- {(char *)"version",
++ {(char *)"version",
+ (getter)PDFDoc_version_getter, NULL,
+ (char *)"The PDF version (read only)",
+ NULL},
+@@ -633,4 +641,3 @@ PyTypeObject pdf::PDFDocType = {
+
+ };
+ // }}}
+-
+--
+2.18.0
+
+
+From 8b03d1d61a76a4804ccd68a10e14d04df260b1b1 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid at kovidgoyal.net>
+Date: Sat, 8 Sep 2018 21:32:25 +0530
+Subject: [PATCH 2/3] Proper fix for podofo 0.9.6
+
+---
+ src/calibre/utils/podofo/doc.cpp | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp
+index 58572a688e..4a7a615bb2 100644
+--- a/src/calibre/utils/podofo/doc.cpp
++++ b/src/calibre/utils/podofo/doc.cpp
+@@ -42,7 +42,7 @@ PDFDoc_load(PDFDoc *self, PyObject *args) {
+ #if PODOFO_VERSION <= 0x000905
+ self->doc->Load(buffer, (long)size);
+ #else
+- self->doc->LoadBuffer(buffer, (long)size);
++ self->doc->LoadFromBuffer(buffer, (long)size);
+ #endif
+ } catch(const PdfError & err) {
+ podofo_set_exception(err);
+@@ -60,11 +60,7 @@ PDFDoc_open(PDFDoc *self, PyObject *args) {
+
+ if (PyArg_ParseTuple(args, "s", &fname)) {
+ try {
+-#if PODOFO_VERSION <= 0x000905
+ self->doc->Load(fname);
+-#else
+- self->doc->LoadFromFile(fname);
+-#endif
+ } catch(const PdfError & err) {
+ podofo_set_exception(err);
+ return NULL;
+--
+2.18.0
+
+
+From 6b14a1204abd8e491184ac7c84a86160136b90c7 Mon Sep 17 00:00:00 2001
+From: Kovid Goyal <kovid at kovidgoyal.net>
+Date: Sat, 8 Sep 2018 22:05:20 +0530
+Subject: [PATCH 3/3] Test podofo read from file
+
+---
+ src/calibre/utils/podofo/__init__.py | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/src/calibre/utils/podofo/__init__.py b/src/calibre/utils/podofo/__init__.py
+index a617c02964..b30d5079d1 100644
+--- a/src/calibre/utils/podofo/__init__.py
++++ b/src/calibre/utils/podofo/__init__.py
+@@ -164,6 +164,7 @@ def test_save_to(src, dest):
+
+
+ def test_podofo():
++ import tempfile
+ from io import BytesIO
+ from calibre.ebooks.metadata.book.base import Metadata
+ from calibre.ebooks.metadata.xmp import metadata_to_xmp_packet
+@@ -179,12 +180,19 @@ def test_podofo():
+ buf = BytesIO()
+ p.save_to_fileobj(buf)
+ raw = buf.getvalue()
+- p = podofo.PDFDoc()
+- p.load(raw)
+- if (p.title, p.author) != (mi.title, mi.authors[0]):
+- raise ValueError('podofo failed to set title and author in Info dict')
+- if not p.get_xmp_metadata():
+- raise ValueError('podofo failed to write XMP packet')
++ with tempfile.NamedTemporaryFile(delete=False) as f:
++ f.write(raw)
++ try:
++ p = podofo.PDFDoc()
++ p.open(f.name)
++ if (p.title, p.author) != (mi.title, mi.authors[0]):
++ raise ValueError('podofo failed to set title and author in Info dict')
++ if not p.get_xmp_metadata():
++ raise ValueError('podofo failed to write XMP packet')
++ del p
++ finally:
++ os.remove(f.name)
++
+
+ if __name__ == '__main__':
+ import sys
+--
+2.18.0
+
More information about the arch-commits
mailing list