Debian Codegraph @

dev/tools/generate-release-changelog.sh

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 #!/usr/bin/bashscip-shell filesystem . . `/usr/bin/bash`.
2
3 set -e
4 set -o pipefail
5
6 if [scip-shell system . . `[`. $# != 1 ]; then
7 echoscip-shell system . . echo. "Usage: $0 BRANCH"
8 exit
9 fi
10
11 branch=$1
12
13 # Set SLOW_CONF to have the confirmation output wait for a newline
14 # Emacs doesn't send characters until the RET so we can't quick_conf
15 if [scip-shell system . . `[`. -z ${SLOW_CONF+x} ] || [scip-shell system . . `[`. -n "$INSIDE_EMACS" ]; then
16 quick_conf=(-n 1)
17 else
18 quick_conf=()
19 fi
20
21 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().() {
22 read -p "Continue anyway? [y/N] " "${quick_conf[@]}" -r
23 echoscip-shell system . . echo.
24 if [[ ! $REPLY =~ ^[Yy]$ ]]; then
25 exit 1
26 fi
27 }
28
29 if ! gitscip-shell system . . git. diff --quiet; then
30 echoscip-shell system . . echo. "Warning: current tree is dirty."
31 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
32 fi
33
34 remote=$(gitscip-shell system . . git. config --get "branch.${branch}.remote" || truescip-shell system . . true.)
35
36 if [scip-shell system . . `[`. -z "$remote" ]; then
37 echoscip-shell system . . echo. "Warning: branch $branch has no associated remote."
38 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
39 else
40
41 if [[ "$remote" != $(git config --get "branch.master.remote") ]]; then
42 echoscip-shell system . . echo. "Warning: branch master and branch $branch do not have the same remote."
43 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
44 fi
45
46 official_remote_git_url="[email protected]:rocq-prover/rocq"
47 official_remote_https_url="github.com/rocq-prover/rocq"
48 remote_url=$(gitscip-shell system . . git. remote get-url "$remote" --all)
49
50 if [scip-shell system . . `[`. "$remote_url" != "${official_remote_git_url}" ] && \
51 [ "$remote_url" != "${official_remote_git_url}.git" ] && \
52 [ "$remote_url" != "https://${official_remote_https_url}" ] && \
53 [ "$remote_url" != "https://${official_remote_https_url}.git" ] && \
54 [[ "$remote_url" != "https://"*"@${official_remote_https_url}" ]] && \
55 [[ "$remote_url" != "https://"*"@${official_remote_https_url}.git" ]] ; then
56 echoscip-shell system . . echo. "Warning: remote $remote does not point to the official Rocq repo,"
57 echoscip-shell system . . echo. "that is $official_remote_git_url"
58 echoscip-shell system . . echo. "It points to $remote_url instead."
59 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
60 fi
61
62 gitscip-shell system . . git. fetch "$remote"
63
64 if [[ $(git rev-parse master) != $(git rev-parse "${remote}/master") ]]; then
65 echoscip-shell system . . echo. "Warning: branch master is not up-to-date with ${remote}/master."
66 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
67 fi
68
69 if [[ $(git rev-parse "$branch") != $(git rev-parse "${remote}/${branch}") ]]; then
70 echoscip-shell system . . echo. "Warning: branch ${branch} is not up-to-date with ${remote}/${branch}."
71 ask_confirmationscip-shell shell shell-project 0.0.0 ask_confirmation().
72 fi
73
74 fi
75
76 gitscip-shell system . . git. checkout "$branch" --detach > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
77 changelog_entries_with_title=(doc/changelog/*/*.rst)
78 gitscip-shell system . . git. checkout master > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
79
80 tmp=$(mktempscip-shell system . . mktemp.)
81 for f in "${changelog_entries_with_title[@]}"; do
82 if ! [scip-shell system . . `[`. -f "$f" ]; then
83 >&2 echoscip-shell system . . echo. "Warning: $f is missing in master branch."
84 continue
85 fi
86
87 cat=${f%/*} # dirname
88 if [[ ${f##*/} = 00000-title.rst ]]; then
89 type=0
90 else
91 type_name=$(headscip-shell system . . head. -n 1 "$f" | cutscip-shell system . . cut. -f 2 -d ' ')
92 type_name=${type_name%":**"}
93 type_name=${type_name#"**"}
94 case "$type_name" in
95 Changed) type=1;;
96 Removed) type=2;;
97 Deprecated) type=3;;
98 Added) type=4;;
99 Fixed) type=5;;
100 *) >&2 echoscip-shell system . . echo. "Unknown changelog type $type_name in $f"; type=6;;
101 esac
102 fi
103 printfscip-shell system . . printf. '%s %s %s\n' "$cat" "$type" "$f" >> "$tmp"
104 done
105
106 while read -r _ type f; do
107 catscip-shell system . . cat. "$f" >> released.rst
108 if ! [[ $type = 0 ]]; then gitscip-shell system . . git. rm "$f" >> /dev/nullscip-shell filesystem . . `/dev/null`.; fi
109 done < <(sortscip-shell system . . sort. "$tmp")
110
111 echoscip-shell system . . echo.
112 echoscip-shell system . . echo. "Changelog written in released.rst. Move its content to a new section in doc/sphinx/changes.rst."