Debian Codegraph @

util/update-version.sh

raw
1 #!/bin/sh
2 # spell-checker:ignore uuhelp
3
4 # This is a stupid helper. I will mass replace all versions (including other crates)
5 # So, it should be triple-checked
6
7 # How to ship a new release:
8 # 1) update this script
9 # 2) run it: sh util/update-version.sh
10 # 3) Do a spot check with "git diff"
11 # 4) cargo test --release --features unix
12 # 5) git commit -m "New release" (make sure it includes Cargo.lock)
13 # 6) Run util/publish.sh in dry mode (it will fail as packages needs more recent version of uucore)
14 # 7) Run util/publish.sh --do-it
15 # 8) In some cases, you might have to fix dependencies and run import
16 # 9) Tag the release - "git tag 0.0.X && git push --tags"
17 # 10) Create the release on github https://github.com/uutils/coreutils/releases/new
18 # 11) Make sure we have good release notes
19
20 FROM="0.11.0"
21 TO="0.12.0"
22
23 MANIFESTS=$(ls -1d Cargo.toml src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml src/uucore/Cargo.toml src/uucore_procs/Cargo.toml tests/uutests/Cargo.toml fuzz/uufuzz/Cargo.toml)
24
25 # Only two kinds of lines are rewritten, so that third party crates which
26 # happen to share our version number (md-5, sha1, sha2, sha3, ...) are left
27 # alone:
28 # 1) the crate's own version declaration, anchored at the start of the line
29 # 2) dependencies carrying a "path =" key, which are the in-tree uutils crates
30
31 # 1) the "version = "X"" of each [package] (and of [workspace.package])
32 #shellcheck disable=SC2086
33 sed -i -E "s|^version = \"$FROM\"$|version = \"$TO\"|" $MANIFESTS
34
35 # 2) the in-tree dependencies, keeping the ">=" prefix when there is one
36 #shellcheck disable=SC2086
37 sed -i -E "/path *=/ s|(version *= *\"(>=)?)$FROM\"|\1$TO\"|g" $MANIFESTS
38
39 # Update Cargo.lock files
40 cargo update --workspace
41 cargo update --workspace --manifest-path fuzz/Cargo.toml
42
43 # Sanity check: anything left pointing at the old version is either a third
44 # party crate (fine) or something this script missed (not fine)
45 echo "Remaining occurrences of $FROM - please review:"
46 #shellcheck disable=SC2086
47 grep -n "$FROM" $MANIFESTS || echo " (none)"