Skip to content

Commit

Permalink
gen/pb-rust: more errors in build script
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Pan <andrew.pan@trailofbits.com>
  • Loading branch information
tnytown committed Jan 30, 2024
1 parent 0dee555 commit 8283471
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gen/pb-rust/sigstore-protobuf-specs/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
use anyhow::Context;

/// Find the standard protobuf include directory.
fn protobuf_include_path() -> String {
let mut protobuf_root = which::which("protoc")
.ok()
.context("couldn't find protoc!")
// dirname(/bin/protoc) / ../
.and_then(|path| path.ancestors().nth(2).map(|p| p.to_path_buf()))
.and_then(|path| {
path.ancestors()
.nth(2)
.map(|p| p.to_path_buf())
.with_context(|| format!("couldn't traverse path: {path:?}"))
})
.expect("protobuf installation directory not found!");
protobuf_root.push("include");
protobuf_root.to_str().unwrap().to_owned()
Expand Down

0 comments on commit 8283471

Please sign in to comment.