marco-calautti / DeltaPatcher

Delta Patcher is a GUI software that is able to create and apply xdelta patches.
GNU General Public License v2.0
265 stars 30 forks source link

Flatpak #39

Closed JakobDev closed 5 months ago

JakobDev commented 8 months ago

I created a Flatpak for DeltaPatcher. This allows easier installing on evry Linux Distro. Here is the Manifest:

id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=host
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    post-install:
      - install -Dm755 app/DeltaPatcher $FLATPAK_DEST/bin/DeltaPatcher
    sources:
      - type: git
        url: https://github.com/marco-calautti/DeltaPatcher.git

I shows a error but it works without any problems. It needs a few things before it can be fully released. tell me, if you are interested.

marco-calautti commented 8 months ago

That would be actually nice to have. I guess you need to add a .desktop file with the icon, and such. You can find the icons at different resolutions in the "graphics" directory in the repo. My only concern is support to the system theme. Delta Patcher supports light and dark modes, depending on the system settings. The flatpak should be configured properly so that Delta Patcher is able to use the right theme. Feel free to submit a pull request!

marco-calautti commented 8 months ago

Another thing I am not sure how will workout in Flatpak is the lack of portals. Delta Patcher does not make explicit use of portals, and so I am wondering how it can access files from the file system. I guess you need to specify the right filesystem permissions in the manifest (which are currently doing), but using "host" as filesystem permissions is maybe overkill. I guess "home" is a better option for Delta Patcher.

JakobDev commented 8 months ago

I have now created #40 for the data files.

My only concern is support to the system theme. Delta Patcher supports light and dark modes, depending on the system settings.

Looks like this is already supported by wxWidgets.

Another thing I am not sure how will workout in Flatpak is the lack of portals.

Gtk has GtkFileChooserNative, which uses the Portals. I don't know much abou wxWidgets, but maybe you can use this function in the Gtk Backend.

You also need to fix this error, which appers on startup. grafik

marco-calautti commented 8 months ago

The error you mention is due to the fact you are compiling wxwidgets in debug mode. Please use the cmake flags as specified in the readme for Linux.

marco-calautti commented 8 months ago

Of you are using the system's wxwidgets lib, then you will also get that error, as all binaroes of wxwidgets I am aware of in repositories are all compiled with assertions ON

JakobDev commented 8 months ago

When using DCMAKE_BUILD_TYPE=RelWithDebInfo the message no longer appears, but you should fix the underlying bug.

marco-calautti commented 8 months ago

I have just pushed a pull request that fixes the warnings. They should not appear anymore. Anyway, I think building in Release mode is still preferred, as this avoids wxWidgets countinuously calling its asserts, "slowing down" things.

JakobDev commented 8 months ago

Anyway, I think building in Release mode is still preferred

It is usual to build a Flatpak with debug symbols, but you can change this if you really want it.

The only missing thing is now to use the Portals. If you don't know how to use Portals in wxWidgets, you can use zenity, whcih is preinstalled in the Flatpak Runtime. Just run zenity --file-selection to open a file dialog. You can use the --file-filter argument to add a filter.

Here is the current version of the Manifest:

id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=host
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    config-opts:
      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
      - -DwxBUILD_SHARED=OFF
    sources:
      - type: dir
        path: /path/to/source

Just set the path to the source directory of DeltaPatcher.

marco-calautti commented 8 months ago

I tried the manifest on my local machine, and portals are not required, assuming we give filesystem access (actually, Delta Patcher only requires home). I slightly modified the manifest to also allow the flatpak to have access to the current system gtk theme:


id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=home
  - --filesystem=xdg-config/gtk-3.0:ro
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    config-opts:
      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
      - -DwxBUILD_SHARED=OFF
    sources:
      - type: dir
        path: /path/to/source
marco-calautti commented 8 months ago

I will now create a new tag for the new version, and I guess you can submit the flatpak manifest to flathub referencing the new tag.

marco-calautti commented 8 months ago

https://github.com/marco-calautti/DeltaPatcher/releases/tag/v3.1.3

JakobDev commented 8 months ago

portals are not required, assuming we give filesystem access

I don't said that it is not working with filesystem access. That's the reason my Manifest has Host access, but it would be better if Portals were used instead of this Permission.

(actually, Delta Patcher only requires home)

I would rather give host access. With home access Users can't open any files on external drives. Full home access aleady allows breaking the Sandbox, as you can edit e.g. .bashrc or startup files, so host access is not more insecure.

and I guess you can submit the flatpak manifest to flathub referencing the new tag.

Yes. Use this as you source:

- type: git
  url: https://github.com/marco-calautti/DeltaPatcher.git
  tag: 'v3.1.3'
  commit: 46011a90aade9c178020d9d5c96817b33c7b33c3
  x-checker-data:
    type: git
JakobDev commented 8 months ago

I discovered a little misstake in my Manifest instead of:

- --device=dri
- --device=dri

use

- --device=dri
- --share=ipc
marco-calautti commented 8 months ago

I fear portals would not be enough for Delta Patcher, as it also requires to write and rename additional files in a non interactive way when patching a file (e.g., creating a backup of the original file).

JakobDev commented 8 months ago

Portals give only access to the selected file, so in this case Portals would not work for you.

JakobDev commented 8 months ago

Is there anything blocking you from publish on Flathub?

marco-calautti commented 8 months ago

Mostly my daily job. I plan to release it in one of the upcoming weekends.

JakobDev commented 8 months ago

OK. I was just wondering.

marco-calautti commented 5 months ago

@JakobDev https://github.com/flathub/flathub/pull/5093

marco-calautti commented 5 months ago

It is now on flathub https://flathub.org/it/apps/io.github.marco_calautti.DeltaPatcher closing

JakobDev commented 5 months ago

You should verify it. Just login with your GitHub on Flathub and you can verify it in the developer settings.

marco-calautti commented 5 months ago

I did login but it seems there are some checks that failed. I requested a review.

marco-calautti commented 5 months ago

Ok, now it is verified.