scylladb / cpp-rust-driver

API-compatible rewrite of https://github.com/scylladb/cpp-driver as a wrapper for Rust driver.
GNU Lesser General Public License v2.1
11 stars 11 forks source link

Add DEB/RPM packaging #121

Closed avelanarius closed 1 month ago

avelanarius commented 8 months ago

The project should produce a DEB/RPM package that can be installed. The package should be similar to the one in https://github.com/scylladb/cpp-driver.

syuu1228 commented 3 months ago

@avelanarius Hi, I'm trying to get cpp-rust-driver able to build rpm/deb since I assigned to scylladb/scylla-pkg#3714, but it seems to RPM tools for Rust requires register your rust package at crates.io. (reference: https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_rust_crates)

Could you publish the package to the site?

syuu1228 commented 3 months ago

Seems like deb package is same, it also tries to generate package from crates.io: https://github.com/ahdinosaur/debcargo

Lorak-mmk commented 3 months ago

I don't think we should be using those tools. Yes, big part of the code in this repository is written in Rust, but this is a C++ library, not a Rust library. It produces a shared library (.so) and should be packaged like a C++-library. It is not intended to be used by Rust code, and so it doesn't make any sense to put it on crates.io.

You can take inspiration in the packaging of original cpp-driver: https://github.com/scylladb/cpp-driver/tree/master/packaging

syuu1228 commented 3 months ago

I don't think we should be using those tools. Yes, big part of the code in this repository is written in Rust, but this is a C++ library, not a Rust library. It produces a shared library (.so) and should be packaged like a C++-library. It is not intended to be used by Rust code, and so it doesn't make any sense to put it on crates.io.

You can take inspiration in the packaging of original cpp-driver: https://github.com/scylladb/cpp-driver/tree/master/packaging

Okay. But after I did investigation how to build the shared library on this repository, it is actually built by Cargo, CMake is just invoking Cargo command. In this case we actually need to implement the rpm package as Rust based package. I initially tried to follow Rust packaging guideline on Fedora. But I found that it's difficult, since many dependencies on Rust are not available on Fedora repository, and if we follow the guideline we have to implement rpm for all of them.

So I decided not to follow the guideline, and found a way to apply Rust build paramaters from rpm macro to my custom .spec file. Now it's working, I able to produce Rocky 8, Fedora 39-41 rpms. Working repo is here: https://github.com/syuu1228/cpp-rust-driver/tree/rpm_deb_packaging_work I will send PR after I implemented deb packaging.

BTW, I have question. I did not needed C++ code (src/, examples/, tests/) to build a shared library, do we really using these codes? Maybe still using for testcases?

roydahan commented 3 months ago

BTW, I have question. I did not needed C++ code (src/, examples/, tests/) to build a shared library, do we really using these codes? Maybe still using for testcases?

@avelanarius ?