From db8bccfef15a927269aae617441d800cf9b1bc80 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 12 Apr 2017 14:34:13 -0300 Subject: calibre-2.82.0-1.parabola2: disable Calibre contacts its own servers to check for version updates -> https://lists.parabola.nu/pipermail/dev/2017-April/004947.html --- ...-that-contacts-calibre-servers-to-check-u.patch | 111 +++++++++++++++++++++ .../0001-Remove-new_version_notification.patch | 80 +++++++++++++++ libre/calibre/PKGBUILD | 12 ++- 3 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 libre/calibre/0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch create mode 100644 libre/calibre/0001-Remove-new_version_notification.patch diff --git a/libre/calibre/0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch b/libre/calibre/0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch new file mode 100644 index 000000000..2b9a51f57 --- /dev/null +++ b/libre/calibre/0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch @@ -0,0 +1,111 @@ +diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py +index 3e294cac3..580f736ef 100644 +--- a/src/calibre/gui2/update.py ++++ b/src/calibre/gui2/update.py +@@ -1,19 +1,17 @@ + __license__ = 'GPL v3' + __copyright__ = '2008, Kovid Goyal ' + +-import re, binascii, cPickle, ssl, json ++import binascii, cPickle + from future_builtins import map + from threading import Thread, Event + + from PyQt5.Qt import (QObject, pyqtSignal, Qt, QUrl, QDialog, QGridLayout, +- QLabel, QCheckBox, QDialogButtonBox, QIcon) ++ QLabel, QDialogButtonBox, QIcon) + +-from calibre.constants import (__appname__, __version__, iswindows, isosx, +- isportable, is64bit, numeric_version) ++from calibre.constants import (__appname__, iswindows, isosx, ++ isportable, is64bit) + from calibre import prints, as_unicode +-from calibre.utils.config import prefs +-from calibre.utils.https import get_https_resource_securely +-from calibre.gui2 import config, dynamic, open_url ++from calibre.gui2 import dynamic, open_url + from calibre.gui2.dialogs.plugin_updater import get_plugin_updates_available + + URL = 'https://code.calibre-ebook.com/latest' +@@ -30,35 +28,7 @@ def get_download_url(): + + + def get_newest_version(): +- try: +- icon_theme_name = json.loads(I('icon-theme.json', data=True))['name'] +- except Exception: +- icon_theme_name = '' +- headers={ +- 'CALIBRE-VERSION':__version__, +- 'CALIBRE-OS': ('win' if iswindows else 'osx' if isosx else 'oth'), +- 'CALIBRE-INSTALL-UUID': prefs['installation_uuid'], +- 'CALIBRE-ICON-THEME': icon_theme_name, +- } +- try: +- version = get_https_resource_securely(URL, headers=headers) +- except ssl.SSLError as err: +- if getattr(err, 'reason', None) != 'CERTIFICATE_VERIFY_FAILED': +- raise +- # certificate verification failed, since the version check contains no +- # critical information, ignore and proceed +- # We have to do this as if the calibre CA certificate ever +- # needs to be revoked, then we wont be able to do version checks +- version = get_https_resource_securely(URL, headers=headers, cacerts=None) +- try: +- version = version.decode('utf-8').strip() +- except UnicodeDecodeError: +- version = u'' +- ans = NO_CALIBRE_UPDATE +- m = re.match(ur'(\d+)\.(\d+).(\d+)$', version) +- if m is not None: +- ans = tuple(map(int, (m.group(1), m.group(2), m.group(3)))) +- return ans ++ return NO_CALIBRE_UPDATE + + + class Signal(QObject): +@@ -81,12 +51,6 @@ class CheckForUpdates(Thread): + calibre_update_version = NO_CALIBRE_UPDATE + plugins_update_found = 0 + try: +- version = get_newest_version() +- if version[:2] > numeric_version[:2]: +- calibre_update_version = version +- except Exception as e: +- prints('Failed to check for calibre update:', as_unicode(e)) +- try: + update_plugins = get_plugin_updates_available(raise_error=True) + if update_plugins is not None: + plugins_update_found = len(update_plugins) +@@ -200,22 +164,15 @@ class UpdateMixin(object): + self.status_bar.update_label.setText(msg) + self.status_bar.update_label.setVisible(True) + +- if has_calibre_update: +- if (force or (config.get('new_version_notification') and +- dynamic.get('update to version %s'%calibre_version, True))): +- if not no_show_popup: +- self._update_notification__ = UpdateNotification(calibre_version, +- number_of_plugin_updates, parent=self) +- self._update_notification__.show() +- elif has_plugin_updates: +- if force: +- from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog, +- FILTER_UPDATE_AVAILABLE) +- d = PluginUpdaterDialog(self, +- initial_filter=FILTER_UPDATE_AVAILABLE) +- d.exec_() +- if d.do_restart: +- self.quit(restart=True) ++ if has_plugin_updates: ++ if force: ++ from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog, ++ FILTER_UPDATE_AVAILABLE) ++ d = PluginUpdaterDialog(self, ++ initial_filter=FILTER_UPDATE_AVAILABLE) ++ d.exec_() ++ if d.do_restart: ++ self.quit(restart=True) + + def plugin_update_found(self, number_of_updates): + # Change the plugin icon to indicate there are updates available diff --git a/libre/calibre/0001-Remove-new_version_notification.patch b/libre/calibre/0001-Remove-new_version_notification.patch new file mode 100644 index 000000000..432b3ae8d --- /dev/null +++ b/libre/calibre/0001-Remove-new_version_notification.patch @@ -0,0 +1,80 @@ +diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py +index a1cf1849d..6daa2e705 100644 +--- a/src/calibre/gui2/__init__.py ++++ b/src/calibre/gui2/__init__.py +@@ -169,8 +169,6 @@ def _config(): # {{{ + help=_('Confirm before deleting')) + c.add_opt('main_window_geometry', default=None, + help=_('Main window geometry')) +- c.add_opt('new_version_notification', default=True, +- help=_('Notify when a new version is available')) + c.add_opt('use_roman_numerals_for_series_number', default=True, + help=_('Use Roman numerals for series number')) + c.add_opt('sort_tags_by', default='name', +diff --git a/src/calibre/gui2/preferences/behavior.py b/src/calibre/gui2/preferences/behavior.py +index 6db4cb1f3..51b7ed0a8 100644 +--- a/src/calibre/gui2/preferences/behavior.py ++++ b/src/calibre/gui2/preferences/behavior.py +@@ -40,7 +40,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): + + r('network_timeout', prefs) + +- r('new_version_notification', config) + r('upload_news_to_device', config) + r('delete_news_from_library_on_upload', config) + +diff --git a/src/calibre/gui2/preferences/behavior.ui b/src/calibre/gui2/preferences/behavior.ui +index 2926f767b..0ad998884 100644 +--- a/src/calibre/gui2/preferences/behavior.ui ++++ b/src/calibre/gui2/preferences/behavior.ui +@@ -14,13 +14,6 @@ + Form + + +- +- +- +- Show notification when &new version is available +- +- +- + + + +diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py +index 3e294cac3..d1ba09137 100644 +--- a/src/calibre/gui2/update.py ++++ b/src/calibre/gui2/update.py +@@ -125,11 +125,7 @@ class UpdateNotification(QDialog): + self.setWindowIcon(QIcon(I('lt.png'))) + self.l.addWidget(self.logo, 0, 0) + self.l.addWidget(self.label, 0, 1) +- self.cb = QCheckBox( +- _('Show this notification for future updates'), self) +- self.l.addWidget(self.cb, 1, 0, 1, -1) +- self.cb.setChecked(config.get('new_version_notification')) +- self.cb.stateChanged.connect(self.show_future) ++ + self.bb = QDialogButtonBox(self) + b = self.bb.addButton(_('&Get update'), self.bb.AcceptRole) + b.setDefault(True) +@@ -151,9 +147,6 @@ class UpdateNotification(QDialog): + initial_filter=FILTER_UPDATE_AVAILABLE) + d.exec_() + +- def show_future(self, *args): +- config.set('new_version_notification', bool(self.cb.isChecked())) +- + def accept(self): + open_url(QUrl(get_download_url())) + +@@ -201,8 +194,7 @@ class UpdateMixin(object): + self.status_bar.update_label.setVisible(True) + + if has_calibre_update: +- if (force or (config.get('new_version_notification') and +- dynamic.get('update to version %s'%calibre_version, True))): ++ if force: + if not no_show_popup: + self._update_notification__ = UpdateNotification(calibre_version, + number_of_plugin_updates, parent=self) diff --git a/libre/calibre/PKGBUILD b/libre/calibre/PKGBUILD index e869aabc3..00aa67f40 100644 --- a/libre/calibre/PKGBUILD +++ b/libre/calibre/PKGBUILD @@ -11,7 +11,7 @@ pkgname=calibre pkgver=2.82.0 -pkgrel=1.parabola1 +pkgrel=1.parabola2 pkgdesc="Ebook management application, without nonfree decompression engine for RAR archives" arch=('i686' 'x86_64' 'armv7h') url="https://calibre-ebook.com/" @@ -33,11 +33,15 @@ conflicts=($pkgname-libre) mksource=("http://download.$pkgname-ebook.com/${pkgver}/$pkgname-${pkgver}.tar.xz" "https://calibre-ebook.com/signatures/${pkgname}-${pkgver}.tar.xz.sig") source=("https://repo.parabola.nu/other/${pkgname}-libre/${pkgname}-libre-${pkgver}.tar.xz" - 'libre.patch') + 'libre.patch' + '0001-Remove-new_version_notification.patch' + '0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch') mksha256sums=('137995abe467fcb951c1d42583305ebec7b8ca403c44895e70f82a2d6156711c' 'SKIP') sha256sums=('4da07053bddca0c49c3bf315397f3f1dff319f74e63e8a961c3906e0eca4eb7d' - '9d57abfff30e0b02128aa32ee41e095ab9f16b52c358fda68b3cae3ab8b485b9') + '9d57abfff30e0b02128aa32ee41e095ab9f16b52c358fda68b3cae3ab8b485b9' + '26bfd44cd360df3aff927c4834e1622fb16a89169a8cce4f68ea19b87e9e867b' + 'bed99658f2545ec3112710d72a70b30ffaeddd03c12d51cfc2ee0972d2697e8b') validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') mksource(){ @@ -55,6 +59,8 @@ prepare(){ rm -v resources/images/mimetypes/{cbr,rar}.png rm -v imgsrc/mimetypes/rar.svg patch -Np1 -i "${srcdir}/libre.patch" + patch -Np1 -i "${srcdir}/0001-Remove-new_version_notification.patch" + patch -Np1 -i "${srcdir}/0001-Remove-code-that-contacts-calibre-servers-to-check-u.patch" # Remove unneeded files and libs # FIXME: remove html5lib too, but the latest html5lib breaks calibre. And calibre -- cgit v1.2.3