6 my_name="$( basename "${0}" )"
11 ${my_name} <repos_dir> <M.m.p>
18 [ -n "${repos}" ] || { usage; exit 1; }
19 [ -d "${repos}" ] || { printf "${my_name}: ${repos}: no such file or directory\n"; exit 1; }
20 [ -n "${version}" ] || { usage; exit 1; }
28 split($2,a,":"); rev=a[1];
30 $0~/^summary:[[:space:]]*[[:digit:]]+\.[[:digit:]]+: '"${msg}"'/ \
32 printf( "%d\n", rev ); found=1;
36 r2=$( hg log -b "${branch}" \
37 |awk '$1=="changeset:" {
39 printf( "%d\n", a[1] );
44 r1_log=$((r1+log_offset))
45 if [ ${#r1_log} -gt ${#r2} ]; then
56 I'm pleased to announce the release of crosstool-NG ${version}!
58 As usual, there has been quite a number of improvements, new features,
59 and bug fixes all around. The most notable changes are listed below:
62 YEM: PUT YOUR MESSAGE HERE
65 This marks the beginning of the ${ver_M}.${ver_m} maintenance branch, and the end of
66 the previous maintenance branch. As always, comments and suggestions
69 The release can be found at the following URLs:
70 Changelog: http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${version}.changelog
71 Tarball: http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${version}.tar.bz2
72 Patches: http://crosstool-ng.org/download/crosstool-ng/01-fixes/${version}/
74 As a reminder, the home for crosstool-NG is:
75 http://crosstool-ng.org/
77 Crosstool-NG also has a Freshmeat page:
78 http://freshmeat.net/projects/crosstool-ng
82 print_intro_changelog_full_release() {
84 crosstool-NG ${version} -- ${date}
86 This is a feature-release. Significant changes are:
89 YEM: PUT YOUR MESSAGE HERE
94 print_intro_changelog_bug_fix() {
96 crosstool-NG ${version} -- ${date}
98 This is a bug-fix-only release.
102 print_author_stats() {
103 printf "\nMany thanks to the people who contributed to this release:\n\n"
105 template='{author|person}\n'
106 hg log -b "${branch}" -r "${r1_log}:${r2}" \
107 --template "${template}" \
108 |sed -r -e 's/"//g;' \
113 for( author in nb ) {
114 printf( " %4d %s\n", nb[author], author );
120 print_author_shortlog() {
121 printf "\nHere is the per-author shortlog:\n"
123 template='{author|person}|{rev}|{branches}|{desc|firstline}\n'
124 hg log -b "${branch}" -r "${r1_log}:${r2}" \
125 --template "${template}" \
128 printf( "%s", gensub("\"","","g",a[1]) );
129 printf( "|%0*d", '${rev_w}', a[2] );
131 printf( "|%s", a[i] );
137 author="$( echo "${line}" |cut -d \| -f 1 )"
138 rev="$( echo "${line}" |cut -d \| -f 2 )"
139 br="$( echo "${line}" |cut -d \| -f 3 )"
140 desc="$( echo "${line}" |cut -d \| -f 4- )"
150 *": close "*" branch"*) continue;;
151 # *\(merged\)) continue;;
154 author="$( echo "${author}" |sed -r -e 's/"//g;' )"
156 if [ ! "${prev_author}" = "${author}" ]; then
158 printf " ${author}:\n"
159 prev_author="${author}"
161 rev="$( echo "${rev}" |sed -r -e 's/^0*//;' )"
163 printf "%s\n" "${desc}" \
165 |(first=1; while read l; do
166 if [ -n "${first}" ]; then
167 printf " [%*d] %s\n" ${rev_w} ${rev} "${l}"
170 printf " %*.*s %s\n" ${rev_w} ${rev_w} '' "${l}"
177 printf "\nThe diffstat follows:\n\n"
178 hg diff -r "${r1}:${r2}" --color=never \
179 |diffstat -r 2 -p 1 -w 10 \
181 |sed -r -e 's/^ */ /;'
183 hg diff -r "${r1}:${r2}" --color=never \
184 |diffstat -f 1 -r 2 -p 1 -w 10 \
186 |while read file line; do
187 if [ ${#file} -gt 57 ]; then
188 file="$( echo "${file}" |sed -r -e 's/^(.{,24}).*(.{28})$/\1.....\2/;' )"
190 printf " %-57s %s\n" "${file}" "${line}"
194 print_short_diffstat() {
195 printf "\nThe short diffstat follows:\n\n"
198 hg diff -r "${r1}:${r2}" --color=never "${i}" \
199 |diffstat -r 2 -p 1 -w 10 \
201 |sed -r -e 's/^[[:space:]]*[[:digit:]]+ files? changed(,[[:space:]]+|$)//;' \
202 -e 's/([[:digit:]]+)[^-\+]+\((-|\+)\)/\1/g;' \
203 -e 's/,//g; s/ /+/; s/^$/0/;'
205 printf " %-24.24s %5d(+/-)\n" "Total" ${total}
216 hg diff -r "${r1}:${r2}" --color=never "${i}" \
217 |diffstat -r 2 -p 1 -w 10 \
219 |sed -r -e 's/^[[:space:]]*[[:digit:]]+ files? changed(,[[:space:]]+|$)//;' \
220 -e 's/([[:digit:]]+)[^-\+]+\((-|\+)\)/\1/g;' \
221 -e 's/,//g; s/ /+/; s/^$/0/;'
223 if [ ${val} -gt $((total/100)) ]; then
224 printf "%d %s\n" $(((1000*val)/total)) "${i}"
225 others=$((others-val))
227 done; printf "%d Others\n" $(((1000*others)/total)); } \
229 |{ while read v i; do
230 if [ "${i}" = "Others" ]; then
233 printf " %-24.24s %3d.%d%%\n" "${i}" $((v/10)) $((v%10))
235 done; printf " %-24.24s %3d.%d%%\n" "Others" $((others/10)) $((others%10)); }
238 ver_M="$( printf "${version}" |cut -d . -f 1 )"
239 ver_m="$( printf "${version}" |cut -d . -f 2 )"
240 ver_p="$( printf "${version}" |cut -d . -f 3 )"
242 prefix="$(pwd)/crosstool-ng-${version}"
243 pushd "${repos}" >/dev/null 2>&1
245 printf "Checking for existing tag: "
246 if hg tags |grep -E '^'"crosstool-ng-${version}"'\>' >/dev/null; then
247 printf "already tagged\n"
252 if [ ${ver_p} -eq 0 ]; then
254 print_intro_changelog="print_intro_changelog_full_release"
256 msg="create maintenance branch, (update|bump) version to [[:digit:]]+"'\'".[[:digit:]]+"'\'".0"'$'
261 print_intro_changelog="print_intro_changelog_bug_fix"
263 msg="(update|bump) version to ${ver_M}"'\'".${ver_m}"'\'".$((ver_p-1))"'\+hg$'
264 branch="${ver_M}.${ver_m}"
268 printf "Computing boundary revisions:"
270 printf " %d:%d\n" ${r1} ${r2}
272 printf "Tagging release:"
273 hg up "${branch}" >/dev/null
274 if [ ${ver_p} -eq 0 ]; then
275 printf " update version"
276 hg branch "${ver_M}.${ver_m}" >/dev/null
277 echo "${version}" >".version"
278 hg ci -m "${ver_M}.${ver_m}: create maintenance branch, update version to ${version}"
280 printf " update version"
281 echo "${version}" >".version"
282 hg ci -m "${ver_M}.${ver_m}: update version to ${version}"
286 hg tag -m "Tagging release ${version}" crosstool-ng-${version}
288 printf ", update version"
289 echo "${version}+hg" >".version"
290 hg ci -m "${ver_M}.${ver_m}: update version to ${version}+hg"
293 date="$( hg log -r crosstool-ng-${version} --template '{date|isodate}\n' \
294 |sed -r -e 's/-|://g; s/ /./; s/ //;' \
298 if [ ${ver_p} -eq 0 ]; then
299 printf "Generating release mail:"
301 print_intro_mail > "${prefix}.mail"
303 print_author_stats >>"${prefix}.mail"
305 print_author_shortlog >>"${prefix}.mail"
307 print_short_diffstat >>"${prefix}.mail"
311 printf "Generating release changelog:"
313 ${print_intro_changelog} > "${prefix}.changelog"
315 print_author_stats >>"${prefix}.changelog"
317 print_author_shortlog >>"${prefix}.changelog"
319 print_diffstat >>"${prefix}.changelog"
324 printf "Creating tarball:"
325 prefix="crosstool-ng-${version}"
327 hg archive --cwd "${repos}" -r "${prefix}" -X '.hg*' "$(pwd)/${prefix}.tar.bz2"
328 date="$( hg log -R "${repos}" -r "${prefix}" --template '{date|rfc822date}\n' )"
330 for s in md5 sha1 sha512; do
331 ${s}sum "${prefix}.tar.bz2" >"${prefix}.tar.bz2.${s}"
334 touch -d "${date}" "${prefix}"*
337 if [ ${ver_p} -eq 0 ]; then
338 printf "\nAn editor will be launched for you to edit the mail.\n"
339 read -p "Press enter when ready..." foo
340 cp "${prefix}.mail"{,.orig}
342 diff -du -U 1 "${prefix}.mail"{.orig,} |patch -p0 "${prefix}.changelog" >/dev/null
343 rm -f "${prefix}".{mail,changelog}.orig
346 printf "\nAn editor will be launched for you to review the changelog.\n"
347 read -p "Press enter when ready..." foo
348 vi "${prefix}.changelog"
350 printf "\nNow, you can push the changes with: hg push -R '${repos}'\n"