On Sun, Jan 23, 2022 at 07:32:13PM -0500, aisha wrote:
> 
> Did this ever get developed further?
> Many folks have tried to make a vaultwarden port (and failed) and I believe 
> this would help with that.
> Currently while trying to create the port I get the following error -
> 
> ===> Building for vaultwarden-1.23.1
> 
> error: failed to resolve patches for 
> `https://github.com/rust-lang/crates.io-index`
> 
> Caused by:
>   failed to load source for dependency `job_scheduler`
> 
> Caused by:
>   Unable to update 
> https://github.com/jjlin/job_scheduler?rev=ee023418dbba2bfe1e30a5fd7d937f9e33739806#ee023418
> 
> Caused by:
>   can't checkout from 'https://github.com/jjlin/job_scheduler': you are in 
> the offline mode (--offline)
> *** Error 101 in . (/usr/ports/devel/cargo/cargo.port.mk:319 'do-build': @cd 
> /usr/ports/pobj/vaultwarden-1.23.1/vaultwarden-1.23.1 && /usr/b...)
> *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2944 
> '/usr/ports/pobj/vaultwarden-1.23.1/build-amd64/.build_done': @cd 
> /usr/ports...)
> *** Error 2 in /usr/ports/security/vaultwarden 
> (/usr/ports/infrastructure/mk/bsd.port.mk:2594 'build': 
> @lock=vaultwarden-1.23.1;  export _LO...)
> 

Module devel/cargo tries to provide some magic to help porting rust
programs. But git dependencies are hard to copte with.

Regarding vaultwarden, you need to get the following git repositories:
- https://github.com/SergioBenitez/Devise
- https://github.com/SergioBenitez/Rocket
- https://github.com/jjlin/job_scheduler

which expand to the following crates:
- devise
- devise_codegen
- devise_core
- rocket
- rocket_codegen
- rocket_contrib
- rocket_http
- job_scheduler

The fact that a repository could expand to more than one crate makes the
download process to not be doable simply inside devel/cargo port.

For now, such port should be ported using the "old" method which is to
vendor all dependencies in one tarball, and put it somewhere on the
internet.

cargo has the right command to do it for you:

$ cd vaultwarden-1.23.1
$ cargo vendor myvendordir
   Vendoring addr2line v0.17.0 
(/home/semarie/.cargo/registry/src/github.com-1ecc6299db9ec823/addr2line-0.17.0)
 to myvendordir/addr2line
   Vendoring adler v1.0.2 
(/home/semarie/.cargo/registry/src/github.com-1ecc6299db9ec823/adler-1.0.2) to 
myvendordir/adler
...
   Vendoring yansi v0.5.0 
(/home/semarie/.cargo/registry/src/github.com-1ecc6299db9ec823/yansi-0.5.0) to 
myvendordir/yansi
   Vendoring yubico v0.10.0 
(/home/semarie/.cargo/registry/src/github.com-1ecc6299db9ec823/yubico-0.10.0) 
to myvendordir/yubico
To use vendored sources, add this to your .cargo/config.toml for this project:

[source.crates-io]
replace-with = "vendored-sources"

[source."https://github.com/SergioBenitez/Devise.git";]
git = "https://github.com/SergioBenitez/Devise.git";
rev = "e58b3ac9a"
replace-with = "vendored-sources"

[source."https://github.com/SergioBenitez/Rocket";]
git = "https://github.com/SergioBenitez/Rocket";
rev = "263e39b5b429de1913ce7e3036575a7b4d88b6d7"
replace-with = "vendored-sources"

[source."https://github.com/jjlin/job_scheduler";]
git = "https://github.com/jjlin/job_scheduler";
rev = "ee023418dbba2bfe1e30a5fd7d937f9e33739806"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "myvendordir"


Next, create a tarball for myvendordir directory, and add a configure
step to create the .cargo/config.toml file (it could be a file copied
from security/vaultwarden/files/ to ${WRKDIR}/.cargo).

The hard part should be done.

Thanks.
-- 
Sebastien Marie

Reply via email to