Skip to content

Commit bdd2e39

Browse files
committed
feat: ignore fake/nonsense prerelease info from tss version, the rest of the version still has to match
1 parent 0e7a2b1 commit bdd2e39

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tss-esapi/build.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 Contributors to the Parsec project.
22
// SPDX-License-Identifier: Apache-2.0
3-
use semver::{Version, VersionReq};
3+
use semver::{Version, VersionReq, Prerelease};
44

55
const TPM2_TSS_MINIMUM_VERSION: Version = Version::new(4, 1, 3);
66

@@ -13,7 +13,7 @@ fn main() {
1313

1414
// If documentation for Docs.rs is being built then the version is set
1515
// to the minimum supported tpm2-tss version.
16-
let tss_version = if std::env::var("DOCS_RS").is_ok() {
16+
let mut tss_version = if std::env::var("DOCS_RS").is_ok() {
1717
TPM2_TSS_MINIMUM_VERSION
1818
} else {
1919
let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION")
@@ -23,9 +23,14 @@ fn main() {
2323
.expect("Failed to parse the DEP_TSS2_ESYS_VERSION variable as a semver version")
2424
};
2525

26+
// nuke any prerelease info, which probably is just a git repo/dirty flag
27+
// like: 4.0.1-67-gb7bad346
28+
tss_version.pre = Prerelease::EMPTY;
29+
2630
let supported_tss_version =
2731
VersionReq::parse("<5.0.0, >=2.3.3").expect("Failed to parse supported TSS version");
2832

33+
//eprintln!("tss version: {} / {:?}", supported_tss_version, tss_version);
2934
assert!(
3035
supported_tss_version.matches(&tss_version),
3136
"Unsupported TSS version {tss_version}"

0 commit comments

Comments
 (0)