trustification / trustify

Apache License 2.0
8 stars 15 forks source link

feat: using xz2 instead of rust-lzma #496

Closed helio-frota closed 1 week ago

helio-frota commented 1 week ago

To be able to update postgresql-embedded version in future

helio-frota commented 1 week ago

in advance... the code I'm less confident is the function pub fn xz_stream (that is called by other functions...) because I changed the function signature to return std::io::Error and doing that workaround Ok(Bytes::from(extracted_content)) to preserve Result<Bytes part.

but the tests are passing so ... :shrug:

helio-frota commented 1 week ago

I am not sure why this is required.

When trying to update postgresql-embedded to 0.13 this situation came up https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key

Primarily, Cargo requires that there is at most one package per links value. In other words, it is forbidden to have two packages link to the same native library.

as postgresql-embedded is using xz2 and we are using rust-lzma

helio-frota commented 1 week ago

If there's a good reason to upgrade, then maybe to liblzma, which has a recent release, is a fork of xz2 and seems to support newer versions.

Thanks for the extra info :+1:

When using liblzma we can see the same error, when updating postgresql-embedded

error: failed to select a version for `lzma-sys`.
    ... required by package `xz2 v0.1.7`
    ... which satisfies dependency `xz2 = "^0.1.7"` of package `postgresql_archive v0.13.0`
    ... which satisfies dependency `postgresql_archive = "^0.13.0"` of package `postgresql_embedded v0.13.0`
    ... which satisfies dependency `postgresql_embedded = "^0.13.0"` of package `trustify-trustd v0.1.0-alpha.10 (/home/heliofrota/Desktop/qqqqqq/trustify/trustd)`
versions that meet the requirements `^0.1.18` are: 0.1.20, 0.1.19

the package `lzma-sys` links to the native library `lzma`, but it conflicts with a previous package which links to `lzma` as well:
package `liblzma-sys v0.3.4`
    ... which satisfies dependency `liblzma-sys = "^0.3.4"` of package `liblzma v0.3.2`
    ... which satisfies dependency `liblzma = "^0.3.2"` of package `trustify-integration-tests v0.1.0-alpha.10 (/home/heliofrota/Desktop/qqqqqq/trustify/integration-tests)`
ctron commented 1 week ago

That's a mess. Maybe there's a way to have postgresql-embedded without xz support? Via a feature?

helio-frota commented 1 week ago

Maybe there's a way to have postgresql-embedded without xz support? Via a feature?

Apparently currently no. https://github.com/theseus-rs/postgresql-embedded/tree/0e317fb192db3f8b9e5e7e71cb3779a58e7deb4d/postgresql_archive#feature-flags

But maybe we could ask for the author to create that optional ?

This is being used here https://github.com/theseus-rs/postgresql-embedded/blob/0e317fb192db3f8b9e5e7e71cb3779a58e7deb4d/postgresql_archive/src/configuration/zonky/extractor.rs#L12

Apparently a new thing in case users want to use for tests https://github.com/zonkyio/embedded-postgres-binaries

ctron commented 1 week ago

But maybe we could ask for the author to create that optional ?

I think that makes sense. From what I saw, that change was only 3 days ago.

helio-frota commented 1 week ago

closing!

https://github.com/theseus-rs/postgresql-embedded/issues/98#issuecomment-2206912376