]> git.proxmox.com Git - rustc.git/blob - debian/update-version.sh
Update upstream source from tag 'upstream/1.31.0_beta.4+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 python -c 'import sys; k=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 python -c 'import sys; k=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 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" \
24 -e "s|rustc:native\( *\)(<= [^)]*)|rustc:native\1(<= $NEW_LONG++)|g" \
25 -e "s|rustc:native\( *\)(>= ${ORIG_M1/./\\.}|rustc:native\1(>= ${NEW_M1}|g" \
26 -e "s|cargo\( *\)(>= [^)]*)|cargo\1(>= ${CARGO_NEW}.0~~)|g" \
27 -e "s|cargo\( *\)(<< [^)]*)|cargo\1(<< ${CARGO_NEXT}.0~~)|g" \
28 control
29
30 if [ "$NEW" != "$ORIG" ]; then
31 git mv libstd-rust-$ORIG.lintian-overrides libstd-rust-$NEW.lintian-overrides
32 fi
33 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" libstd-rust-$NEW.lintian-overrides
34 }
35
36 cd $(dirname "$0")
37 update "$@"