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
55const 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