]> git.proxmox.com Git - rustc.git/blob - debian/update-version.sh
Update upstream source from tag 'upstream/1.50.0+dfsg1'
[rustc.git] / debian / update-version.sh
1 #!/bin/bash
2 # Don't run this directly, use "debian/rules update-version" instead
3
4 prev_stable() {
5 local V=$1
6 python3 -c 'import sys; k=list(map(int,sys.argv[1].split("."))); k[1]-=1; print(".".join(map(str,k)))' "$V"
7 }
8
9 cargo_new() {
10 local V=$1
11 python3 -c 'import sys; k=list(map(int,sys.argv[1].split("."))); k[1]+='"${2:-1}"'; k[0]-=1; print(".".join(map(str,k)))' "$V"
12 }
13
14 update() {
15 local ORIG=$1 NEW=$2 NEW_LONG=$3
16 local CARGO_NEW=${4:-$(cargo_new $NEW)}
17 local CARGO_NEXT=${4:-$(cargo_new $NEW 2)}
18
19 ORIG_M1=$(prev_stable $ORIG)
20 NEW_M1=$(prev_stable $NEW)
21 ORIG_R="${ORIG/./\\.}" # match a literal dot, otherwise this might sometimes match e.g. debhelper (>= 9.20141010)
22
23 WASI_CI="$(grep -Rl "git clone https://github.com/WebAssembly/wasi-libc" ../src/ci | head -n1)"
24 WASI_COMMIT="$(egrep -o '\b[0-9A-Fa-f]{7}' "$WASI_CI")"
25 WASI_REGEX='wasi-libc \(([><=]+) 0.0~git([0-9]+).([0-9a-f]+)([~+]+)\)'
26
27 if [ -z "$WASI_COMMIT" -o "$(printf '%s\n' "$WASI_COMMIT" | wc -l)" != 1 ]; then
28 echo >&2 "error: could not determine unique WASI_COMMIT ($WASI_COMMIT), please figure it out from src/ci and update my logic"
29 exit 1
30 fi
31
32 WASI_COMMIT_OLD="$(sed -nre 's|.*'"${WASI_REGEX}"'.*|\3|gp' control | sort -u)"
33 if [ -z "$WASI_COMMIT_OLD" -o "$(printf '%s\n' "$WASI_COMMIT_OLD" | wc -l)" != 1 ]; then
34 echo >&2 "error: could not determine unique WASI_COMMIT_OLD ($WASI_COMMIT_OLD), please figure it out from debian/control and update my logic"
35 exit 1
36 fi
37
38 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" \
39 -e "s|rustc:native\( *\)(<= [^)]*)|rustc:native\1(<= $NEW_LONG++)|g" \
40 -e "s|rustc:native\( *\)(>= ${ORIG_M1/./\\.}|rustc:native\1(>= ${NEW_M1}|g" \
41 -e "s|cargo\( *\)(>= [^)]*)|cargo\1(>= ${CARGO_NEW}.0~~)|g" \
42 -e "s|cargo\( *\)(<< [^)]*)|cargo\1(<< ${CARGO_NEXT}.0~~)|g" \
43 control
44
45 if [ "$WASI_COMMIT" != "$WASI_COMMIT_OLD" ]; then
46 sed -ri -e 's|'"${WASI_REGEX}"'|wasi-libc (\1 0.0~gitFIXME.'"${WASI_COMMIT}"'\4)|g' control
47 echo >&2 "note: the version of the wasi-libc Build-Depends has changed and needs to be FIXME with the correct date"
48 echo >&2 "please update that package, upload it to experimental, and supply the correct date in debian/control"
49 fi
50
51 if [ "$NEW" != "$ORIG" ]; then
52 git mv libstd-rust-$ORIG.lintian-overrides libstd-rust-$NEW.lintian-overrides
53 fi
54 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" libstd-rust-$NEW.lintian-overrides
55 }
56
57 cd $(dirname "$0")
58 update "$@"