drahnr / oregano

Schematic capture and circuit simulator
https://ahoi.io
GNU General Public License v2.0
214 stars 39 forks source link

add flatpak packaging #245

Closed tinywrkb closed 3 years ago

tinywrkb commented 4 years ago

Flatpak packaging with spice3, ngspice, and gnucap.

Known issues:

How to build:

This example use FPB_WRKDIR as our flatpak builder workdir. It sets drahnr as the Flatpak branch so it won't conflict with Flathub's stable branch if the app was also installed from Flathub.

$ export FPB_WRKDIR=/somewhere_work_dir_for_flatpak-builder $ export FP_BRANCH=drahnr $ flatpak-builder --install --ccache --user --force-clean \ --default-branch=$FP_BRANCH \ --state-dir=$FPB_WRKDIR/flatpak-builder \ --repo=$FPB_WRKDIR/flatpak-repo \ $FPB_WRKDIR/flatpak-target \ com.github.drahnr.Oregano.yaml

Repackage the built app as a Flatpak bundle:

$ flatpak build-bundle $FPB_WRKDIR/flatpak-repo Oregano.flatpak com.github.drahnr.Oregano $FP_BRANCH

Install the Flatpak bundle:

$ flatpak install --user Oregano.flatpak

drahnr commented 4 years ago

I did not forget about this :) just a lack of time to dig into the details of flatpack pkg to verify for the last few weeks

tinywrkb commented 4 years ago

No problem, that's to be expected, it's a new environment to work with.
Note that the developers on the #flatpak Freenode IRC channel are very friendly and helpful so you should check it out if you need further guidance.

drahnr commented 3 years ago

Sorry for the long delay. I finally had a look into it, but I have seen quite a few urls to archives to various once good, now shady places (i.e. sourceforge ) so I see two options:

Either including archives of all dependencies to make this reproducible from this repo and this repo only. Or moving to flatpack based dependencies so all of the dependencies are based on flathub (so if that obsoletes then the flapacks itself will be most likely obsolete as well).

Sorry for the long delay, thanks for this PR and I'd understand if you moved on - my focus is already elsewhere :sweat: and I will archive this repo in a week or two so this would be a good last addition.

drahnr commented 3 years ago
flatpak --user remote-add --from flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install flathub org.gnome.Platform//3.36 org.gnome.Sdk//3.36

must be called before the above can work as well.

tinywrkb commented 3 years ago

If the project is not being developed anymore then I don't mind sending PR to Fluthub so it would archive its last release.

drahnr commented 3 years ago

Not quite sure what that would entail effort wise, I'd be happy to assist or grant you permissions as needed.

tinywrkb commented 3 years ago

I don't think there's much to do, maybe write a proper metainfo file. I'll look at this a bit later.

It would help if you could test the packaged app to confirm nothing is seriously broken. We can do this after the PR is sent to Flathub and before merging it or I can upload a Flatpak bundle for you to install.

If we publish to Flathub then I don't see a reason to keep this PR open. Should I close it?

tinywrkb commented 3 years ago

p.s. I'm not a fan of Flatpak bundles but I guess you could also add a bundle as a download asset to the latest tagged release before archiving the repo.

drahnr commented 3 years ago

I would prefer to add this as a last step to the release pipeline so it's documented as code as part of the repository.

Could you extend either the PR or comment on how to extract a bundle from this branch? I can then test it quickly tonight.

Thanks a lot!

tinywrkb commented 3 years ago

I updated PR and also the first post here. Details about building and creating a bundle are in the first post and the commit message.

A minor issue is that no icon is associated with .oregano files. I tried to solve it with mimetypes patch commit but I couldn't confirm it's working. I'm not running a full desktop environment and this may be affected my test.

tinywrkb commented 3 years ago

Note that I didn't update ngspice as the recent release is failing to build. I didn't really try to figure out why.

drahnr commented 3 years ago

Thanks a lot, planning to integrate this tonight.

tinywrkb commented 3 years ago

The last thing I forgot to do is to remove the pkgconfig files. So I'm pushing this change now.

drahnr commented 3 years ago

quay.io had an outage last night, which put an early end to the effort last night :facepalm: to be continue tonight

drahnr commented 3 years ago

Last stumbling stone - the ngspice-32 tar is not available:

[tree]# flatpak-builder --install --user --default-branch=drahnr --state-dir=/tmp/build/51814a75/tree/../workdir/flatpak-builder --repo=/tmp/build/51814a75/tree/../workdir/flatpak-repo /tmp/build/51814a75/tree/../workdir/flatpak-target ./flatpak/com.github.drahnr.oregano.yaml

(flatpak-builder:202): Json-WARNING **: 09:32:04.914: Failed to deserialize "modules" property of type "gpointer" for an object of type "BuilderModule"
Downloading sources
Downloading https://downloads.sourceforge.net/project/ngspice/ng-spice-rework/32/ngspice-32.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Failed to download sources: module ngspice: The requested URL returned error: 404 
drahnr commented 3 years ago

I did the CI integration in #249 which includes a cherry-pick of your commits.

tinywrkb commented 3 years ago

ngspice's URL in my commit is https://downloads.sourceforge.net/project/ngspice/ng-spice-rework/old-releases/32/ngspice-32.tar.gz not the one you mentioned.
The project maintainer seems to like breaking release URLs, so probably it would be good idea to switch to git and checkout the tagged release.
Another unusual thing with ngspice is that the tarball has no minor version while it seems to be the 32.2 tagged release. Also, how do you have a 32.2 tagged release without 32.1?

I updated the PR to ngspice source to git, it builds fine on my system. Note that in the source properties I'm using both tag and commit so a changed tagged release will be caught by the build system.

drahnr commented 3 years ago

I would not bother looking for reason for a project that still uses add riddled sourceforge for hosting.

Your changes are incorported in master / #250 so I would be delighted if you could double check that again.

Closing this, let's continue in #250 /