scripts/mk-release.sh
changeset 1833 a4c371728d07
parent 1822 7893174d0fe8
child 1837 7bb70675cd1d
     1.1 --- a/scripts/mk-release.sh	Sun Mar 07 13:17:27 2010 +0100
     1.2 +++ b/scripts/mk-release.sh	Sun Mar 14 12:12:10 2010 +0100
     1.3 @@ -67,13 +67,13 @@
     1.4  		The release can be found at the following URLs:
     1.5  		Changelog: http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-${version}.changelog
     1.6  		Tarball:   http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-${version}.tar.bz2
     1.7 -		Patches:   http://ymorin.is-a-geek.org/download/crosstool-ng/01-fixes/${version}
     1.8 +		Patches:   http://ymorin.is-a-geek.org/download/crosstool-ng/01-fixes/${version}/
     1.9  		
    1.10  		As a reminder, the home for crosstool-NG is:
    1.11  		http://ymorin.is-a-geek.org/projects/crosstool
    1.12  		
    1.13  		Crosstool-NG also has a Freshmeat page:
    1.14 -		http://freshmeat.net/projects/crosstool-ng/
    1.15 +		http://freshmeat.net/projects/crosstool-ng
    1.16  	_EOF_
    1.17  }
    1.18  
    1.19 @@ -183,12 +183,56 @@
    1.20      |head -n -1                             \
    1.21      |while read file line; do
    1.22          if [ ${#file} -gt 57 ]; then
    1.23 -            file="...$( echo "${file}" |sed -r -e 's/^.*(.{54})$/\1/;' )"
    1.24 +            file="$( echo "${file}" |sed -r -e 's/^(.{,24}).*(.{28})$/\1.....\2/;' )"
    1.25          fi
    1.26          printf "    %-57s %s\n" "${file}" "${line}"
    1.27      done
    1.28  }
    1.29  
    1.30 +print_short_diffstat() {
    1.31 +    printf "\nThe short diffstat follows:\n\n"
    1.32 +
    1.33 +    eval total=$(( $(
    1.34 +        hg diff -r "${r1}:${r2}" --color=never "${i}"                               \
    1.35 +        |diffstat -r 2 -p 1 -w 10                                                   \
    1.36 +        |tail -n 1                                                                  \
    1.37 +        |sed -r -e 's/^[[:space:]]*[[:digit:]]+ files? changed(,[[:space:]]+|$)//;' \
    1.38 +                -e 's/([[:digit:]]+)[^-\+]+\((-|\+)\)/\1/g;'                        \
    1.39 +                -e 's/,//g; s/ /+/; s/^$/0/;'
    1.40 +    ) ))
    1.41 +    printf "    %-24.24s %5d(+/-)\n" "Total" ${total}
    1.42 +    others=${total}
    1.43 +
    1.44 +    { for i in              \
    1.45 +        kconfig/            \
    1.46 +        patches/            \
    1.47 +        config/*/           \
    1.48 +        scripts/build/*/    \
    1.49 +        samples/            \
    1.50 +        ; do
    1.51 +        eval val=$(( $(
    1.52 +            hg diff -r "${r1}:${r2}" --color=never "${i}"                               \
    1.53 +            |diffstat -r 2 -p 1 -w 10                                                   \
    1.54 +            |tail -n 1                                                                  \
    1.55 +            |sed -r -e 's/^[[:space:]]*[[:digit:]]+ files? changed(,[[:space:]]+|$)//;' \
    1.56 +                    -e 's/([[:digit:]]+)[^-\+]+\((-|\+)\)/\1/g;'                        \
    1.57 +                    -e 's/,//g; s/ /+/; s/^$/0/;'
    1.58 +        ) ))
    1.59 +        if [ ${val} -gt $((total/100)) ]; then
    1.60 +            printf "%d %s\n" $(((1000*val)/total)) "${i}"
    1.61 +            others=$((others-val))
    1.62 +        fi
    1.63 +    done; printf "%d Others\n" $(((1000*others)/total)); }  \
    1.64 +    |sort -nr                                               \
    1.65 +    |{ while read v i; do
    1.66 +        if [ "${i}" = "Others" ]; then
    1.67 +            others=${v}
    1.68 +        else
    1.69 +            printf "    %-24.24s %3d.%d%%\n" "${i}" $((v/10)) $((v%10))
    1.70 +        fi
    1.71 +       done; printf "    %-24.24s %3d.%d%%\n" "Others" $((others/10)) $((others%10)); }
    1.72 +}
    1.73 +
    1.74  ver_M="$( printf "${version}" |cut -d . -f 1 )"
    1.75  ver_m="$( printf "${version}" |cut -d . -f 2 )"
    1.76  ver_p="$( printf "${version}" |cut -d . -f 3 )"
    1.77 @@ -257,6 +301,8 @@
    1.78      print_author_stats      >>"${prefix}.mail"
    1.79      printf ", shortlog"
    1.80      print_author_shortlog   >>"${prefix}.mail"
    1.81 +    printf ", diffstat"
    1.82 +    print_short_diffstat    >>"${prefix}.mail"
    1.83      printf ", done.\n"
    1.84  fi
    1.85  
    1.86 @@ -296,9 +342,10 @@
    1.87  if [ ${ver_p} -eq 0 ]; then
    1.88      printf "\nAn editor will be launched for you to edit the mail.\n"
    1.89      read -p "Press enter when ready..." foo
    1.90 -	cp "${prefix}.mail"{,.orig}
    1.91 +    cp "${prefix}.mail"{,.orig}
    1.92      vi "${prefix}.mail"
    1.93 -	diff -du -U 1 "${prefix}.mail"{.orig,} |patch -p0 "${prefix}.changelog" >/dev/null
    1.94 +    diff -du -U 1 "${prefix}.mail"{.orig,} |patch -p0 "${prefix}.changelog" >/dev/null
    1.95 +    rm -f "${prefix}".{mail,changelog}.orig
    1.96  fi
    1.97  
    1.98  printf "\nAn editor will be launched for you to review the changelog.\n"