Skip to content

Use explicit git revs in Cargo.toml - #67

Merged
jmpesp merged 2 commits into
mainfrom
explicit_git_rev
Sep 2, 2026
Merged

jmpesp merged 2 commits into
mainfrom
explicit_git_rev

Conversation

@jmpesp

@jmpesp jmpesp commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Cargo can find a version of tlvc and tlvc-text without trouble when hubtools is used as a direct dep:

james@duster ~/src/jmpesp [] [] $ cargo init hubtools-dep
    Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

james@duster ~/src/jmpesp [] [] $ cd hubtools-dep/

james@duster ~/src/jmpesp/hubtools-dep [] [] $ echo 'hubtools = { git = "https://github.com/oxidecomputer/hubtools" }' >> Cargo.toml

james@duster ~/src/jmpesp/hubtools-dep [] [] $ cat Cargo.toml
[package]
name = "hubtools-dep"
version = "0.1.0"
edition = "2024"

[dependencies]
hubtools = { git = "https://github.com/oxidecomputer/hubtools" }
james@duster ~/src/jmpesp/hubtools-dep [] [] $ cargo build
    Updating git repository `https://github.com/oxidecomputer/hubtools`
    Updating crates.io index
    Updating git repository `https://github.com/oxidecomputer/lpc55_support`
    Updating git repository `https://github.com/oxidecomputer/tlvc`
     Locking 130 packages to latest Rust 1.98.0 compatible versions
      Adding generic-array v0.14.7 (available: v0.14.9)
  Downloaded path-slash v0.2.1
...snip...
   Compiling ron v0.8.1
   Compiling pkcs1 v0.7.5
   Compiling lpc55_areas v0.2.5 (https://github.com/oxidecomputer/lpc55_support#fc64732f)
   Compiling ppv-lite86 v0.2.21
   Compiling tlvc v0.4.1 (https://github.com/oxidecomputer/tlvc#7a96eab9)
   Compiling tlvc-text v0.4.0 (https://github.com/oxidecomputer/tlvc#7a96eab9)
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.8
   Compiling rsa v0.9.10
   Compiling lpc55_sign v0.3.5 (https://github.com/oxidecomputer/lpc55_support#fc64732f)
   Compiling hubtools v0.4.9 (https://github.com/oxidecomputer/hubtools#5ea53d26)
   Compiling hubtools-dep v0.1.0 (/home/james/src/jmpesp/hubtools-dep)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 21.32s

But not as an indirect dep, such as when sled-agent is used as a direct dep. The error seen there is:

error: failed to select a version for the requirement `tlvc = "^0.3"`
candidate versions found which didn't match: 0.4.1
location searched: Git repository https://github.com/oxidecomputer/tlvc
required by package `hubtools v0.4.7 (https://github.com/oxidecomputer/hubtools.git?rev=2b1ef9b38d75563ea800baa3b17327eec17b1b7a#2b1ef9b3)`
    ... which satisfies git dependency `hubtools` of package `sp-sim v0.1.0 (/home/james/src/oxidecomputer/omicron4/sp-sim)`
    ... which satisfies path dependency `sp-sim` of package `omicron-sled-agent v0.1.0 (/home/james/src/oxidecomputer/omicron4/sled-agent)`
    ... which satisfies path dependency `omicron-sled-agent` of package `sled-config v0.1.0 (/home/james/src/jmpesp/sled-config)`

The assumption is that this is because the most current commit in the tlvc repo uses version 0.4.1 while the Cargo.toml present here requests version 0.3, and cargo's rules about what versions can satisfy certain requests are somehow different for direct and indirect deps.

Even when hubtools is a direct dep the version of these git deps that gets pulled in doesn't match what is requested in the Cargo.toml. Solve both this and the indirect dep problem by changing version = to rev = for both the tlvc and lpc55_support dependencies to pin what's actually being pulled in. Also while we're here, update those revs to the latest version in those repos.

Cargo can find a version of tlvc and tlvc-text without trouble when
hubtools is used as a direct dep:

```
james@duster ~/src/jmpesp [] [] $ cargo init hubtools-dep
    Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

james@duster ~/src/jmpesp [] [] $ cd hubtools-dep/

james@duster ~/src/jmpesp/hubtools-dep [] [] $ echo 'hubtools = { git = "https://github.com/oxidecomputer/hubtools" }' >> Cargo.toml

james@duster ~/src/jmpesp/hubtools-dep [] [] $ cat Cargo.toml
[package]
name = "hubtools-dep"
version = "0.1.0"
edition = "2024"

[dependencies]
hubtools = { git = "https://github.com/oxidecomputer/hubtools" }
james@duster ~/src/jmpesp/hubtools-dep [] [] $ cargo build
    Updating git repository `https://github.com/oxidecomputer/hubtools`
    Updating crates.io index
    Updating git repository `https://github.com/oxidecomputer/lpc55_support`
    Updating git repository `https://github.com/oxidecomputer/tlvc`
     Locking 130 packages to latest Rust 1.98.0 compatible versions
      Adding generic-array v0.14.7 (available: v0.14.9)
  Downloaded path-slash v0.2.1
...snip...
   Compiling ron v0.8.1
   Compiling pkcs1 v0.7.5
   Compiling lpc55_areas v0.2.5 (https://github.com/oxidecomputer/lpc55_support#fc64732f)
   Compiling ppv-lite86 v0.2.21
   Compiling tlvc v0.4.1 (https://github.com/oxidecomputer/tlvc#7a96eab9)
   Compiling tlvc-text v0.4.0 (https://github.com/oxidecomputer/tlvc#7a96eab9)
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.8
   Compiling rsa v0.9.10
   Compiling lpc55_sign v0.3.5 (https://github.com/oxidecomputer/lpc55_support#fc64732f)
   Compiling hubtools v0.4.9 (https://github.com/oxidecomputer/hubtools#5ea53d26)
   Compiling hubtools-dep v0.1.0 (/home/james/src/jmpesp/hubtools-dep)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 21.32s
```

But not as an indirect dep, such as when sled-agent is used as a direct
dep. The error seen there is:

```
error: failed to select a version for the requirement `tlvc = "^0.3"`
candidate versions found which didn't match: 0.4.1
location searched: Git repository https://github.com/oxidecomputer/tlvc
required by package `hubtools v0.4.7 (https://github.com/oxidecomputer/hubtools.git?rev=2b1ef9b38d75563ea800baa3b17327eec17b1b7a#2b1ef9b3)`
    ... which satisfies git dependency `hubtools` of package `sp-sim v0.1.0 (/home/james/src/oxidecomputer/omicron4/sp-sim)`
    ... which satisfies path dependency `sp-sim` of package `omicron-sled-agent v0.1.0 (/home/james/src/oxidecomputer/omicron4/sled-agent)`
    ... which satisfies path dependency `omicron-sled-agent` of package `sled-config v0.1.0 (/home/james/src/jmpesp/sled-config)`
```

The assumption is that this is because the most current commit in the
`tlvc` repo uses version 0.4.1 while the Cargo.toml present here
requests version 0.3, and cargo's rules about what versions can satisfy
certain requests are somehow different for direct and indirect deps.

Even when hubtools is a direct dep the version of these git deps that
gets pulled in doesn't match what is requested in the Cargo.toml. Solve
both this and the indirect dep problem by changing `version =` to `rev
=` for both the tlvc and lpc55_support dependencies to pin what's
actually being pulled in. Also while we're here, update those revs to
the latest version in those repos.
@jmpesp
jmpesp merged commit 87881bd into main Sep 2, 2026
7 checks passed
@jmpesp
jmpesp deleted the explicit_git_rev branch September 2, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants