agateau / nanonote

A minimalist note taking application
Other
57 stars 11 forks source link

Flatpak build progress #44

Closed Justinzobel closed 1 year ago

Justinzobel commented 1 year ago

I'm building the flatpak at the moment, well, trying to.

I have the two qpropgen python3 modules being installed first, then it tries to build nanonote but I get this:

-- Build files have been written to: /run/build/nanonote
[  4%] Automatic MOC and UIC for target singleapplication
[  4%] Generating app_es.qm
[  6%] Generating app_fr.qm
[  9%] Generating app_de.qm
Updating '/run/build/nanonote/src/app_fr.qm'...
    Generated 26 translation(s) (26 finished and 0 unfinished)
Updating '/run/build/nanonote/src/app_es.qm'...
Updating '/run/build/nanonote/src/app_de.qm'...
    Generated 13 translation(s) (13 finished and 0 unfinished)
    Ignored 13 untranslated source text(s)
    Generated 26 translation(s) (26 finished and 0 unfinished)
[  9%] Built target build_qm
[ 11%] Generating qrc_translations.cpp
[ 13%] Automatic MOC and UIC for target nanonotelib
[ 13%] Built target singleapplication_autogen
[ 16%] Building CXX object third-party/singleapplication/CMakeFiles/singleapplication.dir/src/singleapplication.cpp.o
[ 18%] Building CXX object third-party/singleapplication/CMakeFiles/singleapplication.dir/singleapplication_autogen/mocs_compilation.cpp.o
[ 18%] Built target nanonotelib_autogen
[ 20%] Generating BaseSettings.h, BaseSettings.cpp
[ 23%] Generating qrc_app.cpp
Traceback (most recent call last):
  File "/run/build/nanonote/third-party/qpropgen/cmake/../qpropgen/fromsrc.py", line 9, in <module>
    from qpropgen.main import main
  File "/run/build/nanonote/third-party/qpropgen/cmake/../qpropgen/../qpropgen/main.py", line 7, in <module>
    from jinja2 import Environment, PackageLoader
  File "/app/lib/python3.9/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/app/lib/python3.9/site-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/app/lib/python3.9/site-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/app/lib/python3.9/site-packages/jinja2/utils.py", line 624, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/lib/python3.9/site-packages/markupsafe/__init__.py)
make[2]: *** [src/CMakeFiles/nanonotelib.dir/build.make:78: src/BaseSettings.h] Error 1
make[1]: *** [CMakeFiles/Makefile2:1053: src/CMakeFiles/nanonotelib.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I've tried adding a build for Markupsafe from pypi but it says it's already installed and tries to uninstall it, which fails:

========================================================================
Building module PyYAML in /tmp/tmp.RMxwpak9My/.flatpak-builder/build/PyYAML-1
========================================================================
Running: pip3 install --prefix=/app --no-deps .
Processing /run/build/PyYAML
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: PyYAML
  Building wheel for PyYAML (setup.py) ... done
  Created wheel for PyYAML: filename=PyYAML-3.13-cp39-cp39-linux_x86_64.whl size=43098 sha256=a418c4a57bf377effd0d6c4aecfa3133d09143550405e4d3ef89daf74606ac17
  Stored in directory: /tmp/pip-ephem-wheel-cache-e9p7hqfx/wheels/39/85/44/037761959e82332d3ac470ac13f962bc74fa6467b62088fd12
Successfully built PyYAML
Installing collected packages: PyYAML
Successfully installed PyYAML
WARNING: There was an error checking the latest version of pip.
Committing stage build-PyYAML to cache
========================================================================
Building module jinja2 in /tmp/tmp.RMxwpak9My/.flatpak-builder/build/jinja2-1
========================================================================
Running: pip3 install --prefix=/app --no-deps .
Processing /run/build/jinja2
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: Jinja2
  Building wheel for Jinja2 (setup.py) ... done
  Created wheel for Jinja2: filename=Jinja2-2.9.5-py2.py3-none-any.whl size=339070 sha256=0aa31783bfe1b7b1e8555f7f49c35af6bfecd4c7214970d92091b97ba62877af
  Stored in directory: /tmp/pip-ephem-wheel-cache-uyiyfvgg/wheels/3c/d2/9d/1e4455c894e0d7154c96dab5d115069c47ecadae5f508ec099
Successfully built Jinja2
Installing collected packages: Jinja2
Successfully installed Jinja2-2.9.5
WARNING: There was an error checking the latest version of pip.
Committing stage build-jinja2 to cache
========================================================================
Building module markupsafe in /tmp/tmp.RMxwpak9My/.flatpak-builder/build/markupsafe-1
========================================================================
Running: pip3 install --prefix=/app --no-deps .
Processing /run/build/markupsafe
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: MarkupSafe
  Building wheel for MarkupSafe (setup.py) ... done
  Created wheel for MarkupSafe: filename=MarkupSafe-2.1.2-cp39-cp39-linux_x86_64.whl size=25213 sha256=15fec49dc6aa13de2f306dc373107f57fcaedd1998bd655cf0ad4659b9a07558
  Stored in directory: /tmp/pip-ephem-wheel-cache-ywaf00fw/wheels/6b/c7/f7/713168e0f3774d101878c9cbffb34cbb4f5dc8fa5dee0533fb
Successfully built MarkupSafe
Installing collected packages: MarkupSafe
  Attempting uninstall: MarkupSafe
    Found existing installation: MarkupSafe 2.1.2
    Uninstalling MarkupSafe-2.1.2:
ERROR: Could not install packages due to an OSError: [Errno 30] Read-only file system: 'installed-files.txt'

WARNING: There was an error checking the latest version of pip.
Error: module markupsafe: Child process exited with code 1
agateau commented 1 year ago

Thanks for starting this work! If it makes your life easier I can probably drop the qpropgen dependency. Let me know.

Justinzobel commented 1 year ago

It would be great if it's easy enough to drop without causing issues or losing any functionality. Fewer dependencies are always welcome.

agateau commented 1 year ago

Just removed it!

Justinzobel commented 1 year ago

Well that made it extremely easy. I've just tested it and I can launch it and it saves the content to ~/.var/app/com.agateau.nanonote/data/agateau.com/nanonote/nanonote.txt

Justinzobel commented 1 year ago

I guess if i enable some other home directory permission from within the flatpak it could save it in the regular location, will test.

Justinzobel commented 1 year ago

Even with the home filesystem permission it still drops the file in the flatpak folder, I guess that's fine as the UI does show the location of the file correctly: file:///home/justin/.var/app/com.agateau.nanonote/data/agateau.com/nanonote/nanonote.txt

agateau commented 1 year ago

Sounds good enough indeed! Thanks!

Justinzobel commented 1 year ago

Would you like me to submit it to Flathub or would you like to do it so it can be verified?

agateau commented 1 year ago

Oh, I didn't know about Flathub verification feature! Indeed it would be better if I submit it myself.

I think the best solution to do this is for me to clone Flathub repo as explained in their docs and give you write access to the fork so you can push your changes. Does this make sense?

Justinzobel commented 1 year ago

Yeah I submitted an app to flathub a few years ago, couldn't remember the process.

This is the file, save it as com.agateau.nanonote.yml

app-id: com.agateau.nanonote
runtime: org.kde.Platform
runtime-version: '5.15-21.08'
sdk: org.kde.Sdk
command: nanonote
finish-args:
  - --socket=x11
  - --socket=wayland
modules:
  - name: nanonote
    buildsystem: cmake
    sources:
      - type: git
        url: https://github.com/agateau/nanonote.git
Justinzobel commented 1 year ago

This is a git master build as obviously that's where the removal of qpropgen happened. If you want to release it as a versioned release you'll have to tag a release on github.

If you do that you just change the sources to:

type: archive:
url: https://link.to.github/someversion.tar.gz
sha256: sha256sum of tarball here
agateau commented 1 year ago

Thanks a ton!

Here is the PR: https://github.com/flathub/flathub/pull/4003 I made a few changes:

Justinzobel commented 1 year ago

Looks good, they have asked for an appstream data file to be added in the merge request.

agateau commented 1 year ago

Looks good, they have asked for an appstream data file to be added in the merge request.

Do you have time to look into this? I just added you as a collaborator to the https://github.com/agateau/flathub/ repo so you can push changes to the nanonote branch. Note that it's a generic repo because due to the way flathub works, the app does not get its own repo until the first PR gets accepted (see https://github.com/flathub/flathub/wiki/App-Submission#how-to-submit-an-app)

agateau commented 1 year ago

It's done!

image

Justinzobel commented 1 year ago

Nice work, sorry I didn't get time to get this sorted out but looks like you got it all sorted!