Skip to content

Commit

Permalink
Fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
inikulin committed Aug 1, 2023
1 parent c71e2be commit 6435c5b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ boring-sys = { version = "3.0", path = "./boring-sys" }
boring = { version = "3.0", path = "./boring" }
tokio-boring = { version = "3.0", path = "./tokio-boring" }

bindgen = { version = "0.65.1", default-features = false, features = ["runtime"] }
bindgen = { version = "0.66.1", default-features = false, features = ["runtime"] }
cmake = "0.1"
fslock = "0.2"
bitflags = "1.0"
Expand Down
6 changes: 6 additions & 0 deletions boring-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ include = [
"/deps/boringssl/**/CMakeLists.txt",
"/deps/boringssl/**/sources.cmake",
"/deps/boringssl/LICENSE",
"/deps/boringssl-fips/**/*.[chS]",
"/deps/boringssl-fips/**/*.asm",
"/deps/boringssl-fips/src/**/*.cc",
"/deps/boringssl-fips/**/CMakeLists.txt",
"/deps/boringssl-fips/**/sources.cmake",
"/deps/boringssl/LICENSE",
"/build.rs",
"/src",
"/patches",
Expand Down
23 changes: 15 additions & 8 deletions boring-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,30 @@ fn get_extra_clang_args_for_bindgen() -> Vec<String> {
}

fn ensure_patches_applied() -> io::Result<()> {
let out_dir = env::var("OUT_DIR").unwrap();
let mut lock_file = LockFile::open(&PathBuf::from(&out_dir).join(".patch_lock"))?;
let src_path = get_boringssl_source_path();

let mut lock_file = LockFile::open(&PathBuf::from(&src_path).join(".patch_lock"))?;
let is_in_submodule = Path::new(&src_path).join(".git").exists();

lock_file.lock()?;

let mut cmd = Command::new("git");
// NOTE: check that we are not in files copied for publishing, otherwise we will reset
// the upper level git repo which is the workspace itself.
if is_in_submodule {
println!("cargo:warning=cleaning up boringssl git submodule dir");

cmd.args(["reset", "--hard"]).current_dir(&src_path);
let mut cmd = Command::new("git");

run_command(&mut cmd)?;
cmd.args(["reset", "--hard"]).current_dir(&src_path);

let mut cmd = Command::new("git");
run_command(&mut cmd)?;

cmd.args(["clean", "-fdx"]).current_dir(&src_path);
let mut cmd = Command::new("git");

run_command(&mut cmd)?;
cmd.args(["clean", "-fdx"]).current_dir(&src_path);

run_command(&mut cmd)?;
}

if cfg!(feature = "pq-experimental") {
println!("cargo:warning=applying experimental post quantum crypto patch to boringssl");
Expand Down

0 comments on commit 6435c5b

Please sign in to comment.