Bug 281304 - [NEW PORT] www/py-calibreweb: Web app that offers an interface for browsing a Calibre Library DB
Summary: [NEW PORT] www/py-calibreweb: Web app that offers an interface for browsing a...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dries Michiels
URL:
Keywords:
Depends on: 282838 282841 282844 282846 282847 282848 282849
Blocks:
  Show dependency treegraph
 
Reported: 2024-09-05 20:38 UTC by Matthew Wener
Modified: 2024-12-10 02:05 UTC (History)
2 users (show)

See Also:


Attachments
New Port py-calibreweb 0.6.23 (60.61 KB, patch)
2024-09-05 20:38 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 (54.84 KB, patch)
2024-11-17 02:23 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v2 (15.78 KB, patch)
2024-11-18 16:26 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v3 (15.77 KB, patch)
2024-11-19 01:57 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v3 (15.77 KB, patch)
2024-11-19 01:59 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v4 (15.78 KB, patch)
2024-11-19 17:55 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v5 (15.78 KB, patch)
2024-11-20 03:25 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v6 (14.03 KB, patch)
2024-11-23 15:51 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v7 (14.25 KB, patch)
2024-11-23 20:42 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v8 (14.32 KB, patch)
2024-11-23 20:51 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v9 (14.29 KB, patch)
2024-11-25 01:10 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v10 (14.31 KB, patch)
2024-11-30 15:22 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v11 (14.31 KB, patch)
2024-11-30 20:38 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v12 (14.22 KB, patch)
2024-12-09 01:04 UTC, Matthew Wener
no flags Details | Diff
New Port py-calibreweb 0.6.24 v13 (14.13 KB, patch)
2024-12-09 01:32 UTC, Matthew Wener
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Wener 2024-09-05 20:38:42 UTC
Created attachment 253363 [details]
New Port py-calibreweb 0.6.23

New port for the Calibre-Web Application (https://github.com/janeczku/calibre-web).

This port includes two patches; one for adding the binary locations on FreeBSD and the other for addressing an upstream bug that I found when converting books (https://github.com/janeczku/calibre-web/issues/3143).

In addition, several ports were also created to support the optional features in Calibre-Web.

www/py-calibreweb
  www/py-comicapi [Support Comic Metadata APIs]
     textproc/py-text2digits
     textproc/py-wordninja
  www/py-Goodreads [Support Goodreads API]
  www/py-flask-simpleldap [LDAP]
  archivers/py-py7zr [Support Metadata Extraction from Archive Files]
     archivers/py-inflate64 [RUN DEPEND]
     archivers/py-multivolumefile [RUN DEPEND]
     archivers/py-pybcj [RUN DEPEND]
     archivers/py-pyppmd [RUN DEPEND]
  www/py-scholarly [Support Google Scholar API]
     www/py-free-proxy [RUN DEPEND]
  www/py-flask-dance [OAUTH Support]
    www/py-flask-sphinx-themes [DOCS BUILD DEPEND]
    textproc/py-sphinxcontrib-seqdiag [DOCS BUILD DEPEND]
    textproc/py-sphinxcontrib-spelling [DOCS BUILD DEPEND]
Comment 1 Matthew Wener 2024-11-17 02:23:50 UTC
Created attachment 255227 [details]
New Port py-calibreweb 0.6.24
Comment 2 Dries Michiels freebsd_committer freebsd_triage 2024-11-18 12:55:08 UTC
Hello Matthew

Ideally we have a PR for every port that is added. Do you think you can make this happen, you can link other PR's to this PR than as dependent?
If not I'll try to split up the patch in different commits and all link them to this PR, which is not ideal ... :-)
Comment 3 Matthew Wener 2024-11-18 13:45:43 UTC
(In reply to Dries Michiels from comment #2)
Yes I can do that. It will take a bit. Should I open a bug for each Port?
Comment 4 Dries Michiels freebsd_committer freebsd_triage 2024-11-18 14:49:13 UTC
Yes please, this way I can tackle every added port one by one and give feedback if any one by one. You can tag me in all the PR's. I'll take care of the commits.
Comment 5 Matthew Wener 2024-11-18 16:26:00 UTC
Created attachment 255282 [details]
New Port py-calibreweb 0.6.24 v2
Comment 6 Matthew Wener 2024-11-18 16:35:28 UTC
(In reply to Dries Michiels from comment #4)
Created the following Bugs

archivers/py-py7zr [bug #282838]
  archivers/py-inflate64 [bug #282834]
  archivers/py-multivolumefile [bug #282835]
  archivers/py-pybcj [bug #282836]
  archivers/py-pyppmd [bug #282837]
www/py-comicapi [bug #282841]
  textproc/py-text2digits [bug #282839]
  textproc/py-wordninja [bug #282840]
www/py-flask-dance [bug #282844]
  textproc/py-sphinxcontrib-spelling [bug #282842]
  www/py-flask-sphinx-themes [bug #282843]
www/py-scholarly [bug #282846]
  www/py-free-proxy [bug #282845]
www/py-pydrive2 [bug #282847]
www/py-Goodreads [bug #282848]
www/py-flask-simpleldap [bug #282849]
Comment 7 Matthew Wener 2024-11-19 01:57:50 UTC
Created attachment 255293 [details]
New Port py-calibreweb 0.6.24 v3
Comment 8 Matthew Wener 2024-11-19 01:59:12 UTC
Created attachment 255294 [details]
New Port py-calibreweb 0.6.24 v3
Comment 9 Matthew Wener 2024-11-19 17:55:45 UTC
Created attachment 255303 [details]
New Port py-calibreweb 0.6.24 v4
Comment 10 Matthew Wener 2024-11-20 03:25:16 UTC
Created attachment 255316 [details]
New Port py-calibreweb 0.6.24 v5
Comment 11 Dries Michiels freebsd_committer freebsd_triage 2024-11-22 07:00:11 UTC
Is the patch regarding unrar location something we can upstream?
Comment 12 Dries Michiels freebsd_committer freebsd_triage 2024-11-22 07:01:11 UTC
Basically this whole patch; patch-src_calibreweb_cps_config__sql.py
Comment 13 Matthew Wener 2024-11-23 02:44:06 UTC
(In reply to Dries Michiels from comment #11)
(In reply to Dries Michiels from comment #12)
Well, we can try. https://github.com/janeczku/calibre-web/pull/3240
Comment 14 Matthew Wener 2024-11-23 15:24:35 UTC
(In reply to Matthew Wener from comment #13)
Change was merged. Patch can be removed in the next release.
Comment 15 Matthew Wener 2024-11-23 15:51:30 UTC
Created attachment 255407 [details]
New Port py-calibreweb 0.6.24 v6

Add PATCH from Github
Comment 16 Matthew Wener 2024-11-23 20:42:22 UTC
Created attachment 255415 [details]
New Port py-calibreweb 0.6.24 v7

Fixes the patch.
Comment 17 Matthew Wener 2024-11-23 20:51:10 UTC
Created attachment 255416 [details]
New Port py-calibreweb 0.6.24 v8

Remove the *.orig post patch.
Comment 18 Matthew Wener 2024-11-25 01:10:40 UTC
Created attachment 255434 [details]
New Port py-calibreweb 0.6.24 v9
Comment 19 Dries Michiels freebsd_committer freebsd_triage 2024-11-30 10:46:38 UTC
Hello Matthew, I'm trying to get the daemon to start but it fails silently instantly. I think I'm also missing some extra steps for new users to install the package. Where do they define the location of the calibre database? And if the calibre option is unchecked, maybe the port can install an empty metadata.db? I also miss the location to be configured in the script? Or it is by defualt in /usr/local/share.

https://github.com/janeczku/calibre-web/tree/master/library

rcname_flags should not be added in the individual rc scripts of daemons. this is taken care of by the framework. Every rc.script has this option to add flags the the end of the full start command. By defining it in the rc script itself, the options are appended twice.
Comment 20 Dries Michiels freebsd_committer freebsd_triage 2024-11-30 10:48:02 UTC
I was also noticing that sqlalcehmy tools by default is build against sqla1.4.*.(LDAP dependency)
The port is build using by default sqlal2.0.*, I think maybe we need an SQLA20_PREVENTS= LDAP, if users toggle the LDAP option the dependency chain has issues.
Comment 21 Matthew Wener 2024-11-30 15:22:50 UTC
Created attachment 255546 [details]
New Port py-calibreweb 0.6.24 v10

(In reply to Dries Michiels from comment #20)
Updated apscheduler->APScheduler due to port rename. Added LDAP_PREVENTS.

(In reply to Dries Michiels from comment #19)
Removed rcname_flags

Also, I'm running a clean build to see what could be wrong with the script. It should take a few hours to finish building all the dependencies. As for the location of the calibre db location, it gets set in the web interface the first time the application is run.
Comment 22 Matthew Wener 2024-11-30 20:38:52 UTC
Created attachment 255553 [details]
New Port py-calibreweb 0.6.24 v11

Fix Unterminated quoted string
Comment 23 Matthew Wener 2024-11-30 21:03:15 UTC
(In reply to Dries Michiels from comment #19)
Can you retry with the latest patch? I couldn't replicate the issue on clean install. The service starts correctly for me, and I am able to reach the web server at <IP Address>:8083.

The log should be in /var/log/calibreweb/calibreweb.log
Comment 24 Dries Michiels freebsd_committer freebsd_triage 2024-12-01 11:52:53 UTC
Ok I got it to start, good. Are the allocations  at the start done on purpose (distinction between =, or :=)?

: ${%%RC_NAME%%_enable:=NO}
: ${%%RC_NAME%%_user:=%%USER%%}
: ${%%RC_NAME%%_group:=%%GROUP%%}
: ${%%RC_NAME%%_ip_addr="0.0.0.0"}
: ${%%RC_NAME%%_conf_dir="%%DATADIR%%"}
: ${%%RC_NAME%%_settings="${%%RC_NAME%%_conf_dir}/app.db"}
: ${%%RC_NAME%%_gdrive="${%%RC_NAME%%_conf_dir}/gdrive.db"}
: ${%%RC_NAME%%_pid:="%%PORTNAME%%.pid"}
: ${%%RC_NAME%%_pid_dir:="/var/run/%%PORTNAME%%"}
: ${%%RC_NAME%%_log:="%%PORTNAME%%.log"}
: ${%%RC_NAME%%_log_dir:="/var/log/%%PORTNAME%%"}

Is there a reason we are not just referencing the variables above? Or declaring everything above and then use only variables in command_args?

command_args="-p $pidfile $procname \
                ${%%RC_NAME%%_ip_addr:+-i ${%%RC_NAME%%_ip_addr}} \
                ${%%RC_NAME%%_settings:+-p ${%%RC_NAME%%_settings}} \
                ${%%RC_NAME%%_gdrive:+-g ${%%RC_NAME%%_gdrive}} \
                ${%%RC_NAME%%_cert:+-c ${%%RC_NAME%%_cert}} \
                ${%%RC_NAME%%_key:+-k ${%%RC_NAME%%_key}} \
                ${logfile:+-o $logfile}"

Something like this; could work if you define them above

command_args="-p $pidfile $procname \
                -i ${%%RC_NAME%%_ip_addr} \
                -p ${%%RC_NAME%%_settings} \
                -g ${%%RC_NAME%%_gdrive} \
                -c ${%%RC_NAME%%_cert} \
                -k ${%%RC_NAME%%_key} \
                -o $logfile"
Comment 25 Dries Michiels freebsd_committer freebsd_triage 2024-12-01 11:53:34 UTC
cert and key are the only one missing
Comment 26 Matthew Wener 2024-12-01 17:09:57 UTC
(In reply to Dries Michiels from comment #24)
I think my thought process here was if someone was to unset the variables and allow Calibre Web to use the default locations instead of %%DATADIR%% the flags shouldn't be set as blanks. Not sure what the best approach is here.

(In reply to Dries Michiels from comment #25)
As for why Cert and Key are not being set to a default, it is because they aren't required to run the application. However, they were listed as it would be highly recommended to be set these if the intention is to expose Calibre-Web to the open internet.
Comment 27 Dries Michiels freebsd_committer freebsd_triage 2024-12-06 15:13:29 UTC
And if we assign cert and key to nothing? eg "", does it work?
This way we can all have the declaration above, and only reference the varaible in command_args.

Accomplishing this would be very nice:

command_args="-p $pidfile $procname \
                -i ${%%RC_NAME%%_ip_addr} \
                -p ${%%RC_NAME%%_settings} \
                -g ${%%RC_NAME%%_gdrive} \
                -c ${%%RC_NAME%%_cert} \
                -k ${%%RC_NAME%%_key} \
                -o $logfile"
Comment 28 Dries Michiels freebsd_committer freebsd_triage 2024-12-06 15:15:04 UTC
(In reply to Matthew Wener from comment #26)

I think my thought process here was if someone was to unset the variables and allow Calibre Web to use the default locations instead of %%DATADIR%% the flags shouldn't be set as blanks. Not sure what the best approach is here.

We can assume that if someone is tinkering with the default values (unsetting, assign to something else, eg) they know what they are doing. So I would advocate to use := for every variable.
Comment 29 Matthew Wener 2024-12-09 01:04:24 UTC
Created attachment 255729 [details]
New Port py-calibreweb 0.6.24 v12

(In reply to Dries Michiels from comment #27)
For the flags that are not defaulted they need to be unset unless active. The rest can be set.
Comment 30 Matthew Wener 2024-12-09 01:32:39 UTC
Created attachment 255730 [details]
New Port py-calibreweb 0.6.24 v13
Comment 31 commit-hook freebsd_committer freebsd_triage 2024-12-09 17:04:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ba6612833358392e3fe2b1472143eec622033dad

commit ba6612833358392e3fe2b1472143eec622033dad
Author:     Matthew Wener <matthew@wener.org>
AuthorDate: 2024-11-28 20:06:14 +0000
Commit:     Dries Michiels <driesm@FreeBSD.org>
CommitDate: 2024-12-09 17:01:59 +0000

    www/py-calibreweb: add new port

    Web app that offers an interface for browsing a Calibre Library DB.

    PR:     281304

 GIDs                                         |   2 +-
 UIDs                                         |   2 +-
 www/Makefile                                 |   1 +
 www/py-calibreweb/Makefile (new)             | 141 +++++++++++++++++++++++++++
 www/py-calibreweb/distinfo (new)             |   5 +
 www/py-calibreweb/files/calibreweb.in (new)  |  91 +++++++++++++++++
 www/py-calibreweb/files/pkg-message.in (new) |  17 ++++
 www/py-calibreweb/pkg-descr (new)            |   3 +
 8 files changed, 260 insertions(+), 2 deletions(-)
Comment 32 Dries Michiels freebsd_committer freebsd_triage 2024-12-09 17:05:16 UTC
Committed!
Comment 33 Matthew Wener 2024-12-10 02:05:52 UTC
Thanks!