-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support rpm and deb packaging #122
Conversation
Just to be clear, the failing clippy check has nothing to do with this change - we are using the newest version of the It would probably be nice to fix them first to have green CI, but I personally don't think it's required. Opened an issue about it: #123 |
I've successfully packaged the driver into RPM and installed it on my Fedora 39. Congratulations, @syuu1228! 🚀 |
@syuu1228 where are we standing with this one? |
0e977f3
to
6a174f8
Compare
Fixed codes mentioned on comments, also bash coding style fixed (by following ShellCheck rules) |
6a174f8
to
5036de6
Compare
Just realized that generating pkgconfig files on deb was not implemented yet, fixed. |
We would really want to merge and release 0.1.0 by the end of next week. |
Version: @version@ | ||
Libs: -L${libdir} -lscylla_cpp_driver | ||
Cflags: -I${includedir}/scylladb | ||
URL: https://github.com/scylladb/cpp-rust-driver |
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.
Do we need to add a license line here as well?
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.
ping @syuu1228
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.
Well, I don't find license directive on pkg-config manual, what does it means?
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.
I've built the rpm package and compared it to our cpp-driver rpm package (https://github.com/scylladb/cpp-driver/releases/download/2.16.2b/scylla-cpp-driver-2.16.2b-1.el7.x86_64.rpm ). I have few questions (sorry if those are obvious, I don't have much experience in packaging).
cpp-driver provides the following files:
/usr/lib64/libscylla-cpp-driver.so
/usr/lib64/libscylla-cpp-driver.so.2
/usr/lib64/libscylla-cpp-driver.so.2.16.2-b
/usr/share/doc/scylla-cpp-driver-2.16.2b
/usr/share/doc/scylla-cpp-driver-2.16.2b/LICENSE.txt
/usr/share/doc/scylla-cpp-driver-2.16.2b/README.md
while cpp-rust-driver provides:
/usr/lib/.build-id
/usr/lib/.build-id/8a
/usr/lib/.build-id/8a/ad7ba567e0fd997cb3aa7c1819083466bfa71e
/usr/lib64/libscylla_cpp_driver.so
/usr/share/doc/scylla-cpp-rust-driver
/usr/share/doc/scylla-cpp-rust-driver/LICENSE
/usr/share/doc/scylla-cpp-rust-driver/README.md
- What is the
.build-id
folder? - Why do we only have .so without version number in the name? cpp-driver provides, as you can see,
.so.<major-version>
and.so.<full-version>
, which are symlinks to main.so
. Why is that? - cpp-rust-driver has dashes in .so name while cpp-driver has underscores. Is it going to be a problem for a user looking for a drop-in replacement?
One more thing: apart from the commit with packaging there are 2 more commits. First one claims to update Rust Driver to newest version, but updates it to a commit from August of last year. Unless those 2 commits are necessary (and I don't see why would they be) please stick to the main goal of this PR which is packaging and drop those 2 commits. We'll update Rust Driver in a separate PR.
@Lorak-mmk These two commits are both mine, and they are already merged to master; I have no idea why they are displayed here. |
Rebasing a PR on master will probably fix this |
Good catch! That's probably a very important question. |
f552e9c
to
1d7b516
Compare
0d245b4
to
788f9f9
Compare
I found that versioning.sh will causes To avoid the error, stop calling |
|
||
To build deb package, run the following command: | ||
```shell | ||
./dist/redhat/build_deb.sh --target mantic |
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.
redhat
-> debian
Oh, that's right. In my initial comment about it I posted correct file lists and then mistakenly wrote "cpp-rust-driver has dashes in .so name while cpp-driver has underscores" while it was the other way around.
Another small issue: after building the package with
I don't see this folder in .deb packages. Is this expected? Another question, hopefully last one: In dev packages (both rpm and deb) I don't see versioned SOs ( |
ede74e8
to
1b96858
Compare
Add a workaround patch for Ubuntu 24.04 build, since Ubuntu 24.04 version of patchelf breaks libscylla-cpp-driver.so for some reason (probably a bug on patchelf). The error message is like this:
This can be avoid by using Ubuntu 23.10's patchelf, the patch do that in versioning.sh. |
Sorry I forgot to describe what is this. Debian Policy Manual says: Seems like cpp-driver packaging libscylla-cpp-driver.so in main package, but unless the difference causes compatibility problem, I think we should keep current packaging since it looks correct. |
I think this is same topic as I described above, -dev package will contain libXXX.so, and main package will contain libXXX.so.1.2.3 and libXXX.so.1. |
Ok, so the cpp-driver is in the wrong here IIUC. |
1b96858
to
bd1782e
Compare
I just found that we actually can fix SONAME using RUSTFLAGS, even we build Rust in Cargo: |
bd1782e
to
06ceaab
Compare
Pushed new version to add |
if [ -z $RUSTFLAGS ]; then | ||
RUSTFLAGS="-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn" | ||
fi |
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.
Either I didn't notice it before or it wasn't here before. All those parameters (apart from --cap-lints=warn
and -Cforce-frame-pointers=yes
) are set in packaging profile in Cargo.toml, why set them again here?
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.
This is new thing, added at #122 (comment)
Since I intended to apply RedHat's default RUSTFLAGS to build because it can be safer to build rpm, and manually set RUSTFLAGS only on older versions of RedHat, and the parameters are taken from /usr/lib/rpm/macros.
But yes, we aleady have these parameters to Cargo.toml, maybe we shouldn't use distro default RUSTFLAGS at all.
To avoid applying these duplicated parameters, we probably should not use distro default RUSTFLAGS and force apply RUSTFLAGS like this (without [ -z $RUSTFLAGS ]
condition since we want overwrite):
RUSTFLAGS="-Cforce-frame-pointers=yes --cap-lints=warn"
dist/debian/debian/rules
Outdated
SCYLLA_VERSION := $(shell cat version | awk -F'-' '{print $1}' | sed 's/-/~/') | ||
|
||
VERSION_MAJOR := $(shell sed -n -e 's/^#define CASS_VERSION_MAJOR \(.*\)/\1/p' include/cassandra.h) | ||
RUSTFLAGS := -C debuginfo=2 --cap-lints warn -C linker=x86_64-linux-gnu-gcc -C link-arg=-Wl,-Bsymbolic-functions -C link-arg=-Wl,-z,relro -Clink-arg=-Wl,-soname=libscylla-cpp-driver.so.$(VERSION_MAJOR) |
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.
Same here, -C debuginfo=2
probably shouldn't be set here
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.
The reason why these parameters are applying duplicated parameters is same, this RUSTFLAGS is taken from Debian package build system.
After dropping duplicated parameters like above, it will be:
RUSTFLAGS := --cap-lints warn -C linker=x86_64-linux-gnu-gcc -C link-arg=-Wl,-Bsymbolic-functions -C link-arg=-Wl,-z,relro -Clink-arg=-Wl,-soname=libscylla-cpp-driver.so.$(VERSION_MAJOR)
Add build_rpm.sh and build_deb.sh build scripts to produce rpm & deb package. closes scylladb/scylla-pkg#3714 closes scylladb#121 Signed-off-by: Takuya ASADA <syuu@scylladb.com>
06ceaab
to
58f1408
Compare
@Lorak-mmk Pushed new version to change RUSTFLAGS on both rpm & deb. |
@syuu1228 can you please check why CI fails? |
On Ubuntu, we need to run "apt-get update" prior to "apt-get install", otherwise it does not gurantee the package database is up to date. If we don't do that, "apt-get install" with outdated database may cause error something like: Err:9 mirror+file:/etc/apt/apt-mirrors.txt jammy-updates/main amd64 libc6-dbg amd64 2.35-0ubuntu3.7 404 Not Found [IP: 52.252.75.106 80] E: Failed to fetch mirror+file:/etc/apt/apt-mirrors.txt/pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3.7_amd64.deb 404 Not Found [IP: 52.252.75.106 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? Fetched 504 kB in 0s (1279 kB/s) To fix this, add "apt-get update" on the begging of "Setup environment". Related scylladb#122
On Ubuntu, we need to run "apt-get update" prior to "apt-get install", otherwise it does not gurantee the package database is up to date. If we don't do that, "apt-get install" with outdated database may cause error something like: Err:9 mirror+file:/etc/apt/apt-mirrors.txt jammy-updates/main amd64 libc6-dbg amd64 2.35-0ubuntu3.7 404 Not Found [IP: 52.252.75.106 80] E: Failed to fetch mirror+file:/etc/apt/apt-mirrors.txt/pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3.7_amd64.deb 404 Not Found [IP: 52.252.75.106 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? Fetched 504 kB in 0s (1279 kB/s) To fix this, add "apt-get update" on the begging of scripts. Related scylladb#122
On Ubuntu, we need to run "apt-get update" prior to "apt-get install", otherwise it does not gurantee the package database is up to date. If we don't do that, "apt-get install" with outdated database may cause error something like: Err:9 mirror+file:/etc/apt/apt-mirrors.txt jammy-updates/main amd64 libc6-dbg amd64 2.35-0ubuntu3.7 404 Not Found [IP: 52.252.75.106 80] E: Failed to fetch mirror+file:/etc/apt/apt-mirrors.txt/pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3.7_amd64.deb 404 Not Found [IP: 52.252.75.106 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? Fetched 504 kB in 0s (1279 kB/s) To fix this, add "apt-get update" on the begging of "Setup environment". Related scylladb#122
On Ubuntu, we need to run "apt-get update" prior to "apt-get install", otherwise it does not gurantee the package database is up to date. If we don't do that, "apt-get install" with outdated database may cause error something like: Err:9 mirror+file:/etc/apt/apt-mirrors.txt jammy-updates/main amd64 libc6-dbg amd64 2.35-0ubuntu3.7 404 Not Found [IP: 52.252.75.106 80] E: Failed to fetch mirror+file:/etc/apt/apt-mirrors.txt/pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3.7_amd64.deb 404 Not Found [IP: 52.252.75.106 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? Fetched 504 kB in 0s (1279 kB/s) To fix this, add "apt-get update" on the begging of "Setup environment". Related #122
@wprzytula would you want the honor to merge? |
Gladly! |
Add build_rpm.sh and build_deb.sh build scripts to produce rpm & deb package.
closes scylladb/scylla-pkg#3714
closes #121