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

Have Flathub as the sole distribution mechanism for MMEX on Linux #6246

Closed
whalley opened this issue Oct 17, 2023 · 34 comments
Closed

Have Flathub as the sole distribution mechanism for MMEX on Linux #6246

whalley opened this issue Oct 17, 2023 · 34 comments
Labels
feature fixed linux related to Linux platforms
Milestone

Comments

@whalley
Copy link
Member

whalley commented Oct 17, 2023

Are we happy have Flathub as the sole distribution mechanism for MMEX on Linux, and remove the other Linux builds we make via CircleCI. I'm concious that the CircleCI builds are still on wx3.1.7 and are falling behind Linux OS release versions with no active maintenance.

Look to include Flatpak build as part of CI and drop other LInux support.

Originally posted by @whalley in #5989 (comment)

@whalley
Copy link
Member Author

whalley commented Oct 17, 2023

@joshua-stone I added --privileged to the build and it builds wxWidgets but then fails..

#!/bin/bash -eo pipefail
docker run -it --rm --privileged -w /moneymanagerex/build -v $HOME/.ccache:/root/.ccache -v $CIRCLE_WORKING_DIRECTORY:/moneymanagerex bilelmoussaoui/flatpak-github-actions:gnome-45 bash -c "rm -rf * && /usr/bin/xvfb-run --auto-servernum flatpak-builder --repo=repo --disable-rofiles-fuse --force-clean --default-branch=master --arch=x86_64 _build ../org.moneymanagerex.MMEX.yml && /usr/bin/xvfb-run --auto-servernum flatpak build-bundle --arch=x86_64 ../mmex.flatpak org.moneymanagerex.MMEX master" && \
cp $CIRCLE_WORKING_DIRECTORY/build/mmex*.flatpak /tmp/artifacts

https://app.circleci.com/pipelines/github/whalley/circleci-test/141/workflows/1a4c957f-38f8-4713-a5cf-29587f5780cf/jobs/171

.
.
.
.
------------------------------------------------------
 
 The installation of wxWidgets is finished.  On certain
 platforms (e.g. Linux) you'll now have to run ldconfig
 if you installed a shared library and also modify the
 LD_LIBRARY_PATH (or equivalent) environment variable.
 
 wxWidgets comes with no guarantees and doesn't claim
 to be suitable for any purpose.
 
 Read the wxWindows Licence on licencing conditions.
 
 ------------------------------------------------------
 
compressing debuginfo in: /moneymanagerex/build/_build/files/lib/wx/3.2/web-extensions/webkit2_extu-3.2.so
processing: /moneymanagerex/build/_build/files/lib/wx/3.2/web-extensions/webkit2_extu-3.2.so
[29] .debug_aranges compressed -> .zdebug_aranges (192 => 79 41.15%)
[30] .debug_info compressed -> .zdebug_info (17178 => 9885 57.54%)
[31] .debug_abbrev compressed -> .zdebug_abbrev (1636 => 732 44.74%)
[32] .debug_line compressed -> .zdebug_line (2527 => 1255 49.66%)
[33] .debug_str compressed -> .zdebug_str (20045 => 7158 35.71%)
[34] .debug_line_str compressed -> .zdebug_line_str (1551 => 627 40.43%)
[35] .debug_loclists compressed -> .zdebug_loclists (3855 => 1571 40.75%)
[36] .debug_rnglists compressed -> .zdebug_rnglists (301 => 207 68.77%)
[39] Updating section string table
stripping /moneymanagerex/build/_build/files/lib/wx/3.2/web-extensions/webkit2_extu-3.2.so to /moneymanagerex/build/_build/files/lib/debug/lib/wx/3.2/web-extensions/webkit2_extu-3.2.so.debug
compressing debuginfo in: /moneymanagerex/build/_build/files/bin/wxrc-3.2
processing: /moneymanagerex/build/_build/files/bin/wxrc-3.2
[31] .debug_aranges compressed -> .zdebug_aranges (38112 => 6252 16.40%)
[32] .debug_info compressed -> .zdebug_info (17737908 => 7864178 44.34%)
[33] .debug_abbrev compressed -> .zdebug_abbrev (359619 => 78295 21.77%)
[34] .debug_line compressed -> .zdebug_line (2633298 => 662204 25.15%)
[35] .debug_str compressed -> .zdebug_str (768628 => 152528 19.84%)
[36] .debug_line_str compressed -> .zdebug_line_str (5208 => 1765 33.89%)
[37] .debug_loclists compressed -> .zdebug_loclists (5159606 => 1500635 29.08%)
[38] .debug_rnglists compressed -> .zdebug_rnglists (1053715 => 370371 35.15%)
[41] Updating section string table
stripping /moneymanagerex/build/_build/files/bin/wxrc-3.2 to /moneymanagerex/build/_build/files/lib/debug/bin/wxrc-3.2.debug
Committing stage build-wxWidgets to cache
========================================================================
Building module moneymanagerex in /moneymanagerex/build/.flatpak-builder/build/moneymanagerex-1
========================================================================
Error: module moneymanagerex: Error opening file /proc/sys/net/ipv4/route/flush: Permission denied

Exited with code exit status 1

@joshua-stone
Copy link
Contributor

@whalley Looks like the build made a bit of progress.

Can you modify this line at the bottom from path: .. to path: ., and add --verbose to flatpak-builder so we can see more of what it's doing?

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

@joshua-stone
Copy link
Contributor

Much better!

It looks like flatpak build-bundle is missing an argument as shown here. Can you try using this?

flatpak build-bundle --arch=x86_64 repo ../mmex.flatpak org.moneymanagerex.MMEX master

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

https://app.circleci.com/pipelines/github/whalley/circleci-test/143/workflows/88dd96a2-55dc-4c87-85a7-e56e642f0ca7/jobs/173

Just fails on the final artifact copy now. Do you know where the mmex*.flatpak can be found. It's not in that build directory.

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

So close now! You may have to try searching for it within the container, such adding this right after flatpak build-bundle:

pwd && find / -name 'mmex*.flatpak'

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

Looks like it installs and runs:

$ wget -q https://output.circle-artifacts.com/output/job/207d6cb1-2aa2-4959-9292-a43bb242f6ea/artifacts/0/tmp/artifacts/mmex.flatpak
$ flatpak install --user --assumeyes ./mmex.flatpak

org.moneymanagerex.MMEX permissions:
    ipc      network              fallback-x11      wayland      x11
    dri      file access [1]

    [1] /media, /mnt, /run/media, home


        ID                               Branch          Op          Remote              Download
 1. [✓] org.moneymanagerex.MMEX          master          i           mmex-origin         0 bytes

Installation complete.
$ flatpak info --user org.moneymanagerex.MMEX 

MMEX Money Manager - Organize finances and track cash flow

          ID: org.moneymanagerex.MMEX
         Ref: app/org.moneymanagerex.MMEX/x86_64/master
        Arch: x86_64
      Branch: master
     Version: 1.6.4
     License: GPL-2.0-only
      Origin: mmex-origin
  Collection: 
Installation: user
   Installed: 39.0 MB
     Runtime: org.gnome.Platform/x86_64/45
         Sdk: org.gnome.Sdk/x86_64/45

      Commit: 658eac2937c08a994a73b12be248c724e59b0eb3f21b630af36ad62c5e7349eb
     Subject: Export org.moneymanagerex.MMEX
        Date: 2023-10-18 15:02:41 +0000
$ flatpak run --user org.moneymanagerex.MMEX --help
Usage: mmex [-h] [-s] [-i <str>] [database file]
  -h, --help         	
  -s, --silent       	Do not show warning messages at startup.
  -i, --mmexini=<str>	where <str> is a path to mmexini.db3

To open a determined database(.mmb) file from a shortcut or command line, set the path to the database file as a parameter.

The file with the application settings mmexini.db3 can be used separately. Otherwise, it is taken from the home directory or the root folder of the application.

You can probably test the installation process by attempting to install the .flatpak bundle inside the container:

$ flatpak install --bundle --noninteractive ../mmex.flatpak
$ flatpak run org.moneymanagerex.MMEX --help

And then have a unique version string for the build artifact:

$ COMMIT_HASH="$(git rev-parse --short HEAD)"
$ MMEX_VERSION="$(flatpak info org.moneymanagerex.MMEX | grep Version | awk '{print $2}')"
$ cp $CIRCLE_WORKING_DIRECTORY/mmex*.flatpak /tmp/artifacts/mmex-${MMEX_VERSION}-${COMMIT_HASH}.flatpak

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

Unfortunately, the following CI run won't succeed because it needs flatpak install --bundle --noninteractive ../mmex.flatpak to be included as well since flatpak info org.moneymanagerex.MMEX only works with installed artifacts:

whalley/circleci-test@69ec908

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

Yes, just noticed. Will it work anyway as flatpack is only availabel in the container. Would we need to install flatpack in the VM or generate the correct version info in the container?

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

@whalley I think it would be best to try to install it within the container as part of the build for more complete coverage. VMs shouldn't be necessary either since the container already has flatpaks installed:

$ podman run -ti bilelmoussaoui/flatpak-github-actions:gnome-45 flatpak list
Name                                     Application ID                      Version Branch      Installation
Mesa                                     org.freedesktop.Platform.GL.default 23.1.8  23.08       system
Mesa (Extra)                             org.freedesktop.Platform.GL.default 23.1.8  23.08-extra system
openh264                                 org.freedesktop.Platform.openh264   2.1.0   2.2.0       system
GNOME Application Platform version 45    org.gnome.Platform                          45          system
GNOME Software Development Kit version ? org.gnome.Sdk                               45          system

Can you see if either of these lines work?

flatpak install --bundle --noninteractive ../mmex.flatpak
/usr/bin/xvfb-run --auto-servernum flatpak install --bundle --noninteractive ../mmex.flatpak

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

The first seems to work. How do you propose getting the build/commit into the filename? I guess you could rename the mmex.flatpack in the container prior to it being copied to the asset directory.

@joshua-stone
Copy link
Contributor

Maybe add something like this?

flatpak install --bundle --noninteractive ../mmex.flatpak && cp $CIRCLE_WORKING_DIRECTORY/mmex.flatpak /tmp/artifacts/mmex-$(flatpak info org.moneymanagerex.MMEX | grep Version | awk '{print $2}')-$(git rev-parse --short HEAD).flatpak

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

But I think the /tmp/artifacts is outside the container and not mounted as a visible filesystem. Was thinking more about just renaming as last action in container, but not sure git commit is visible there (though other builds do not include commit in name so not a deal breaker). That's what other Linux builds did in the past.

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

You could skip adding a git commit hash to the filename for now and instead make it a feature for a follow-up feature request for when we can refine the CI.

Can you see if this works?

flatpak install --bundle --noninteractive ../mmex.flatpak && mv ../mmex.flatpak ../mmex-$(flatpak info org.moneymanagerex.MMEX | grep Version | awk '{print $2}').flatpak

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

Guess we could rename to include the commit as part of the file copy to /tmp/artifacts outside the VM. Adding in the $(git rev-parse --short HEAD)

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

That sounds feasible. Maybe have it as part of a bulk-renaming step so that all artifacts (Windows, macOS, Linux, etc) match a certain format?

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

Don't think rename worked... Will have a look tommorow if it's a typo on my part.
https://app.circleci.com/pipelines/github/whalley/circleci-test/151/workflows/06fd6677-93ee-4606-be92-dedb5a9c061b/jobs/181/artifacts

@joshua-stone
Copy link
Contributor

TBH I think it'd be better to turn this into a script because all of these inline commands are hard to follow and not very flexible.

@joshua-stone
Copy link
Contributor

Can you see what running flatpak info org.moneymanagerex.MMEX by itself after installing the bundle returns?

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

Output is:


MMEX Money Manager - Organize finances and track cash flow

          ID: org.moneymanagerex.MMEX
         Ref: app/org.moneymanagerex.MMEX/x86_64/master
        Arch: x86_64
      Branch: master
     Version: 1.6.4
     License: GPL-2.0-only
      Origin: mmex-origin
  Collection: 
Installation: system
   Installed: 39.0?MB
     Runtime: org.gnome.Platform/x86_64/45
         Sdk: org.gnome.Sdk/x86_64/45

      Commit: fbbaf688cb0d123042803e65920c0f96a01ab57c5790ce93e2cc7972fd5107bc
     Subject: Export org.moneymanagerex.MMEX

Actually the version number you are using is wrong, you seem to be getting it from the latest published release and not from the versioning in CMakeLists.txt.

It should be "1.7.0-Beta.1"

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 18, 2023

Actually the version number you are using is wrong, you seem to be getting it from the latest published release and not from the versioning in CMakeLists.txt.

It should be "1.7.0-Beta.1"

It's actually correct insofar that it's using org.moneymanagerex.MMEX.metainfo.xml as a source of truth at install time. The only builds it's using are the ones that're generated by the CI build process, not the ones published on Flathub.

Even if you generated a file like mmex-1.7.0-Beta.1.flatpak, it would still show up as 1.6.4 when running flatpak info org.moneymanagerex.MMEX because that's the latest version described in the metainfo file. That's why you need to have a process of keeping these version strings in sync so we can avoid mismatches like whenever a new release is made:

https://github.com/moneymanagerex/moneymanagerex/commits/master/resources/dist/linux/share/metainfo/org.moneymanagerex.MMEX.metainfo.xml

@whalley
Copy link
Member Author

whalley commented Oct 18, 2023

Understood, but I feel we should be generating the org.moneymanagerex.MMEX.metainfo.xml file. It feels wrong and error prone to manually maintain this.

@joshua-stone
Copy link
Contributor

joshua-stone commented Oct 19, 2023

Understood, but I feel we should be generating the org.moneymanagerex.MMEX.metainfo.xml file. It feels wrong and error prone to manually maintain this.

Agreed. We can make this process easier by maintaining a NEWS file that combines with the metainfo file:

#6035 (comment)

It should also be trivial to have the buildsystem extract the version string with something like head -n1 NEWS.md | awk '{print $2}' instead of hardcoding it inside CMakeLists.txt.

@ovari
Copy link
Contributor

ovari commented Oct 19, 2023

Will beta versions still be downloadable at https://app.circleci.com/pipelines/github/moneymanagerex/moneymanagerex ?

@whalley
Copy link
Member Author

whalley commented Oct 19, 2023

Will beta versions still be downloadable at https://app.circleci.com/pipelines/github/moneymanagerex/moneymanagerex ?

Yes they will be, the intention is to have the flatpak available here.

@whalley
Copy link
Member Author

whalley commented Oct 19, 2023

I presume the correct version (1.7.0-Beta.1) is visible inside the About menu in MMEX when run? If so, then I suggest we go with the mmex.flatpak for now as the artifact name and look to resolve the full naming issue as part of resolution of #6035 (comment)

@joshua-stone
Copy link
Contributor

Yes, the correct version is set in the test build:

image

@whalley
Copy link
Member Author

whalley commented Oct 19, 2023

#6249

whalley added a commit that referenced this issue Oct 19, 2023
fix(#6246): CircleCI just builds flatpak now
@whalley whalley added linux related to Linux platforms fixed labels Oct 19, 2023
@whalley whalley added this to the v1.7.0 milestone Oct 19, 2023
@renato-mmex
Copy link

@whalley can you explain to me what is now the advantage of this solution?...
could this also work on an android tablet or on windows

@ovari
Copy link
Contributor

ovari commented Oct 19, 2023

can you explain to me what is now the advantage of this solution?

MMEX versions for GNU/Linux from Flathub will be listed the Update Manager so that users can more easily see and install the latest version.

Not sure whether or not the development versions will be available.

@renato-mmex
Copy link

@ovari This refers to Linux and on which distri does this work, all ?
I have on a PC Linux Mint, I will test tomorrow

@ovari
Copy link
Contributor

ovari commented Oct 19, 2023

@renato-mmex

This refers to Linux and on which distri does this work, all ?

  1. https://flatpak.org/setup/
  2. Click on the distro. For example, Linux Mint https://flatpak.org/setup/Linux%20Mint states:

Flatpak support is built into Linux Mint 18.3 and newer—no setup required!

Steps to install GNU/Linux development version of MMEX

  1. Backup MMEX database files
  2. Uninstall all versions of MMEX (deb/rpm and/or flatpak)
  3. Visit https://app.circleci.com/pipelines/github/moneymanagerex/moneymanagerex
  4. Click green button that states Success
  5. Click build-linux
  6. Click Artifacts
  7. Under Parallel Run heading, click tmp/artifacts/mmex.flatpak to download
  8. Open Terminal in directory where the mmex.flatpak file has been downloaded
  9. Type flatpak install mmex.flatpak
  10. Answer prompts until Installation complete.

@renato-mmex
Copy link

@ovari @whalley @joshua-stone
Installed MMEX on Linux Mint 21.1 as described above without any problems.
Thanks for the good description and good work everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature fixed linux related to Linux platforms
Projects
None yet
Development

No branches or pull requests

4 participants