108108rm Cargo.lock
109109RCGEN_AWS_LC_RS_STRING=" ^aws-lc-rs = .*"
110110RCGEN_AWS_LC_RS_PATH_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , default-features = false, features = [\" aws-lc-sys\" ] }"
111- sed_replace ./Cargo.toml " s|${RCGEN_AWS_LC_RS_STRING} |${RCGEN_AWS_LC_RS_PATH_STRING} |g "
111+ sed_replace ./Cargo.toml " s|${RCGEN_AWS_LC_RS_STRING} |${RCGEN_AWS_LC_RS_PATH_STRING} |gm "
112112cargo add --path " ${ROOT} /aws-lc-rs" --package rustls-cert-gen
113113cargo update
114114cargo update " aws-lc-rs@${AWS_LC_RS_VERSION} "
@@ -121,11 +121,20 @@ if [[ $latest_release == "1" ]]; then
121121 git checkout " ${RUSTLS_WEBPKI_COMMIT} "
122122fi
123123rm Cargo.lock
124- WEBPKI_RCGEN_STRING=" ^rcgen = { .* }"
124+ WEBPKI_RCGEN_STRING=" ^rcgen = \\ { .*? \\ }"
125125WEBPKI_RCGEN_PATH_STRING=" rcgen = { path = \" ${RUSTLS_RCGEN_DIR} /rcgen\" , default-features = false, features = [\" aws_lc_rs\" ] }"
126126WEBPKI_AWS_LC_RS_STRING=" ^aws-lc-rs = { version.* }"
127127WEBPKI_AWS_LC_RS_PATH_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , optional = true, default-features = false, features = [\" aws-lc-sys\" ] }"
128- find ./ -type f -name " Cargo.toml" | xargs perl -0777 -pi -e ' s|' " ${WEBPKI_RCGEN_STRING} " ' |' " ${WEBPKI_RCGEN_PATH_STRING} " ' |g; s|' " ${WEBPKI_AWS_LC_RS_STRING} " ' |' " ${WEBPKI_AWS_LC_RS_PATH_STRING} " ' |g'
128+ WEBPKI_AWS_LC_RS_WORKSPACE_OPTIONAL_STRING=" ^aws-lc-rs = \\ { workspace = true, optional = true.*?\\ }"
129+ WEBPKI_AWS_LC_RS_WORKSPACE_NON_OPTIONAL_STRING=" ^aws-lc-rs = \\ { workspace = true[^\\ }]*\\ }"
130+ WEBPKI_AWS_LC_RS_PATH_NON_OPTIONAL_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , default-features = false, features = [\" aws-lc-sys\" ] }"
131+ while IFS= read -r -d ' ' cargo_toml; do
132+ sed_replace " ${cargo_toml} " \
133+ " s|${WEBPKI_RCGEN_STRING} |${WEBPKI_RCGEN_PATH_STRING} |gm" \
134+ " s|${WEBPKI_AWS_LC_RS_STRING} |${WEBPKI_AWS_LC_RS_PATH_STRING} |gm" \
135+ " s|${WEBPKI_AWS_LC_RS_WORKSPACE_OPTIONAL_STRING} |${WEBPKI_AWS_LC_RS_PATH_STRING} |gm" \
136+ " s|${WEBPKI_AWS_LC_RS_WORKSPACE_NON_OPTIONAL_STRING} |${WEBPKI_AWS_LC_RS_PATH_NON_OPTIONAL_STRING} |gm"
137+ done < <( find ./ -type f -name " Cargo.toml" -print0)
129138
130139# Trigger Cargo to generate the lock file
131140cargo update
@@ -140,15 +149,29 @@ if [[ $latest_release == "1" ]]; then
140149fi
141150rm Cargo.lock
142151# Update the Cargo.toml to use the GitHub repository reference under test.
143- RUSTLS_RCGEN_STRING=" ^rcgen = { .* }"
152+ RUSTLS_RCGEN_STRING=" ^rcgen = \\ { .*? \\ }"
144153RUSTLS_RCGEN_PATH_STRING=" rcgen = { path = \" ${RUSTLS_RCGEN_DIR} /rcgen\" , default-features = false, features = [\" aws_lc_rs\" , \" pem\" ] }"
145154RUSTLS_AWS_LC_RS_STRING=" ^aws-lc-rs = { version.* }"
146- RUSTLS_AWS_LC_RS_PATH_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , default-features = false, features = [\" aws-lc-sys\" ] }"
155+ RUSTLS_AWS_LC_RS_PATH_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , optional = true, default-features = false, features = [\" aws-lc-sys\" ] }"
156+ RUSTLS_AWS_LC_RS_PATH_NON_OPTIONAL_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , default-features = false, features = [\" aws-lc-sys\" ] }"
147157RUSTLS_AWS_LC_RS_NON_OPTIONAL_PATH_STRING=" aws-lc-rs = { path = \" ${ROOT} /aws-lc-rs\" , default-features = false, features = [\" unstable\" , \" aws-lc-sys\" ] }"
148- RUSTLS_WEBPKI_STRING=" ^webpki = { package = \" rustls-webpki\" ,.*}"
158+ RUSTLS_AWS_LC_RS_WORKSPACE_OPTIONAL_STRING=" ^aws-lc-rs = \\ { workspace = true, optional = true.*?\\ }"
159+ RUSTLS_AWS_LC_RS_WORKSPACE_NON_OPTIONAL_STRING=" ^aws-lc-rs = \\ { workspace = true[^\\ }]*\\ }"
160+ RUSTLS_WEBPKI_STRING=" ^webpki = \\ { package = \" rustls-webpki\" ,[\s\S]*?\\ }"
149161RUSTLS_WEBPKI_PATH_STRING=" webpki = { package = \" rustls-webpki\" , path = \" ${RUSTLS_WEBPKI_DIR} \" , features = [\" alloc\" ], default-features = false }"
150- sed_replace ./rustls-post-quantum/Cargo.toml " s|${RUSTLS_AWS_LC_RS_STRING} |${RUSTLS_AWS_LC_RS_NON_OPTIONAL_PATH_STRING} |g"
151- find ./ -type f -name " Cargo.toml" | xargs perl -0777 -pi -e ' s|' " ${RUSTLS_RCGEN_STRING} " ' |' " ${RUSTLS_RCGEN_PATH_STRING} " ' |g; s|' " ${RUSTLS_AWS_LC_RS_STRING} " ' |' " ${RUSTLS_AWS_LC_RS_PATH_STRING} " ' |g; s|' " ${RUSTLS_WEBPKI_STRING} " ' |' " ${RUSTLS_WEBPKI_PATH_STRING} " ' |g'
162+ sed_replace ./rustls-post-quantum/Cargo.toml \
163+ " s|${RUSTLS_AWS_LC_RS_STRING} |${RUSTLS_AWS_LC_RS_NON_OPTIONAL_PATH_STRING} |gm" \
164+ " s|${RUSTLS_AWS_LC_RS_WORKSPACE_OPTIONAL_STRING} |${RUSTLS_AWS_LC_RS_NON_OPTIONAL_PATH_STRING} |gm" \
165+ " s|${RUSTLS_AWS_LC_RS_WORKSPACE_NON_OPTIONAL_STRING} |${RUSTLS_AWS_LC_RS_NON_OPTIONAL_PATH_STRING} |gm"
166+ while IFS= read -r -d ' ' cargo_toml; do
167+ [[ " ${cargo_toml} " == " ./rustls-post-quantum/Cargo.toml" ]] && continue
168+ sed_replace " ${cargo_toml} " \
169+ " s|${RUSTLS_RCGEN_STRING} |${RUSTLS_RCGEN_PATH_STRING} |gm" \
170+ " s|${RUSTLS_AWS_LC_RS_STRING} |${RUSTLS_AWS_LC_RS_PATH_NON_OPTIONAL_STRING} |gm" \
171+ " s|${RUSTLS_AWS_LC_RS_WORKSPACE_OPTIONAL_STRING} |${RUSTLS_AWS_LC_RS_PATH_STRING} |gm" \
172+ " s|${RUSTLS_AWS_LC_RS_WORKSPACE_NON_OPTIONAL_STRING} |${RUSTLS_AWS_LC_RS_PATH_NON_OPTIONAL_STRING} |gm" \
173+ " s|${RUSTLS_WEBPKI_STRING} |${RUSTLS_WEBPKI_PATH_STRING} |gm"
174+ done < <( find ./ -type f -name " Cargo.toml" -print0)
152175
153176# Trigger Cargo to generate the lock file
154177cargo update
0 commit comments