meta-rust / cargo-bitbake

cargo extension that can generate BitBake recipes utilizing the classes from meta-rust
Apache License 2.0
84 stars 59 forks source link

Malformed Git SSH URL from Cargo.toml appears in SRC_URI #41

Open IsaacJT opened 2 years ago

IsaacJT commented 2 years ago

When running cargo-bitbake bitbake in a package containing a Git SSH dependency, the URL is then mangled and copied into SRC_URI. This is an unnecessary step as the Git dependency does not need to be in the SRC_URI (the package builds fine without it) and the URL string is malformed.

For example, the following dependency in Cargo.toml:

[dependencies]
testlib = { git = "ssh://git@192.168.0.1:10022/test/testlib.git" }

Is converted to the following in SRC_URI:

git://ssh///git@192.168.0.1/10022/test/testlib.git;protocol=ssh;nobranch=1;name=testlib;destsuffix=testlib 
codyps commented 2 years ago

Hey @IsaacJT, thanks for reporting this. cargo-bitbake definitely should make sure it's generating reasonable SRC_URI contents.

While crates in general will build correctly even if we miss some dep in SRC_URI, generally in open-embedded it's not considered great form to have packages that depend on network access at build time to build their content. As a result, we'd really want to generate the right SRC_URI including the correct git path here. You should be able to test builds without networking by setting the BB_NO_NETWORK=1 bitbake variable.

koenhausmans commented 1 year ago

Having the same problem here, reason for it to fail is because the SSH_STYLE_REMOTE regex is incorrectly matching on the example URL provided above. Potential solution is for checking whether the repository URL does not start with ssh://.