4 my_name="$( basename "${0}" )"
9 ${my_name} <repos_dir> <M.m.p>
16 [ -n "${repos}" ] || { usage; exit 1; }
17 [ -d "${repos}" ] || { printf "${my_name}: ${repos}: no such file or directory\n"; exit 1; }
18 [ -n "${version}" ] || { usage; exit 1; }
26 split($2,a,":"); rev=a[1];
28 $0~/^summary:[[:space:]]*[[:digit:]]+\.[[:digit:]]+: '"${msg}"'/ \
30 printf( "%d\n", rev ); found=1;
34 r2=$( hg log -b "${branch}" \
35 |awk '$1=="changeset:" {
37 printf( "%d\n", a[1] );
42 r1_log=$((r1+log_offset))
43 if [ ${#r1_log} -gt ${#r2} ]; then
54 I'm pleased to announce the release of crosstool-NG ${version}!
56 As usual, there has been quite a number of improvements, new features,
57 and bug fixes all around. The most notable changes are listed below:
60 YEM: PUT YOUR MESSAGE HERE
63 This marks the beginning of the ${ver_M}.${ver_m} maintenance branch, and the end of
64 the previous maintenance branch. As always, comments and suggestions
67 The release can be found at the following URLs:
68 Changelog: http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-${version}.changelog
69 Tarball: http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-${version}.tar.bz2
70 Patches: http://ymorin.is-a-geek.org/download/crosstool-ng/01-fixes/${version}
72 As a reminder, the home for crosstool-NG is:
73 http://ymorin.is-a-geek.org/projects/crosstool
75 Crosstool-NG also has a Freshmeat page:
76 http://freshmeat.net/projects/crosstool-ng/
80 print_intro_changelog_full_release() {
82 crosstool-NG ${version} -- ${date}
84 This is a feature-release. Significant changes are:
87 YEM: PUT YOUR MESSAGE HERE
92 print_intro_changelog_bug_fix() {
94 crosstool-NG ${version} -- ${date}
96 This is a bug-fix-only release.
100 print_author_stats() {
101 printf "\nMany thanks to the people who contributed to this release:\n\n"
103 template='{author|person}\n'
104 hg log -b "${branch}" -r "${r1_log}:${r2}" \
105 --template "${template}" \
106 |sed -r -e 's/"//g;' \
111 for( author in nb ) {
112 printf( " %4d %s\n", nb[author], author );
118 print_author_shortlog() {
119 printf "\nHere is the per-author shortlog:\n"
121 template='{author|person}|{rev}|{branches}|{desc|firstline}\n'
122 hg log -b "${branch}" -r "${r1_log}:${r2}" \
123 --template "${template}" \
126 printf( "%s", gensub("\"","","g",a[1]) );
127 printf( "|%0*d", '${rev_w}', a[2] );
129 printf( "|%s", a[i] );
135 author="$( echo "${line}" |cut -d \| -f 1 )"
136 rev="$( echo "${line}" |cut -d \| -f 2 )"
137 br="$( echo "${line}" |cut -d \| -f 3 )"
138 desc="$( echo "${line}" |cut -d \| -f 4- )"
148 *": close "*" branch"*) continue;;
149 # *\(merged\)) continue;;
152 author="$( echo "${author}" |sed -r -e 's/"//g;' )"
154 if [ ! "${prev_author}" = "${author}" ]; then
156 printf " ${author}:\n"
157 prev_author="${author}"
159 rev="$( echo "${rev}" |sed -r -e 's/^0*//;' )"
161 printf "%s\n" "${desc}" \
163 |(first=1; while read l; do
164 if [ -n "${first}" ]; then
165 printf " [%*d] %s\n" ${rev_w} ${rev} "${l}"
168 printf " %*.*s %s\n" ${rev_w} ${rev_w} '' "${l}"
175 printf "\nThe diffstat follows:\n\n"
176 hg diff -r "${r1}:${r2}" --color=never \
177 |diffstat -r 2 -p 1 -w 10 \
179 |sed -r -e 's/^ */ /;'
181 hg diff -r "${r1}:${r2}" --color=never \
182 |diffstat -f 1 -r 2 -p 1 -w 10 \
184 |while read file line; do
185 if [ ${#file} -gt 57 ]; then
186 file="...$( echo "${file}" |sed -r -e 's/^.*(.{54})$/\1/;' )"
188 printf " %-57s %s\n" "${file}" "${line}"
192 ver_M="$( printf "${version}" |cut -d . -f 1 )"
193 ver_m="$( printf "${version}" |cut -d . -f 2 )"
194 ver_p="$( printf "${version}" |cut -d . -f 3 )"
196 prefix="$(pwd)/crosstool-ng-${version}"
197 pushd "${repos}" >/dev/null 2>&1
199 printf "Checking for existing tag: "
200 if hg tags |grep -E '^'"crosstool-ng-${version}"'\>' >/dev/null; then
201 printf "already tagged\n"
206 if [ ${ver_p} -eq 0 ]; then
208 print_intro_changelog="print_intro_changelog_full_release"
210 msg="create maintenance branch, (update|bump) version to [[:digit:]]+"'\'".[[:digit:]]+"'\'".0"'$'
215 print_intro_changelog="print_intro_changelog_bug_fix"
217 msg="(update|bump) version to ${ver_M}"'\'".${ver_m}"'\'".$((ver_p-1))"'\+hg$'
218 branch="${ver_M}.${ver_m}"
222 printf "Computing boundary revisions:"
224 printf " %d:%d\n" ${r1} ${r2}
226 printf "Tagging release:"
227 hg up "${branch}" >/dev/null
228 if [ ${ver_p} -eq 0 ]; then
229 printf " update version"
230 hg branch "${ver_M}.${ver_m}" >/dev/null
231 echo "${version}" >".version"
232 hg ci -m "${ver_M}.${ver_m}: create maintenance branch, update version to ${version}"
234 printf " update version"
235 echo "${version}" >".version"
236 hg ci -m "${ver_M}.${ver_m}: update version to ${version}"
240 hg tag -m "Tagging release ${version}" crosstool-ng-${version}
242 printf ", update version"
243 echo "${version}+hg" >".version"
244 hg ci -m "${ver_M}.${ver_m}: update version to ${version}+hg"
247 date="$( hg log -r crosstool-ng-${version} --template '{date|isodate}\n' \
248 |sed -r -e 's/-|://g; s/ /./; s/ //;' \
252 if [ ${ver_p} -eq 0 ]; then
253 printf "Generating release mail:"
255 print_intro_mail > "${prefix}.mail"
257 print_author_stats >>"${prefix}.mail"
259 print_author_shortlog >>"${prefix}.mail"
263 printf "Generating release changelog:"
265 ${print_intro_changelog} > "${prefix}.changelog"
267 print_author_stats >>"${prefix}.changelog"
269 print_author_shortlog >>"${prefix}.changelog"
271 print_diffstat >>"${prefix}.changelog"
276 printf "Creating tarball:"
277 prefix="crosstool-ng-${version}"
279 hg clone "${repos}" "${prefix}" >/dev/null
280 hg up -R "${prefix}" "${prefix}" >/dev/null
281 date="$( hg log -R "${prefix}" -r "${prefix}" --template '{date|rfc822date}\n' )"
283 rm -rf "${prefix}/"{.hg,.hgtags,.hgignore}
285 tar cjf "${prefix}.tar.bz2" "${prefix}"
287 for s in md5 sha1 sha512; do
288 ${s}sum "${prefix}.tar.bz2" >"${prefix}.tar.bz2.${s}"
293 touch -d "${date}" "${prefix}"*
296 if [ ${ver_p} -eq 0 ]; then
297 printf "\nAn editor will be launched for you to edit the mail.\n"
298 read -p "Press enter when ready..." foo
299 cp "${prefix}.mail"{,.orig}
301 diff -du -U 1 "${prefix}.mail"{.orig,} |patch -p0 "${prefix}.changelog" >/dev/null
304 printf "\nAn editor will be launched for you to review the changelog.\n"
305 read -p "Press enter when ready..." foo
306 vi "${prefix}.changelog"
308 printf "\nNow, you can push the changes with: hg push -R '${repos}'\n"