dionysius / vaultwarden-deb

clean(er) debian packaging for vaultwarden
MIT License
30 stars 2 forks source link

cargo supposedly not installed while being installed #11

Closed Artim96 closed 5 months ago

Artim96 commented 5 months ago

I've installed the rust toolchain 1.78 with rustup. But gdb buildpackage for some reason refuses to find cargo:

gbp:info: Extracting 'vaultwarden_1.30.5.orig.tar.gz' to '/opt/vaultwarden-deb/vaultwarden-tmp'
gbp:info: Exporting 'HEAD' to '/opt/vaultwarden-deb/vaultwarden-tmp'
gbp:info: Moving '/opt/vaultwarden-deb/vaultwarden-tmp' to '/opt/vaultwarden-deb/vaultwarden-1.30.5'
gbp:info: Performing the build
 dpkg-buildpackage -us -uc -ui -i -I
dpkg-buildpackage: Information: Source package vaultwarden
dpkg-buildpackage: Information: Source version 1.30.5-1
dpkg-buildpackage: Information: source distribution unstable
dpkg-buildpackage: Information: Source changed by dionysius <dragon.dionysius@gmail.com>
 dpkg-source -i -I --before-build .
dpkg-buildpackage: Information: host architecture amd64
dpkg-source: Information: Options from vaultwarden-1.30.5/debian/source/options are used: --extend-diff-ignore=(^|/)(.github|LICENSE|README|signing-key)
dpkg-checkbuilddeps: Error: Unfulfilled build dependencies: cargo
dpkg-buildpackage: Warning: Build dependencies/conflicts not fulfilled; abort
dpkg-buildpackage: Warning: (Use -d to override.)
debuild: fatal error at line 1184:
dpkg-buildpackage -us -uc -ui -i -I failed
gbp:error: 'debuild -i -I' failed: it exited with 29

But

cargo -V
cargo 1.78.0 (54d8815d0 2024-03-26)
which cargo
/usr/bin/cargo

So what exactly is it complaining about?

dionysius commented 5 months ago

Unfortunately https://github.com/dionysius/vaultwarden-deb/blob/main/debian/control#L4 looks for a cargo package installed. e.g. dpkg -l | grep cargo should list it. I haven't figured out a way to make this optional as there is no rustup package in debian.

You have 3 options:

dionysius commented 5 months ago

Updated and explained the first option (using -d) in the readme

dionysius commented 5 months ago

After that you will run into #12. Just tested the building locally

Artim96 commented 5 months ago

Unfortunately https://github.com/dionysius/vaultwarden-deb/blob/main/debian/control#L4 looks for a cargo package installed. e.g. dpkg -l | grep cargo should list it. I haven't figured out a way to make this optional as there is no rustup package in debian.

You have 3 options:

  • use gbp buildpackage -d ... to ignore build-depends
  • install cargo from your apt sources but still use rustup toolchain install <version> as described in the readme. It should pick your rustup version when building
  • remove cargo from build-depends in said file and make a temporary git commit before building

I'll try that. But actually, rustup has been introduced to Debian, although it's only to be included in Trixie. That's how I installed it, as the first time I tried to run it, it complained that some dependency needs rustc 1.64, while stable only has 1.63 without any backports. On Testing it then claimed another dependency needed rustc 1.78, so I installed rustup there and tried again with that, running into this issue.

Artim96 commented 5 months ago

After that you will run into #12. Just tested the building locally

true

dionysius commented 5 months ago

You are right, it's currently in testing: https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=rustup. So I will have options in the future to make this a bit smarter once it hits stable.

For now, this issue is solved and the package works as intended. The important bits have been documented in the readme. Lets head over to #12, I'll look into it.

Artim96 commented 5 months ago

Actually, installing cargo won't be an option anymore in Testing/Trixie once it hits stable. cargo has a fixed dependency on rustc, which in turn will mark rustup to be removed:

Error: Conflict: -> cargo:amd64=1.74.1+dfsg1-1 but rustup:amd64 -> rustup:amd64=1.26.0-6 -> not cargo:amd64=1.74.1+dfsg1-1

Just as a FYI.

dionysius commented 5 months ago

Thank you, will keep in mind. Will be fun when ubuntu and debian are out of sync again package wise. I can use the or operator | in build-depends which might suffice. For now i this source package must run for debian stable or ubuntu lts at least.

dionysius commented 5 months ago

Yep as hoped and expected Build-Depends: rustup | cargo works like a charm. Now you don't need -d anymore in buildpackage. Tested on trixie and booworm. See/use branch main or tag debian/1.30.5-3

Artim96 commented 5 months ago

Yes, that does help.