Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calibre: remove unnecessary patch #38066

Merged
merged 1 commit into from Apr 29, 2018
Merged

Conversation

jluttine
Copy link
Member

Motivation for this change

In addition to bumping the version, remove a patch which made self.update_checker None. This caused errors that showed on the terminal after closing Calibre (if it was launched from a terminal).

@AndersonTorres Perhaps you know if it is safe to remove this patch as you added it? Why was it added? It causes an error on exit (only visible from the terminal). Probably not serious, and I believe next Calibre version will not have this issue, but still, I don't see any reason for the patch.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@AndersonTorres
Copy link
Member

I added this patch because the original patches disappeared from the Debian mirror. In fact, it is the same patches below:

https://github.com/jcpetkovich/overlay-petkovich/blob/master/app-text/calibre/files/calibre-2.9.0-no_updates_dialog.patch

https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/calibre/files/

The reason, as the patch name suggests, is to prevent Calibre to search for updates. I will look at it later.

@jluttine
Copy link
Member Author

@AndersonTorres That patch which sets self.update_checker to None doesn't prevent Calibre to search for updates and actually breaks some things:

  1. Whether to search for updates or not is decided based on command line arguments. The part of the patch that I left untouched, sets the default value of that command-line argument so that updates are disabled. The command line argument is used as follows (https://github.com/kovidgoyal/calibre/blob/v3.20.0/src/calibre/gui2/update.py#L171):
        if not opts.no_update_check:
            self.update_checker = CheckForUpdates(self)
            self.update_checker.signal.update_found.connect(self.update_found,
                    type=Qt.QueuedConnection)
            self.update_checker.start()

Note that if update checking is disabled by the command line argument, no attribute update_checker is added to self. However, the patch that I removed, did add that attribute and set its value to None.

  1. When closing Calibre, these lines are executed (https://github.com/kovidgoyal/calibre/blob/v3.20.0/src/calibre/gui2/ui.py#L975):
        if hasattr(self, 'update_checker'):
            self.update_checker.shutdown()

Note that if self.update_checker is None, this causes a run-time error. The unpatched Calibre version handles this so that update_checker is not an attribute of self when updates are disabled. So there is no need for any patching.

Those are the only two locations that refer to update_checker. Based on this, I'd say the patch can be removed as I did.

Calibre master branch was just modified so that this works even if self.update_checker is None. However, a) it's not yet in a release, b) the patch is still unnecessary.

The reason I asked why this was added is that I don't see any reason for the patch because Calibre works without it, and with it, it actually doesn't work. So I thought there's probably some reason that isn't clear to me. I guess the patch was fixing some issue that had existed in some older version of Calibre.

@AndersonTorres
Copy link
Member

AndersonTorres commented Mar 31, 2018

@jluttine , do you think the patch can be completely erased?

@jluttine
Copy link
Member Author

jluttine commented Apr 5, 2018

@AndersonTorres I would erase only that part that I've erased in this pull request. The remaining part of that patch disables the update checker by default and offers a command line switch to enable it. That's good. (Normally Calibre does the other way around.)

@AndersonTorres
Copy link
Member

@jluttine

Now Calibre was updated. Can you solve this conflict and re-submit it? (You can just submit the modified patch you are suggesting.)

In addition to bumping the version, remove a patch which made
self.update_checker None. This caused errors that showed on the terminal after
closing Calibre (if it was launched from a terminal).
@jluttine jluttine changed the title calibre: 3.19.0 -> 3.20.0 calibre: remove unnecessary patch Apr 8, 2018
@jluttine
Copy link
Member Author

jluttine commented Apr 8, 2018

@AndersonTorres Yes, I now updated this pull request. It just removes an unnecessary part of the patch. It wouldn't have caused issues anymore on 3.21.0 because of an upstream fix, but it is unnecessary anyway so better to remove so it won't start causing issues at any later point and the nixpkgs codebase stays cleaner.

@srhb
Copy link
Contributor

srhb commented Apr 27, 2018

@AndersonTorres Is this merge-ready?

@AndersonTorres
Copy link
Member

@srhb Yes! I will merge it now! (Real life issues again...)

@AndersonTorres AndersonTorres merged commit 6cc732e into NixOS:master Apr 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants