Firstyear / obs-service-cargo

OBS Source Service and utilities for Rust software packaging
Mozilla Public License 2.0
16 stars 9 forks source link

wrong package version is vendored #20

Closed matwey closed 2 years ago

matwey commented 2 years ago

Hi,

I am running obs-service-cargo_vendor-0.4.3~5-1.1.noarch (openSUSE Tumbleweed). I am tring to package this https://github.com/influxdata/flux/tree/v0.170.1 project, as the following:

        <service name="cargo_vendor" mode="disabled">
                <param name="srcdir">flux/libflux</param>
        </service>

And see the following:

[   27s] error: failed to select a version for the requirement `anyhow = "^1.0.56"` (locked to 1.0.56)
[   27s] candidate versions found which didn't match: 1.0.57
[   27s] location searched: directory source `/home/abuild/rpmbuild/BUILD/flux-0.170.1/vendor` (which is replacing registry `crates-io`)
[   27s] required by package `flux-core v0.154.0 (/home/abuild/rpmbuild/BUILD/flux-0.170.1/libflux/flux-core)`

I suppose this is due to controversial version requirements. libflux crate consists of two members: flux requiring anyhow = "1", and flux-core requiring anyhow = "1.0.56".

Can you reproduce this issue?

Firstyear commented 2 years ago

That would be a problem in the crate itself, not a problem in cargo vendor as a service here.

Try checking out the flux project and doing "cargo update; cargo build".

matwey commented 2 years ago

cargo build works fine.

matwey commented 2 years ago

It says:

   Compiling anyhow v1.0.56

and as far as I understand 1.0.56 also satisfies requirement 1.

Firstyear commented 2 years ago

What OBS project are you seeing this in?

matwey commented 2 years ago

https://build.opensuse.org/package/show/home:matwey:branches:server:database/flux

Firstyear commented 2 years ago

I see the issue. It's because your cargo dir is a child of flux, specific flux/libflux. Because of that, when it unpacks, it can't find the vendor dir, since it expects you to run cargo in the root, not the child dir.

So I think you need to change your specfile to have the %setup for vendor.tar extract into libflux.

matwey commented 2 years ago

Thank you. I'll try you advice. However, I wounder how does it work here: https://build.opensuse.org/package/show/server:database/flux I've just updated version.

Firstyear commented 2 years ago

The difference appears to be the presence of the Cargo.lock in the vendor.tar, which is needed for when an "update" is run. Otherwise I can't see any other differences ....

Firstyear commented 2 years ago

@matwey I'm assuming that worked for you?

matwey commented 2 years ago

Yes, thank you!