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

Add packaging support for FlatPack #23

Open
fruffy opened this issue Oct 5, 2024 · 9 comments
Open

Add packaging support for FlatPack #23

fruffy opened this issue Oct 5, 2024 · 9 comments
Labels
build-testing-ci mediumtask A task that appears to require a medium level of work

Comments

@fruffy
Copy link
Collaborator

fruffy commented Oct 5, 2024

Similar to NixOS FlatPack is a convenient method to install debian packages.

There are actions available to automate this process. We should add flatpack support for the compiler and P4C:
https://github.com/flatpak/flatpak-github-actions

@fruffy fruffy added the mediumtask A task that appears to require a medium level of work label Oct 5, 2024
@Vineet1101
Copy link

hey @fruffy @jafingerhut can you describe more about this feature

@jafingerhut
Copy link
Collaborator

I believe it is referring to FlatPak, described more here: https://flatpak.org

@Vineet1101
Copy link

@jafingerhut I think it can be done. It required installing the flatpack and writing some code using github actions. Do you want me to proceed with it

@jafingerhut
Copy link
Collaborator

It sounds interesting to me. Note that the best way I'd have of reiewing the changes (not having used FlatPak before myself) would be testing out the resulting files, installing them, and running some sample p4c commands after installing them. So instructions for using the resulting FlatPak installation files would be needed, too.

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 1, 2025

To explain a litte: A big problem we have with our infrastructure nowadays is that it is not very unified and it is complicated to set up the open-source software. @jafingerhut maintains complicated VM scripts which are useful for a developer, but overwhelming for a beginner. Ideally, we should be able to provide a simple P4 environment using existing package managers.

The concrete goal here is that we are able to run the code in https://github.com/p4lang/tutorials with a simple flatpack installation. We should be able to provide all the necessary Python packages, the compiler, and dependencies in an independent environment.

This project is also helpful to understand what deficiencies our current setup might have and what we need to fix to make it more user-friendly.

@Vineet1101
Copy link

hey @jafingerhut I am working on this feature.

  1. I installed flatpak and all other dependencies that are required
  2. I prepared the flatpak json file which is required to download all the pkgs ,python etc.
    Here is the code for the json file
    { "id": "org.p4lang.P4Tutorials", "runtime": "org.freedesktop.Sdk", "runtime-version": "23.08", "sdk": "org.freedesktop.Sdk", "command": "bash", "modules": [ { "name": "p4c", "buildsystem": "cmake", "config-opts": [ "-DCMAKE_BUILD_TYPE=Release", "-DENABLE_TESTS=OFF", "-DP4C_BUILD_GTEST=OFF", "-DP4C_DISABLE_GTEST=ON" ], "sources": [ { "type": "git", "url": "https://github.com/p4lang/p4c.git", "branch": "main" } ] }, { "name": "bmv2", "buildsystem": "meson", "sources": [ { "type": "git", "url": "https://github.com/p4lang/behavioral-model.git", "branch": "main" } ] }, { "name": "mininet", "buildsystem": "simple", "build-commands": [ "pip3 install git+https://github.com/mininet/mininet.git" ] }, { "name": "python-packages", "buildsystem": "simple", "build-commands": [ "pip3 install scapy networkx grpcio protobuf" ] } ] }
    Then to execute this json file I am using flatpak-builder --user --install --force-clean build-dir p4_flatpak_manifest.json but issue I am facing is that p4 required google test but flatpak is unable to install google test I even tried to disable the google test installation for now but still some things internally required google test.
    Do you any solution for this

@jafingerhut
Copy link
Collaborator

So I am not very knowledgeable of FlatPak's typical use here.

@fruffy Is your thinking that the rough "flow" here is one of the following, and if so, which one?

(a) First build one or more of the open source P4 development tools, e.g. p4c, behavioral-model, supporting Python packages, etc. When that is complete, create a FlatPak "thing" that contains some binary executables and other files required to run them, e.g. installed Python packages and perhaps some shared library .so files, but once the FlatPak "thing" has been created, it can be copied and installed on a user's system without having to do any further compilation runs or Python package installations. In other words, this is more like downloading a tar, rpm, or deb file and installing it.

(b) The FlatPak "thing", when you donwload and install it, will contain scripts/programs that download and install the source code of p4c, behavioral-model, etc., and build them on the user's system. In other words, this is like downloading an install script, and it could take a lot of additional downloading and computation work on the user's system before they have a working P4 development system.

I was guessing that a FlatPak "thing" is more like (a) than (b). Maybe there are other points on the spectrum that I'm not describing.

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 2, 2025

The use is more on the (A) side. What throws a wrench into this is Python and the chaotic environment it has. FlatPack does seem to have support for Python environments but I have not checked deeply how it could work with the tutorials.

This is also why this task is labelled "medium", because it does require a bit of work.

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 2, 2025

It could also be good enough to just get the C++ binaries working and manage our Python dependencies separately. That would be two steps but also much easier than before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-testing-ci mediumtask A task that appears to require a medium level of work
Projects
None yet
Development

No branches or pull requests

3 participants