diff --git a/Cargo.lock b/Cargo.lock index 8e65cf6..ed0345c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -809,7 +809,7 @@ dependencies = [ [[package]] name = "icp-cli-network-launcher" -version = "12.0.0-2026-03-19-04-43" +version = "12.0.0-83c3f95e8c4ce28e02493df83df5f84a166451c0" dependencies = [ "anyhow", "camino", @@ -1324,8 +1324,8 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pocket-ic" -version = "12.0.0" -source = "git+https://github.com/dfinity/ic?rev=d17cf0bcd330e94f868cc7d19d0ac860cbe64198#d17cf0bcd330e94f868cc7d19d0ac860cbe64198" +version = "13.0.0" +source = "git+https://github.com/dfinity/ic?rev=83c3f95e8c4ce28e02493df83df5f84a166451c0#83c3f95e8c4ce28e02493df83df5f84a166451c0" dependencies = [ "backoff", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 0d31e70..b53eb00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "icp-cli-network-launcher" -version = "12.0.0-2026-03-19-04-43" +version = "12.0.0-83c3f95e8c4ce28e02493df83df5f84a166451c0" edition = "2024" authors = ["DFINITY Stiftung "] license = "Apache-2.0" @@ -15,7 +15,7 @@ clap = { version = "4.5.53", features = ["derive", "env"] } hex = "0.4.3" ic_principal = "0.1.1" notify = "8.2.0" -pocket-ic = { git = "https://github.com/dfinity/ic", rev = "d17cf0bcd330e94f868cc7d19d0ac860cbe64198" } +pocket-ic = { git = "https://github.com/dfinity/ic", rev = "83c3f95e8c4ce28e02493df83df5f84a166451c0" } reqwest = { version = "0.12.24", default-features = false, features = ["rustls-tls", "json"] } semver = "1.0.27" serde = { version = "1.0.228", features = ["derive"] } diff --git a/package.sh b/package.sh index 3d11591..724469c 100755 --- a/package.sh +++ b/package.sh @@ -41,15 +41,31 @@ fi v=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .version') source=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .dependencies[] | select(.name=="pocket-ic") | .source') -reg='([0-9.]+)(-((r[0-9]+$)|(([0-9-]+)(\.(r[0-9]+))?)))?' -if [[ "$v" =~ $reg ]]; then +# Parse version: X.Y.Z with optional suffix +if [[ "$v" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-.+)?$ ]]; then pkgver=${BASH_REMATCH[1]} - icdate=${BASH_REMATCH[6]:-} - patchrel=${BASH_REMATCH[4]:-${BASH_REMATCH[8]:-}} + suffix=${BASH_REMATCH[2]:-} + suffix=${suffix#-} else - die "could not parse package version $v - should be 1.2.3[-r1] or 1.2.3-2026-01-29-16-08[.r1]" + die "could not parse package version $v" fi -if [[ "$v" = *"-"* ]]; then +githash="" +icdate="" +patchrel="" +if [[ -z "$suffix" ]]; then + : +elif [[ "$suffix" =~ ^(r[0-9]+)$ ]]; then + patchrel=${BASH_REMATCH[1]} +elif [[ "$suffix" =~ ^([0-9a-f]{40})(-(r[0-9]+))?$ ]]; then + githash=${BASH_REMATCH[1]} + patchrel=${BASH_REMATCH[3]:-} +elif [[ "$suffix" =~ ^([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2})(\.(r[0-9]+))?$ ]]; then + icdate=${BASH_REMATCH[1]} + patchrel=${BASH_REMATCH[3]:-} +else + die "could not parse package version $v - expected 1.2.3[-r1], 1.2.3-2026-01-29-16-08[.r1], or 1.2.3-[-r1]" +fi +if [[ -n "$icdate" || -n "$githash" || -n "$patchrel" ]]; then [[ "$source" = "git+"* ]] || die "package.version is patch but pocket-ic dependency is not git" else [[ "$source" != "git+"* ]] || die "package.version is not patch but pocket-ic dependency is git" @@ -59,13 +75,16 @@ outdir="${dir:-"dist/${name}"}" cargo build --release "${cargo_args[@]}" mkdir -p "${outdir}" cp "target/release/icp-cli-network-launcher" "${outdir}/" -if [[ -z "$icdate" ]]; then - echo "Fetching pocket-ic from: https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" - curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" } -else +if [[ -n "$githash" ]]; then + echo "Fetching pocket-ic from: https://download.dfinity.systems/ic/${githash}/binaries/${arch}-${os}/pocket-ic.gz" + curl --proto '=https' -sSfL --tlsv1.2 "https://download.dfinity.systems/ic/${githash}/binaries/${arch}-${os}/pocket-ic.gz" -o "${outdir}/pocket-ic.gz" +elif [[ -n "$icdate" ]]; then icver=$(sed 's/-/_/3' <<<"${icdate}") echo "Fetching pocket-ic from: https://github.com/dfinity/ic/releases/download/release-${icver}-base/pocket-ic-${arch}-${os}.gz" curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/ic/releases/download/release-${icver}-base/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" } +else + echo "Fetching pocket-ic from: https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" + curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" } fi gunzip -f "${outdir}/pocket-ic.gz" chmod a+x "${outdir}/pocket-ic"