Comment 7 for bug 2005955

Revision history for this message
Jhonny Oliveira (jhonny-oliveira) wrote :

If you compare both mathjax.py and hyphenation.py you will understand why the patch is needed. As opposed to mathjax, hyphenization always cleans itself in the beggining.

I'm packaging Calibre for xtradeb.net (unofficial). Usually, my package is kept very closely to the official one (Debian), but gets updated more frequently. Unless, I'm struggling a bit, like now. :-)

There are a lot of files that are no longer being shipped by default in the release tarball. Therefore, I decided to run all install subcommands to get them in place. I realized now, that the gui does not seem to be required, as it is automatically executed during setup.py install.

I started from here; https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+sourcefiles/calibre/6.11.0+dfsg-1~xtradeb1/calibre_6.11.0+dfsg-1~xtradeb1.debian.tar.xz

These are the changes I made to the previous recipe:

$cat debian/patches/0025-Do-not-download-hyphenation-if_already-present.patch
Index: calibre-6.12.0+dfsg/setup/hyphenation.py
===================================================================
--- calibre-6.12.0+dfsg.orig/setup/hyphenation.py 2023-02-10 15:31:50.728763069 +0100
+++ calibre-6.12.0+dfsg/setup/hyphenation.py 2023-02-10 16:16:19.105858295 +0100
@@ -87,7 +87,16 @@
     DOWNLOAD_URL = 'https://github.com/LibreOffice/dictionaries/archive/%s.tar.gz' % VERSION
     CAN_USE_SYSTEM_VERSION = False

+ def already_present(self):
+ manifest = self.j(self.vendored_dir, 'locales.json')
+ if os.path.exists(manifest):
+ return True
+ return False
+
     def run(self, opts):
+ if self.already_present():
+ self.info('hyphenation dictionaries already present in the resources directory, not downloading')
+ return
         self.clean()
         os.makedirs(self.vendored_dir)
         with self.temp_dir() as dl_src, self.temp_dir() as output_dir:

$ diff {../calibre-6.11.0+dfsg/,}debian/rules
40a41
> $(SETUP) hyphenation --hyphenation-url="file://$(CURDIR)/debian/dictionaries/master.tar.gz"
48a50,54
> [ -d build ] && $(SETUP) iso639
> [ -d build ] && $(SETUP) iso3166
> [ -d build ] && $(SETUP) translations
> # [ -d build ] && $(SETUP) gui
> [ -d build ] && $(SETUP) resources
60c66
< env LANGUAGE= LC_ALL=C LC_CTYPE=C LC_MESSAGES=C LANG=C TZ=UTC $(CI_ENV) $(SETUP) test --test-name=dom_load $(TEST_FLAGS)
---
> # env LANGUAGE= LC_ALL=C LC_CTYPE=C LC_MESSAGES=C LANG=C TZ=UTC $(CI_ENV) $(SETUP) test --test-name=dom_load $(TEST_FLAGS)
89a96,98
> #
> # # Complete patch: 0008-Don-t-change-book-file-unless-user-s-consent-Closes-.patch
> sed 's/save_annotations_in_ebook"] = true/save_annotations_in_ebook"] = false/' debian/tmp/usr/share/calibre/viewer.js
96a106
> $(SETUP) hyphenation --clean
97a108,112
> # $(SETUP) iso639 --clean
> # $(SETUP) iso3166 --clean
> # $(SETUP) translations --clean
> # $(SETUP) gui --clean
> # $(SETUP) resources --clean

I still don't know how to get around the missing: resources/user-agent-data.json. I can confirm this is required by calibre when one tries to open a book. So, it needs further investigation.