-
Notifications
You must be signed in to change notification settings - Fork 16
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
Build p4runtime protobufs #328
Conversation
I changed the mechanics of the build so the protobufs build is done on demand, instead of being part of the regular build. To build just the protobufs: cmake --build build --target protobufs This keeps the change from affecting developers who don't have Go (and a couple of additional packages) installed on their system. This includes the GitHub runners, which is how I discovered the problem. As you can see from the number of commits I made, this was a tricky problem to solve. 🙂 |
I've added a README with build instructions. |
Signed-off-by: Derek G Foster <[email protected]>
- Rename HOST_PROTOC to HOST_PROTOC_COMMAND. - Revise C++ gRPC file generation to limit itself to p4runtime.proto. None of the other protobuf files define services. Signed-off-by: Derek G Foster <[email protected]>
- Put all the cmake files in the same folder. Signed-off-by: Derek G Foster <[email protected]>
- Modularize by package (google, p4runtime) instead of by language (cpp, go, python). Create one target per (package, language) combination, and replace the tricksy path-manipulation logic with discrete lists of files. - Generate an empty __init__.py file in each Python directory, making the output Python modules. Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
- Move the include() commands after project(), to address an error raised by the GitHub workflow. - Add support for building a Python wheel. Currently under development. Controlled by the ENABLE_WHEEL option. - Go compiles are failing in the GitHub workflow. Placed them under control of the ENABLE_GO option, so they can be disabled until the issue is solved. Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
- The GO_ENABLED option was disabled when building through the external project in the main listfile, despite having been set to TRUE when the option was defined. On inspection, it turned out that ALL the options were FALSE. cmake apparently does not apply the defaults when the build is done as an external project. Changed them to ordinary cache variables, and voila! All is right with the world. Pfui. - Modify the GitHub workflow to upload the protobuf tarballs as artifacts. - Modify .gitignore to ignore `build` and `install` directories anywhere in the tree, not just the root. - Rename the install directory from `proto` to `protobufs`. Signed-off-by: Derek G Foster <[email protected]>
- Try fixing the problem by moving `working-directory` after the `with` stanza. Signed-off-by: Derek G Foster <[email protected]>
- The previous fix didn't work. Try changing the path. Signed-off-by: Derek G Foster <[email protected]>
- Correct BYPRODUCT names in tarball custom targets. - Improve method used to generate __init__.py files. - Use COPY instead of INSTALL to copy collateral files to wheel directory. - Install Python packages under share/stratum/python. Signed-off-by: Derek G Foster <[email protected]>
- Set package version to 2023.11.0. - Update install requirements to track stratum-deps component versions. Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
- Modify GitHub workflow to install just the Python dependencies needed to build the P4Runtime protobufs. - Remove invalid 'fcntl' module from requirements.txt file. Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
The more I think about it, the more I wonder whether this should be part of networking-recipe at all. It's really an adjunct to The choices would seem to be:
In both cases, we would need to update ipu_sdk to build the wheel and install it in the RFS image. We would also have to consider how and whether to incorporate the wheel into networking-recipe build. Oy. |
- Extract logic to find the host Protobuf compiler and plugins from StratumDependencies.cmake and move it to a new HostProtoc find-module. StratumDependencies is now strictly for the target system. Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
Signed-off-by: Derek G Foster <[email protected]>
requirements.txt
Outdated
@@ -1,4 +1,6 @@ | |||
p4runtime==1.3.0 | |||
Jinja2>=3.0.0 | |||
fcntl | |||
select |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select
needs to be removed as per #345
Signed-off-by: Derek G Foster <[email protected]>
@@ -0,0 +1,25 @@ | |||
[metadata] | |||
name = p4runtime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be called p4runtime-dev
or even ipdk-io-p4runtime-dev
to differentiate from upstream p4runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're currently differentiating our variant by using a distinctly different versioning scheme (YYYY-MM-N).
I think we want to use the same name as the existing module, so people don't have to change their programs to import something different.
Which is not to say that injecting ipdk-io
into a name to distinguish it is a bad idea. I may steal it at the next appropriate opportunity... 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflicts and DCO needs to be resolved. Rest LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Derek G Foster <[email protected]>
A cmake project that compiles the
google rpc
andp4runtime
protobufs, generating serialization and gRPC service code for C++, Python, and Go. The outputs are:share/stratum/protobufs
folder.share/stratum/p4runtime
folder.This is in response to multiple requests that we supply a Python package, and one recent request to provide a Go package.